0

Problem: I'm streaming my video from a php file with stream_get_contents(); using Flowplayer as demonstrated here. It works fine however if I try to load in a new video with AJAX, the AJAX "waits" for the file to finish buffering before it loads in the new information. IE9 will wait for the buffering to finish before it follows a clicked link.

Question: Is there a way (maybe with JS, Jquery) to interrupt or stop the video from buffering so the program can continue without having to wait for the whole file to be downloaded?

Possible solutions: It appears the JS will work until it sends an xmlhttprequest with AJAX then it will wait. I was thinking maybe xmlhttprequest.abort(); might be a solution but maybe not because I never create an xmlhttprequest for the streaming video.

Thank you for any and all responses.

Community
  • 1
  • 1
phpKid
  • 333
  • 1
  • 4
  • 14

1 Answers1

0

Didn't get much a response for this one, but if anyone is ever wondering, all you have to do is clear the element using JS. Example:

If this is my code:

<div id="videoPlayerBox">
    <object>
        <!-- Video Player is Here -->
    </object>
</div>

Then in JS:

document.getElementById("videoPlayerBox").innerHTML = '';

or JQuery:

$('#videoPlayerBox').html('');

Very obvious and easy answer! That will clear out the player and 'break' the streaming. Then load in a new player via AJAX or however you want to with the new video. Hope this helps someone someday!

phpKid
  • 333
  • 1
  • 4
  • 14