Monday 15 April 2013

Autoplay HTML5 video after it loads -


I want to autoplay an HTML5 video after loading. When it loads, I would also like to make progress bar (GIF or CSS). Any help?

update 2 Oh, then this answer is a specific task of this scenario. (Only for a 12sec slow connection, the video should be run smoothly) However, it should fill your needs:

  $ (document) .ready (function () {_V_ ("Example_video_1") Ready (function () {var myPlayer = this; myPlayer.on ("Progress", Out_started);});}); Function Out-Started () {myPlayer = this; Var myTextArea = document.getElementById ('Buford'); BufferedTimeRange = myPlayer.buffered (); If (bufferedTimeRange.start (0) == 0) & amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; & amp; (bufferedTimeRange.end (0) - bufferedTimeRange.start (0) & gt; 10)) {myPlayer.play (); }}   

Then there are some things, bufferedTimeRange can be more then a single rnge of time (but only with 12 seconds of video constraints. Documents made as one say only 1 ussualy) .. But there is no guarantee that there is no less, this is a link, it is expected that it helps! If the buffer is not enough for 10 seconds of the video, you can make a statement in 10 in a 12

Basic Answer I'm not sure why you want to do this ... but video.js makes it possible

If you have a video element called example_video_1 So you can write Javscript that looks like this (no it is you have an example to use Video.js which then I recommend setting up It is easy to see and actually choose to start it for setting up)

  VideoJS ("example_video_1") ready (function () {var MyPLAYER = this;. HowMuchIsDownloaded = myPlayer.bufferedPercent (); if (howMuchIsDownloaded == 1) {myPlayer.play (); start with some other video} // // setTimeout (Arguments.callee, 100);}});   

Update It appears that the above API call is currently broken for the video. JS (Report a bug) Here's a video when your video tag id "example_video_1"

  $ (document) .ready ( Function () {_V _ ("example_video_1"). Ready (the function is being buffer ending () {Var myPlayer = this; myPlayer.on ("loaded reddata", Done_download);});}); Function Done_download () {myPlayer = this; Var myTextArea = document.getElementById ('Buford'); Warning ("Video is fully buffer"); MyPlayer.off ("Loaded Reddit", Done_download); }   

Note Video.JS seems to be an internal mechanism that does not allow buffer to buffer a complete video stream before reaching a certain limit You will see this strange behavior here (with at least one .mp4 source) of the video ... ill to keep it on your test server for a few days

No comments:

Post a Comment