Option name | Type | Description |
---|---|---|
selector | domelement_or_querystring_or_jqueryobject | The element containing the .js-player or .player element within which the video will be created |
options | object | Object containing the settings for this video player controls {boolean: false} If true, the browser's default controls will be shown |
NATION.Utils
NATION.EventDispatcher
Basic YouTube video player without custom controls
To immediately initiate a video, use the data attribute 'data-video' on the selector, and set this to the YouTube video's URL
API has been structured to allow this class to be interchangeable with the BasicVideoPlayer
Can be used with NATION.MediaControls to create a full player
Event that's fired when the video can be played
Event that's fired when the video has started playing
Event that's fired when the video has been paused
Event that fires when the video reaches the end and stops playing
Event that's fired each time the video's current time changes
Event that's fired each time video data has been downloaded
Event that's fired when the player enters full screen mode
Event that's fired when the player exits full screen mode
Play, or resume playing, the video
Pause the video
Mute the video's sound
Unmute the video's sound
Option name | Type | Description |
---|---|---|
time | number | Time to seek the current video to (in seconds) |
Seek video to a position
Option name | Type | Description |
---|---|---|
milliseconds | number | If true, this method returns the current time in milliseconds |
Returns current play position (in seconds)
Returns current progress percentage between 0 and 1
Returns percentage of current video loaded between 0 and 1
Option name | Type | Description |
---|---|---|
milliseconds | number | If true, this method returns the duration in milliseconds |
Returns duration of current video (in seconds)
Returns string with duration of video in 0:00:00 format
Returns string with current time in 0:00:00 format
Returns whether player can be used yet
Returns if video is currently playing
Enters full screen mode
Exits full screen mode
Play a new video (stops any currently playing)
Rebuild the YouTube player
Destroy the player completely