Video Controls
rooomSpaces Viewer API video management for interactive virtual environments. Control video playback, timing, audio, and progression events in 3D virtual spaces.
getVideos
getVideos([callback: Function])
Returns an array of all video IDs currently available in the virtual space.
api.getVideos(function(videoIds){
console.log('Available videos:', videoIds); // ['video_1', 'video_2', ...]
});getVideoProgressionEvents
getVideoProgressionEvents(videoId: string, [callback: Function])
Enables progression events for a specific video.
api.getVideoProgressionEvents('video_1', function(){
console.log('Video progression events enabled for video_1');
});
// Listen for progression events
api.on('video.progression', function(data) {
console.log('Video progress:', data.currentTime, '/', data.duration);
});stopVideoProgressionEvents
stopVideoProgressionEvents(videoId: string, [callback: Function])
Disables progression events for a specific video to reduce event overhead when detailed tracking is not needed.
api.stopVideoProgressionEvents('video_1', function(){
console.log('Video progression events stopped for video_1');
});playVideo
playVideo(videoId: string, [callback: Function])
Starts playback of the specified video.
api.playVideo('video_1', function(){
console.log('Video playback started');
});pauseVideo
pauseVideo(videoId: string, [callback: Function])
Pauses playback of the specified video while maintaining the current playback position.
api.pauseVideo('video_1', function(){
console.log('Video playback paused');
});setVideoTime
setVideoTime(videoId: string, time: number, [callback: Function])
Sets the current playback time for a video in seconds. Useful for creating chapter navigation or synchronized video experiences.
// Jump to 30 seconds into the video
api.setVideoTime('video_1', 30, function(){
console.log('Video time set to 30 seconds');
});
// Skip to specific chapters
function jumpToChapter(videoId, chapterTime) {
api.setVideoTime(videoId, chapterTime, function(){
console.log(`Jumped to chapter at ${chapterTime}s`);
});
}muteVideo
muteVideo(videoId: string, [callback: Function])
Mutes the audio of a specific video while continuing visual playback. Useful for creating silent video backgrounds or managing audio conflicts.
api.muteVideo('video_1', function(){
console.log('Video audio muted');
});unmuteVideo
unmuteVideo(videoId: string, [callback: Function])
Enables audio for a specific video, restoring sound to the video playback.
api.unmuteVideo('video_1', function(){
console.log('Video audio enabled');
});