Skip to content

chrome tab页切换引起播放延迟加大 #44

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

Closed
7956968 opened this issue Aug 7, 2020 · 4 comments
Closed

chrome tab页切换引起播放延迟加大 #44

7956968 opened this issue Aug 7, 2020 · 4 comments

Comments

@7956968
Copy link

7956968 commented Aug 7, 2020

chrome 版本 84.0.4147.105(正式版本) (64 位)
win10 64位

切换tab到其他页面,再切换回来,发现视频从切换前开始播放, 后来似乎在努力追赶播放进度, 但切换时间过长还是无法追赶上。

有没有什么定位思路?

@Yordroid
Copy link

切换后,就把数据丢掉,然后缓存一下最后的关键帧,等切换回来后再把丢到播放buffer?

@HobaiRiku
Copy link

Let me mark this after 4 years.

t.onprogress = function() {
      t.currentTime < t.seekable.end(0) - .3 && (t.currentTime = t.seekable.end(0) - .3)
    }

which t is the HtmlVideoElement.

@MafiaboyYang
Copy link

MafiaboyYang commented Dec 9, 2024

在onSBUpdateEnd函数中添加如下追赶代码:

if (this.media.buffered.length > 0) {
  const end = this.media.buffered.end(0);
  if (end - this.media.currentTime > 0.5 || this.media.currentTime > end) { // 其中this.media.currentTime > end测试发现浏览器打开开发者工具并且完全挡住视频的情况下currentTime会超过sourceBuffer.end(0)
    this.media.currentTime = parseFloat(end - 0.1);
  }
}

@7956968
Copy link
Author

7956968 commented Mar 28, 2025

tks

@7956968 7956968 closed this as completed Mar 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants