-
-
Notifications
You must be signed in to change notification settings - Fork 12
Root: ui|v2.5|src|@types: videojs‐vr.d.ts
Serechops edited this page Apr 9, 2024
·
2 revisions
This TypeScript declaration file provides type definitions for the videojs-vr
module, which is a plugin for Video.js that enables virtual reality (VR) playback of videos.
The module exports a function videojsVR
and a class Plugin
. It also extends the VideoJsPlayer
interface from Video.js to include VR-related properties and methods.
- Signature:
videojsVR(options?: videojsVR.Options): videojsVR.Plugin
- Description: Creates a new instance of the VR plugin with the specified options.
- Parameters:
-
options
(optional): An object containing configuration options for the VR plugin.
-
- Returns: An instance of the
Plugin
class.
-
Properties:
-
cameraVector
: A vector representing the camera's orientation in the VR scene. -
camera
: An instance of theTHREE.Camera
class representing the camera used for rendering the VR scene. -
scene
: An instance of theTHREE.Scene
class representing the VR scene. -
renderer
: An instance of theTHREE.Renderer
class used for rendering the VR scene.
-
-
Methods:
-
setProjection(projection: videojsVR.ProjectionType): void
: Sets the projection type for the VR video. -
init(): void
: Initializes the VR plugin. -
reset(): void
: Resets the VR plugin to its initial state.
-
-
Constants:
-
VERSION
: A constant representing the version of Video.js used by the VR plugin.
-
-
Types:
-
ProjectionType
: A union type representing different types of video projections supported by the VR plugin.
-
-
Interfaces:
-
Options
: An interface defining configuration options for the VR plugin. -
PlayerMediaInfo
: An interface defining media information properties for a Video.js player.
-
import videojs from "video.js";
import videojsVR from "videojs-vr";
// Create a Video.js player instance
const player = videojs("my-video");
// Initialize the VR plugin with custom options
const vrPlugin = videojsVR({
projection: "360",
motionControls: true,
debug: false
});
// Add the VR plugin to the player
player.vr = vrPlugin;
// Set player media information with projection type
player.mediainfo = {
projection: "360"
};
// Set up VR environment
player.vr.init();
// Play the video
player.play();
In this example, the videojsVR function is imported from the videojs-vr module, and a new instance of the VR plugin is created with custom options. The VR plugin is then added to a Video.js player instance, and the player media information is set with the projection type. Finally, the VR environment is initialized, and the video playback is started.