weixin_33696822 2012-05-31 14:20 采纳率: 0%
浏览 50

中断视频流

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条回答 默认 最新

  • ~Onlooker 2012-06-08 04:31
    关注

    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!

    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器