0

On my website, I'd like to be able to stop the video loading. Can I do it with jquery? What're my options?

The need is that my website has many videos, when a user with a limited internet connection wanna see a one-hour video then decides that he wants quit the video page (ajax only is performed), the video continues its loading anyway, so if does this with two or three videos his browser will freeze to death. So unless he refreshes the page, the video loading goes on til it's done.

Given that my web's based on apache2, symfony2/php5, projekktor/jquery

4

3 回答 3

1

检查这个答案 - HTML5 Video: Force abort of buffering

显然删除 src 属性的值会导致视频停止加载/缓冲

OP还建议先停止视频以防止浏览器控制台出现任何错误

于 2015-05-07T10:26:09.333 回答
0

一种方法是将页面拆分为多个单个视频页面。它仍然没有完全解决问题,但至少在较小程度上使用了用户的资源。

我的另一个想法是在用户停止视频时将视频源设置为空字符串。据我在线阅读,它释放了空间并将视频留空。如果用户想再次播放视频,还应该有一个按钮来将源设置为原始路径。

第二个想法引发了一些小问题,例如从用户停止视频的那一刻起无法继续播放视频,但我认为它仍然比占用用户的连接来加载它要好。

于 2015-05-07T10:24:39.370 回答
0

为什么不使用 API 播放和暂停视频:API

player.setPlayPause():Boolean   

设置播放器在播放时暂停,反之亦然。

或其中之一:

player.setPlay():Boolean

设置播放器播放。如果它已经在播放,则不适用任何更改。

player.setPause():Boolean

设置播放器暂停。如果它已经暂停,则不适用任何更改。

player.setStop():Boolean

设置播放器停止。将导致播放组件立即停止并显示当前项目的海报图像。此外,开始按钮出现。

于 2015-05-07T10:31:16.620 回答