Note that there are some explanatory texts on larger screens.

plurals
  1. POHTML5 Javascript/jQuery Video MEDIA_ERR_NETWORK on localhost
    primarykey
    data
    text
    <p>I have a web application which is intermittently producing an error when using <code>Chrome 30.0.1599.101 m</code>.</p> <p>I am using the HTML5 <code>&lt;video /&gt;</code> tag and controlling the <code>src</code> attribute using <code>javascript</code>.</p> <p>The page which is causing the error sometimes errors on the first video or on the seventh. There is no predictable pattern.</p> <p>Here is the <code>javascript</code> which handles the <code>src</code>:</p> <pre><code>var playing = false; var media = $('#video')[0]; function initModule() { $.ajax({ url: recap, type:'HEAD', error: function(){ screenNotify('Error!', false, "404: Module video content could not be found." + recap, true); }, success: function() { media.src = recap; registerListeners(media); media.load(); } }); } function registerListeners(listen) { listen.addEventListener('ended', hide_recap); listen.addEventListener('error', mediaError); } function mediaError(event) { screenNotify('Media Error!', false, "Media failed with code: " + event.currentTarget.error.code, true); } function play_recap() { if (!playing) { playing = true; media.play(); } } function hide_recap() { if (playing) { playing = false; media.pause(); media.currentTime = 0.0; } } </code></pre> <p>Interestingly, there is no error thrown when I call <code>media.load()</code>, instead, you need to look at the network requests to see that the <code>GET</code> has actually produced a result of <code>(failed)</code>.</p> <p><img src="https://i.stack.imgur.com/D17Zi.png" alt="enter image description here"></p> <p>Another thing to note, is this <code>GET</code> status only occurs for videos which reside within this particular folder location: <code>/interactive/vids/recap/</code>. The error does not occur anywhere else within the application.</p> <p>Finally, the last thing which is strange about this error, is when the application finally attempts to play the video from <code>play_recap()</code>, about 1 second of the video will actually play, followed by an error being thrown on the <code>video</code> element. </p> <p>The error is <code>MEDIA_ERR_NETWORK</code> however this application is installed locally on a <code>Tomcat</code> server and is running under <code>localhost</code>.</p> <p>So why is the <code>GET</code> request producing <code>(failed)</code> and the <code>HTML5</code> <code>&lt;video&gt;</code> element producing a <code>MEDIA_ERR_NETWORK</code> when everything is only ever running on <code>localhost</code>?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload