Repository

VideoTexture

Extends:

Component → VideoTexture

Constructor Summary

Public Constructor
public

VideoTexture Class give the possibility to use a movie file directly as a texture.

Member Summary

Public Members
public
public

fps: *

public
public

loop: *

public

video: *

Private Members
private

_bufferedPourcent: {"start": *, "end": *}

private

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
public

Get the current playback rate

public

Get the current video width

public

on()

public

Pause the video

public

play()

Play the video

public

Set the current time of this video

public

Set Loop on or off for this video

public

Set the playback rate of the video.

public
public

stop()

Stop the video

public

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
public

events: *

public

id: *

public

name: *

private

_nexts: *[]

private
public
public

chain(component: Component)

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 the component This empty method is usually overriden to perform setup 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

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 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#constructor

Params:

NameTypeAttributeDescription
paramsObject

Parameters object, given by the constructor.

params.videoVideo

the html5 video object to use for this VideoTexture

params.loopBoolean
  • optional
  • default: false

whether the video should loop after playback end

params.autoPlayBoolean
  • optional
  • default: false

whether the video should play at construction

Example:

   //TODO

Public Members

public autoPlay: * source

public fps: * source

public isPlaying: boolean 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 getHeight(): Number source

Get the current video height

Return:

Number

the video height

public getIsPlaying(): Boolean source

Get playing state

Return:

Boolean

playing state

public getNativeObject(): * source

Return:

*

the Three.js native object used in this class

public getPlaybackRate(): Number source

Get the current playback rate

Return:

Number

the playback rate

public getWidth(): Number source

Get the current video width

Return:

Number

the video width

public on() source

Activate the component A call to this method calls the setup method if it has not been run yet

Override:

Component#on

public pause() source

Pause the video

public play() source

Play the video

public setCurrentTime(t: Number) source

Set the current time of this video

Params:

NameTypeAttributeDescription
tNumber

the current time (in second) to

public setLoop(val: Boolean) source

Set Loop on or off for this video

Params:

NameTypeAttributeDescription
valBoolean

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:

NameTypeAttributeDescription
rateNumber

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#setup

public 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#update

Private 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:

NameTypeAttributeDescription
eEvent

private onVideoEnded(e: Event) source

Ended event to manage loop playback

Params:

NameTypeAttributeDescription
eEvent