behavior:video

behavior:video

This behavior provides video playback..

Elements

that have this behavior applied by default to:

  • <video> – the video element;

Attributes

this behavior knows about:

src
– string, url of the movie. If provided the behavior will start playing the movie immedieately after loading.
sizing
– string, either "cover" or "contain" (default). Frame box sizing modes: contain – video frame always seen in full, cover – frame always covers content box in full, some parts of the frame can be clipped out.

Methods

videoIsPlaying
() : true | false
reports playback status. If true then video is playing at the moment.
videoIsEnded
() : true | false
true if video playback has reached the end of the movie.
videoDuration
() : duration (float)
reports duration in seconds of the movie. If duration is not available it returns 0.
videoPosition
() : duration (float)
reports current playback position, in seconds.
videoPosition
( time : duration | float ) : duration
sets current playback position, in seconds.
videoHeight
() : integer (pixels)
returns natural height of video frame of the movie.
videoWidth
() : integer (pixels)
returns natural width of video frame of the movie.
videoBox
() : [x,y,width,height]
returns video box rectangle in pixels relative to the  content box of the element. Note if sizing attribute is "cover" then either x or y can be negative.
videoLoad
(movieUrl : string) : true | false
loads video file into the player. It does not start playback automatically.
videoUnload
()
stops video playback and unloads the movie.
videoPlay
( [position:duration] ) : true | false
starts playback at given position or at current position if the position omitted.
videoStop
()
stops playback.
audioVolume
() : float (0.0…1.0)
reports current volume level of audio track. 1.0 correspond to 0db, 0.0 (mute) -100db.
audioVolume
( vol : float )
sets current volume level, float between 0.0 (mute) and 1.0 ( 0db ).
audioBalance
() : float ( -1.0 … +1.0  )
reports current stereo balance.
audioBalance
( balance: float )
sets new value of stereo balance.

Events

Besides of the standard set of events (mouse, keyboard, focus) behavior:video generates following behavior events (delivered to onControlEvent callback):

VIDEO_INITIALIZED
– the video has been loaded successfully and videoWidth/Height and videoDuration are available.
VIDEO_STARTED
– the video just startes, first frame rendered.
VIDEO_STOPED
– the video has stoped.

Value

N/A, the behaivor does not implement value concept.