Video
Create and play new video instance
Notes:
-
Unless the video being referenced by ID or locator has already been preloaded, all
new Video({...})
expressions, including preloads, must always immediately follow a user input action -- like in your Init Script, in a click listener function, after a paused say, choice, etc. You will have issues if you do not strictly follow this! -
OEOS intentionally hides all controls for video playing. The tease script is responsible for controlling volume/pause/play/seek of the video.
-
Only supports video links from gfycat.com and redgif.com
Example:
// Create and play a new video
var myVideo = new Video({
locator: "https://thumbs.gfycat.com/OldThirstyAmericancicada-mobile.mp4",
loops: 1, // Play once
onContinue: function() {
new Say({label: 'Did you like that?'})
}
})
Preload for Next Page Example:
// Create and preload new video -- will not play until myVideo.play() is called
// myVideo.play() should not be called until next page is loaded, else video will probably not be preloaded
var myVideo = new Video({
locator: "https://thumbs.gfycat.com/OldThirstyAmericancicada-mobile.mp4",
loops: 1, // Play once
preload: true
})
Preload then do something example:
// Create and preload new video, prompt for action one preloaded
var myVideo = new Video({
locator: "https://thumbs.gfycat.com/OldThirstyAmericancicada-mobile.mp4",
loops: 1, // Play once
preload: function() {
new Choice({
options: {
label: 'Ready to play?',
onSelect: function () {
myVideo.play()
}
}
})
},
onContinue: function() {
new Say({label: 'Did you like that?'})
}
})
Optional String. Id to use with Video.get(id)
Required String. Valid URL to video.
Supported video domains: https://thumbs*.redgifs.com/
Required Number. Number of times to play the video before stopping. 0 = forver.
Optional Number. Volume level between 0 and 1
Optional Function. Called when all loops have completed.
Optional Function or Boolean.
If set true
, will begin preload of video. Subsequent navigation (pages.goto(...)
) will be paused until preload completes.
If set to a function, function will be called when preload completes, and subsequent navigation (pages.goto(...)
) will be paused until preload completes.
Return video instance for given id
Remove video.
Stop given video
Pause given video
Play given video
Get or set the current playback position, in seconds. (Floating point value. 13.5 would be 13 and a half seconds.)
Returns abstracted HTMLVideoElement for given video instance.
Note: Some native properties and methods for the abstracted HTMLVideoElement may be unavailable, but many are.
[TODO: Add other methods]