中断视频流


                    

问题:</ strong>
我正在使用Flowplayer使用 stream_get_contents(); </ code>从php文件中流式传输视频,如此处。 效果很好,但是如果我尝试使用AJAX加载新视频,则AJAX在加载新信息之前会“等待”文件完成缓冲。 IE9将在单击链接之前等待缓冲完成。 </ p>

问题:</ strong>
有没有一种方法(也许使用JS,Jquery)来中断或停止视频的缓冲,以便程序可以继续执行而不必等待整个文件被下载?</ p>

可能的解决方案:</ strong>
看起来JS可以工作,直到它发送带有AJAX的 xmlhttprequest </ code>,然后它将等待。 我在想也许 xmlhttprequest.abort(); </ code>是一个解决方案,但也许不是,因为我从未为流媒体视频创建 xmlhttprequest </ code>。</ p>

感谢您的所有回复。</ p>
     </ div>

展开原文

原文

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.

1个回答


对此响应不多,但是如果有人想知道,您要做的就是使用JS清除元素。 示例:</ p>

如果这是我的代码:</ p>

  

     <对象>
         <!-视频播放器在这里->
     </ object>
</ div>
</ code> </ pre>

然后用JS:</ p>

  document.getElementById(“ videoPlayerBox”)。innerHTML ='';
</ code> </ pre>

或JQuery:</ p>

  $('#videoPlayerBox')。html('');
</ code> </ pre>

非常明显且简单的答案! 这将清除播放器并“中断”流。 然后通过AJAX加载新的播放器,或者您想与新视频一起加载。 希望有一天能对某人有所帮助!</ p>
     </ div>

展开原文

原文

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!

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问