Class: VideoFileStream
Defined in: src/video/VideoFileStream.ts:23
VideoFileStream handles video playback from a file source.
Extends
VideoStream<VideoFileStreamDetails>
Constructors
Constructor
new VideoFileStream(
options):VideoFileStream
Defined in: src/video/VideoFileStream.ts:29
Parameters
options
Configuration for the file stream.
videoFile?
undefined = undefined
willCaptureFrequently?
boolean = false
Returns
VideoFileStream
Overrides
Properties
aspectRatio?
optionalaspectRatio:number
Defined in: src/video/VideoStream.ts:86
Inherited from
height?
optionalheight:number
Defined in: src/video/VideoStream.ts:85
Inherited from
isXRScript
isXRScript:
boolean=true
Defined in: src/core/Script.ts:99
Inherited from
loaded
loaded:
boolean=false
Defined in: src/video/VideoStream.ts:83
Inherited from
state
state:
StreamState=StreamState.IDLE
Defined in: src/video/VideoStream.ts:88
Inherited from
stream_
protectedstream_:MediaStream|null=null
Defined in: src/video/VideoStream.ts:90
Inherited from
texture
texture:
Texture
Defined in: src/video/VideoStream.ts:87
Inherited from
video_
protectedvideo_:HTMLVideoElement
Defined in: src/video/VideoStream.ts:91
Inherited from
width?
optionalwidth:number
Defined in: src/video/VideoStream.ts:84
Inherited from
xb?
optionalxb:XBObjectOptions
Defined in: src/interaction/InteractionTypes.ts:32
Inherited from
Accessors
video
Get Signature
get video():
HTMLVideoElement
Defined in: src/video/VideoStream.ts:92
Returns
Inherited from
Methods
dispose()
dispose():
void
Defined in: src/video/VideoStream.ts:286
Disposes of all resources used by this stream.
Returns
void
Inherited from
getSnapshot()
Call Signature
getSnapshot(
options):ImageData
Defined in: src/video/VideoStream.ts:187
Captures the current video frame.
Parameters
options
VideoStreamGetSnapshotImageDataOptions
The options for the snapshot.
Returns
The captured data.
Inherited from
Call Signature
getSnapshot(
options):Promise<string|null>
Defined in: src/video/VideoStream.ts:188
Captures the current video frame.
Parameters
options
VideoStreamGetSnapshotBase64Options
The options for the snapshot.
Returns
Promise<string | null>
The captured data.
Inherited from
Call Signature
getSnapshot(
options):Texture
Defined in: src/video/VideoStream.ts:191
Captures the current video frame.
Parameters
options
VideoStreamGetSnapshotTextureOptions
The options for the snapshot.
Returns
The captured data.
Inherited from
Call Signature
Defined in: src/video/VideoStream.ts:192
Captures the current video frame.
Parameters
options
VideoStreamGetSnapshotBlobOptions
The options for the snapshot.
Returns
The captured data.
Inherited from
handleVideoStreamLoadedMetadata()
protectedhandleVideoStreamLoadedMetadata(resolve,reject,allowRetry):void
Defined in: src/video/VideoStream.ts:153
Processes video metadata, sets dimensions, and resolves a promise.
Parameters
resolve
() => void
The resolve function of the wrapping Promise.
reject
(_) => void
The reject function of the wrapping Promise.
allowRetry
boolean = false
Whether to allow a retry attempt on failure.
Returns
void
Inherited from
VideoStream.handleVideoStreamLoadedMetadata
init()
init():
Promise<void>
Defined in: src/video/VideoFileStream.ts:37
Initializes the file stream based on the given video file.
Returns
Promise<void>
Overrides
initPhysics()
initPhysics(
_physics):void|Promise<void>
Defined in: src/core/Script.ts:118
Enables depth-aware interactions with physics. See /samples/advanced/ballpit
Parameters
_physics
Returns
void | Promise<void>
Inherited from
initStream_()
protectedinitStream_():Promise<void>
Defined in: src/video/VideoFileStream.ts:51
Initializes the video stream from the provided file.
Returns
Promise<void>
onHoverEnter()
onHoverEnter(
_event):void
Defined in: src/core/Script.ts:215
Called when a source starts hovering over this object.
Parameters
_event
The hover source, target, surface, and intersection.
Call event.stopPropagation() to stop bubbling to ancestor Scripts.
Returns
void
Inherited from
onHoverExit()
onHoverExit(
_event):void
Defined in: src/core/Script.ts:221
Called when a source stops hovering over this object.
Parameters
_event
The hover source, target, surface, and intersection.
Call event.stopPropagation() to stop bubbling to ancestor Scripts.
Returns
void
Inherited from
onHovering()
onHovering(
_event):void
Defined in: src/core/Script.ts:227
Called while a source hovers over this object.
Parameters
_event
The hover source, target, surface, and intersection.
Call event.stopPropagation() to stop bubbling to ancestor Scripts.
Returns
void
Inherited from
onKeyDown()
onKeyDown(
_event):void
Defined in: src/core/Script.ts:158
Called on keyboard keypress.
Parameters
_event
Event containing .code to read the keyboard key.
Returns
void
Inherited from
onKeyUp()
onKeyUp(
_event):void
Defined in: src/core/Script.ts:159
Parameters
_event
Returns
void
Inherited from
onLongSelect()
onLongSelect(
_event):void
Defined in: src/core/Script.ts:152
Called when an object selection reaches the long-select delay.
Parameters
_event
Returns
void
Inherited from
onObjectGrabbing()
onObjectGrabbing(
_event):void
Defined in: src/core/Script.ts:253
Called every frame a hand is grabbing this object.
Parameters
_event
Returns
void
Inherited from
onObjectGrabEnd()
onObjectGrabEnd(
_event):void
Defined in: src/core/Script.ts:258
Called when a hand stops grabbing this object. This ends built-in direct-touch manipulation without ending contact.
Parameters
_event
Returns
void
Inherited from
onObjectGrabStart()
onObjectGrabStart(
_event):void
Defined in: src/core/Script.ts:249
Called when a hand starts grabbing this object (touching + pinching). A grab starts built-in direct-touch manipulation when enabled.
Parameters
_event
Returns
void
Inherited from
onObjectLongSelect()
onObjectLongSelect(
_event):void
Defined in: src/core/Script.ts:203
Called once when a captured selection is held for the long-select delay. Manipulation captures do not emit this callback.
Parameters
_event
The controller and completed hold duration.
Call event.stopPropagation() to stop bubbling to ancestor Scripts.
Returns
void
Inherited from
VideoStream.onObjectLongSelect
onObjectManipulate()
onObjectManipulate(
_event):void
Defined in: src/core/Script.ts:209
Called for each phase of an automatic object manipulation. Call
event.stopPropagation() to stop bubbling. Calling preventDefault()
on a start event suppresses the automatic action.
Parameters
_event
Returns
void
Inherited from
VideoStream.onObjectManipulate
onObjectSelectEnd()
onObjectSelectEnd(
_event):void
Defined in: src/core/Script.ts:196
Called when a source stops selecting the object this Script represents.
Parameters
_event
The completed state and end reason.
Call event.stopPropagation() to stop bubbling to ancestor Scripts.
Returns
void
Inherited from
onObjectSelectStart()
onObjectSelectStart(
_event):void
Defined in: src/core/Script.ts:190
Called when a source starts selecting the object this Script represents.
Parameters
_event
event.target is the logical object and
event.source.controller identifies the controller.
Call event.stopPropagation() to stop bubbling to ancestor Scripts.
Returns
void
Inherited from
VideoStream.onObjectSelectStart
onObjectTouchEnd()
onObjectTouchEnd(
_event):void
Defined in: src/core/Script.ts:244
Called when a hand's index finger stops touching this object. This ends the default selection lifecycle after the touch callback.
Parameters
_event
Returns
void
Inherited from
onObjectTouching()
onObjectTouching(
_event):void
Defined in: src/core/Script.ts:239
Called every frame that a hand's index finger is touching this object. The object remains selected during these frames unless touch selection was prevented when contact started.
Parameters
_event
Returns
void
Inherited from
onObjectTouchStart()
onObjectTouchStart(
_event):void
Defined in: src/core/Script.ts:233
Called when a hand's index finger starts touching this object.
Direct touch starts the object's selection lifecycle by default. Call
event.preventDefault() to handle contact without selecting.
Parameters
_event
Returns
void
Inherited from
VideoStream.onObjectTouchStart
onSelect()
onSelect(
_event):void
Defined in: src/core/Script.ts:144
Called whenever pinch / mouse click successfully completes, globally.
Parameters
_event
The interaction source and completed target.
Returns
void
Inherited from
onSelectEnd()
onSelectEnd(
_event):void
Defined in: src/core/Script.ts:138
Called whenever pinch / mouse click discontinues, globally.
Parameters
_event
The completed state and end reason.
Returns
void
Inherited from
onSelecting()
onSelecting(
_event):void
Defined in: src/core/Script.ts:149
Called whenever pinch / mouse click is happening, globally.
Parameters
_event
Returns
void
Inherited from
onSelectStart()
onSelectStart(
_event):void
Defined in: src/core/Script.ts:132
Called whenever pinch / mouse click starts, globally.
Parameters
_event
The interaction source and optional captured target.
Returns
void
Inherited from
onSimulatorStarted()
onSimulatorStarted():
void
Defined in: src/core/Script.ts:124
Returns
void
Inherited from
VideoStream.onSimulatorStarted
onSqueeze()
onSqueeze(
_event):void
Defined in: src/core/Script.ts:181
Called whenever gamepad trigger successfully completes, globally.
Parameters
_event
event.source.controller identifies the controller.
Returns
void
Inherited from
onSqueezeEnd()
onSqueezeEnd(
_event):void
Defined in: src/core/Script.ts:170
Called whenever gamepad trigger stops, globally.
Parameters
_event
event.source.controller identifies the controller.
Returns
void
Inherited from
onSqueezeStart()
onSqueezeStart(
_event):void
Defined in: src/core/Script.ts:165
Called whenever gamepad trigger starts, globally.
Parameters
_event
event.source.controller identifies the controller.
Returns
void
Inherited from
onSqueezing()
onSqueezing(
_event):void
Defined in: src/core/Script.ts:175
Called whenever gamepad is being triggered, globally.
Parameters
_event
Returns
void
Inherited from
onXRSessionEnded()
onXRSessionEnded():
void
Defined in: src/core/Script.ts:122
Returns
void
Inherited from
onXRSessionStarted()
onXRSessionStarted(
_session?):void
Defined in: src/core/Script.ts:121
Parameters
_session?
Returns
void
Inherited from
VideoStream.onXRSessionStarted
physicsStep()
physicsStep():
void
Defined in: src/core/Script.ts:119
Returns
void
Inherited from
setSource()
setSource(
videoFile):Promise<void>
Defined in: src/video/VideoFileStream.ts:91
Sets a new video file source and re-initializes the stream.
Parameters
videoFile
The new video file to play.
string | File
Returns
Promise<void>
setState_()
protectedsetState_(state,details):void
Defined in: src/video/VideoStream.ts:134
Sets the stream's state and dispatches a 'statechange' event.
Parameters
state
The new state.
details
Additional data for the event payload.
VideoStreamDetails | VideoFileStreamDetails
Returns
void
Inherited from
stop_()
protectedstop_():void
Defined in: src/video/VideoStream.ts:267
Stops the current video stream tracks.
Returns
void
Inherited from
update()
update(
_time?,_frame?):void
Defined in: src/core/Script.ts:113
Runs per frame.
Parameters
_time?
number
_frame?
Returns
void