API Documentation

for 0.0.1
Show:

VideoTexture Class

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()).

Constructor

VideoTexture

(
  • params
)

Parameters:

  • params Object

    params The parameters object

    • video Video

      the html5 video object to use for this VideoTexture

    • [fps= 30] Number optional

      the fps to use for this video playback, used only with iOS devices. NB : this parameter will not change the playback speed of the video, it will only affect it's picture update frequency.

    • [loop= false] Boolean optional

      whether the video should loop after playback end

    • [autoPlay= false] Boolean optional

      whether the video should play at construction

Example:

//TODO

Methods

getBuffered

() Object

Gets the current buffered part of this video

Returns:

Object:

the current buffered part as a TimeRange Object {length:Number, start:Number, end:Number}

getCurrentTime

() Number

Gets the current time of this video

Returns:

Number:

the current time of this video in seconds

getDuration

() Number

Get the duration of the video file in seconds

Returns:

Number:

duration

getHeight

() Number

Get the current video height

Returns:

Number:

the video height

getIsPlaying

() Boolean

Get playing state

Returns:

Boolean:

playing state

getPlaybackRate

() Number

Get the current playback rate

Returns:

Number:

the playback rate

getWidth

() Number

Get the current video width

Returns:

Number:

the video width

onVideoEnded

(
  • e
)
private

Ended event to manage loop playback

Parameters:

  • e Event

onVideoSrcLoaded

(
  • e
)
private

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:, end: }. FIXME : should map to the orginal list produced by HTML5 TimeRange object

Parameters:

  • e Event

pause

()

Pause the video

play

()

Play the video

setCurrentTime

(
  • t
)

Set the current time of this video

Parameters:

  • t Number

    the current time (in second) to

setLoop

(
  • val
)

Set Loop on or off for this video

Parameters:

  • val Boolean

setPlaybackRate

(
  • r
)

Set the playback rate of the video. See https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/playbackRate for more details

Parameters:

  • r Number

    the playback rate

stop

()

Stop the video

update

()

updates the video texture, should be done everytime an update is desired (i.e. every frame)