javascript - Html5 video trigger "ended" event when no internet connection -


i using tag on android webview. code:

<div class="video-wrapper">     <video id="video" class="video-full-screen" preload="none" webkit-playsinline poster={poster url here}>        <source id="mp4" src="{video source here}" type="video/mp4">        <p>your user agent not support html5 video element.</p>     </video> </div> 

i register following video events:

var video = $('video');  video.bind("canplay", function(){     console.log("canplay"); });  video.bind("playing", function(){     console.log("playing"); });  video.bind("waiting", function(){     console.log("waiting"); });  video.bind("ended", function(){     console.log("ended"); });  video.bind("canplay", function(){     console.log("canplay"); }); 

when disconnect internet before pressing video's poster, receive following events (after clicking poster):

"waiting"

"canplay"

"playing"

"ended"

all of events happening in few seconds (the video not playing). tested on samsung galaxy s4 4.2.2.

this kind of bag? (not happening on ios / nexus 4, android 4.4)

this seems puzzling chain of events. in case scenario think important step try , grab for "disconnect event" error. indeed ended event fire should in conjunction warning/error event. try , bind on error event , take appropriate action if happens, displaying error image or try reload video.

video.bind('error', function() { console.log('error'); }); 

if not enough try abort or stalled event:

video.bind('abort', function() { console.log('abort'); }); video.bind('stalled', function() { console.log('stalled'); }); 

you can read here description of event. stalled event described here.

keep in mind html5 video implementation still dependent on browser/webview manufacturer , device not react expected.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -