import VideoTexture from '@mobilizing/library/js/Mobilizing/renderer/3D/three/texture/VideoTexture.js'
VideoTexture
Extends:
Constructor Summary
Public Constructor | ||
public | constructor(params: Object) VideoTexture Class give the possibility to use a movie file directly as a texture. |
Member Summary
Private Members | ||
private | _bufferedPourcent: {"start": *, "end": *} | |
private | _texture: * |
Method Summary
Public Methods | ||
public | Gets the current buffered part of this video | |
public | Gets the current time of this video | |
public | Get the duration of the video file in seconds | |
public | Get the current video height | |
public | Get playing state | |
public | getNativeObject(): * | |
public | Get the current playback rate | |
public | Get the current video width | |
public | on() | |
public | pause() Pause the video | |
public | play() Play the video | |
public | setCurrentTime(t: Number) Set the current time of this video | |
public | Set Loop on or off for this video | |
public | setPlaybackRate(rate: Number) Set the playback rate of the video. | |
public | setup() | |
public | stop() Stop the video | |
public | update() updates the video texture, should be done everytime an update is desired (i.e. |
Private Methods | ||
private | onLoadProgess(e: Event) Defines a "load progress" behavior. | |
private | onVideoEnded(e: Event) Ended event to manage loop playback |
Inherited Summary
From class Component | ||
public | ||
public | context: * | |
public | events: * | |
public | id: * | |
public | name: * | |
private | _nexts: *[] | |
private | ||
public | byPass() | |
public | Adds a component to this chained component array | |
public | Returns the array of attached children components | |
public | off() Deactivate the component | |
public | on() Activate the component A call to this method calls the setup method if it has not been run yet | |
public | Run code after the update of all components is run This empty method is usually overriden to perform post-update actions for the component It is called periodically by an internal Mobilizing mechanism | |
public | preLoad() preLoad the component This empty method is usually overriden to perform preLoad actions for the component. | |
public | Run code before the update of all components is run This empty method is usually overriden to perform pre-update actions for the component It is called once per component by an internal Mobilizing mechanism | |
public | prepare() prepare the component This empty method is usually overriden to perform preparation actions for the component, from external process as a server. | |
public | setup() Set's up the component This empty method is usually overriden to perform setup actions for the component This is where all the initialization (such as adding event listeners)should be done It is called automatically by an internal Mobilizing mechanism and should thus not be called directly | |
public | update() Update the component This empty method is usually overriden to perform update actions for the component It is called periodically by an internal Mobilizing mechanism |
Public Constructors
public constructor(params: Object) source
VideoTexture Class give the possibility to use a movie file directly as a texture. Therefore, this class contains some movie media fonctions to manage time (play, pause, stop, etc). The texture must be mapped on an Mesh via a Material (setTexture()).
Override:
Component#constructorParams:
Name | Type | Attribute | Description |
params | Object | Parameters object, given by the constructor. | |
params.video | Video | the html5 video object to use for this VideoTexture | |
params.loop | Boolean |
| whether the video should loop after playback end |
params.autoPlay | Boolean |
| whether the video should play at construction |
Example:
//TODO
Public Members
public autoPlay: * source
public fps: * source
public loop: * source
public video: * source
Private Members
private _bufferedPourcent: {"start": *, "end": *} source
private _texture: * source
Public Methods
public getBuffered(): Object source
Gets the current buffered part of this video
Return:
Object | the current buffered part as a TimeRange Object {length:Number, start:Number, end:Number} |
public getCurrentTime(): Number source
Gets the current time of this video
Return:
Number | the current time of this video in seconds |
public getDuration(): Number source
Get the duration of the video file in seconds
Return:
Number | duration |
public getNativeObject(): * source
Return:
* | the Three.js native object used in this class |
public on() source
Activate the component A call to this method calls the setup method if it has not been run yet
Override:
Component#onpublic pause() source
Pause the video
public play() source
Play the video
public setCurrentTime(t: Number) source
Set the current time of this video
Params:
Name | Type | Attribute | Description |
t | Number | the current time (in second) to |
public setLoop(val: Boolean) source
Set Loop on or off for this video
Params:
Name | Type | Attribute | Description |
val | Boolean |
public setPlaybackRate(rate: Number) source
Set the playback rate of the video. See https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/playbackRate for more details
Params:
Name | Type | Attribute | Description |
rate | Number | the playback rate |
public setup() source
Set's up the component This empty method is usually overriden to perform setup actions for the component This is where all the initialization (such as adding event listeners)should be done It is called automatically by an internal Mobilizing mechanism and should thus not be called directly
Override:
Component#setuppublic stop() source
Stop the video
public update() source
updates the video texture, should be done everytime an update is desired (i.e. every frame)
Override:
Component#updatePrivate Methods
private onLoadProgess(e: Event) source
Defines a "load progress" behavior. User can access the result of the progress through the bufferedPourcent property (videoTexture.bufferedPourcent) which is an object constructed like this : this._bufferedPourcent = {start:<Number>, end: <Number>}. FIXME : should map to the orginal list produced by HTML5 TimeRange object
Params:
Name | Type | Attribute | Description |
e | Event |
private onVideoEnded(e: Event) source
Ended event to manage loop playback
Params:
Name | Type | Attribute | Description |
e | Event |