I am using HTML5 video tag inside FlexSlider. Sometimes video stops working. After lot of search I got this error.
GET http://studiobooth.local/app/videos/0062mParticle12151601.mp4 412 (Precondition Failed)
Here is my HTML5 Video tag code:
<video preload="none" src="http://studiobooth.local/app/videos/2.mp4" poster="http://studiobooth.local/app/videos/thumbs/2.jpg" controls="" loop="" style="max-width:100%;height:100%;"><source src="http://studiobooth.local/app/videos/2.mp4" type="video/mp4">Your browser does not support the video tag.</video>
Please help me to fix it out.
Thanks
I got a temporary solution which helped me to make it working. Here is my code in which I am appending milli-seconds to the file source url and re-loading the same video file if any error occurred.
media.addEventListener('error', function (e) {
var date = new Date();
var milliSecs = date.getMilliseconds();
var curr_src = $(media[0]).attr('src');
var curr_src_arr = curr_src.split("?");
var new_src = curr_src_arr[0]+"?t="+milliSecs;
$(media[0]).attr('src',new_src);
$(media[0]).find('source').attr('src',new_src);
media[0].load();
//media[0].play(); /* Here we can not trigger play video/audio without user interaction. */
}, false);
https://developer.apple.com/library/content/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/AudioandVideoTagBasics/AudioandVideoTagBasics.html#//apple_ref/doc/uid/TP40009523-CH2-SW1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With