HTML and CSS Reference
In-Depth Information
Figure 6-5. Preloading a video in JavaScript
The playVideo() function is called when the video object dispatches a canplaythrough
event. playVideo() calls the play() function of the video object, and the video starts to
play:
function
function playVideo () {
var
var videoElement = document . getElementById ( "thevideo" );
videoElement . play ();
}
Example 6-5 gives the full code for preloading video.
Example 6-5. Basic HTML5 preloading video
Search WWH ::




Custom Search