New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
求助。隐藏浏览器页面时,直播视频自动暂停,重新打开页面播放进度滞后的问题 #259
Comments
我目前的解决办法: 为了操作player,把player放到了window里... |
可以直接video.currentTime设到buffered.end(0)附近 |
我在谷歌浏览器也遇到这个问题. 当视频不在可视范围内,切换tab页面,直播就会自动暂停。document.addEventListener("visibilitychange").现在是监听这个属性。不知道是否有更好的解决办法 |
正好遇到这个问题,感谢! |
在什么事件里执行这个呢? |
` function visibilitychange () {
|
video.addEventListener('timeupdate', function () { |
主要是为了严谨一点先判断有没有缓存,然后把他时间设置到缓存前一点点时间所以-0.5,如果直接设置到.end(0)他还需要去加载内容才能流畅继续播放
…------------------ 原始邮件 ------------------
发件人: "bilibili/flv.js" ***@***.***>;
发送时间: 2020年11月5日(星期四) 晚上8:02
***@***.***>;
***@***.******@***.***>;
主题: Re: [bilibili/flv.js] 求助。隐藏浏览器页面时,直播视频自动暂停,重新打开页面播放进度滞后的问题 (#259)
可以直接video.currentTime设到buffered.end(0)附近
在什么事件里执行这个呢?
video.addEventListener('timeupdate', function () {
const buffered = video.buffered.end(0) - 0.5
if (buffered - video.currentTime > 1) {
video.currentTime = buffered
}
})
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
// 网页重新激活后,更新视频
window.onfocus = () => {
let end = player.buffered.end(0) - 1;
this.player.currentTime = end;
}; |
@xqq 遇到的情景类似 #206 ,不过原因似乎不一致,chrome://media-internals/ 下的日志如贴图:
似乎是页面被遮挡后,会自动暂停视频,打开时恢复播放;
另,是否有根据id获取player的方法,因为页面创建了多个player,但是不知道怎么操作某个具体的元素....
感谢!...
The text was updated successfully, but these errors were encountered: