Skip to content
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

[PLAYER] Investigate video.js background tab high CPU usage #135

Closed
DispatchCommit opened this issue Apr 28, 2020 · 6 comments · Fixed by #136
Closed

[PLAYER] Investigate video.js background tab high CPU usage #135

DispatchCommit opened this issue Apr 28, 2020 · 6 comments · Fixed by #136
Assignees
Labels
bug Something isn't working video player Something related to video.js features, or display of media

Comments

@DispatchCommit
Copy link
Collaborator

Investigate video.js memory leak.

When bitwave tab is in background, RAF's are potentially queued and attempt to immediately all fire at once once tab regains focus. This causes a large amount of CPU usage and freezes the entire page until all RAF's have completed. The longer a page is in the background, the longer the wait will likely be.

Initial assumptions are that this had been fixed in 7.6.x, and re-introduced with 7.7.x

video.js issue being tracked: videojs/video.js#5937
Assumed to be the breaking PR: videojs/video.js#6155

Investigate and confirm functionality for 7.6.6 build compared to 7.7.0 build.

@DispatchCommit
Copy link
Collaborator Author

@DispatchCommit DispatchCommit added bug Something isn't working In Progress Work has begun on this issue needs info Additional information or investigation is needed video player Something related to video.js features, or display of media labels Apr 28, 2020
@DispatchCommit DispatchCommit self-assigned this Apr 28, 2020
@DispatchCommit
Copy link
Collaborator Author

Top: 7.6.6
Bottom: 7.7.5

image

More details:
image

@DispatchCommit
Copy link
Collaborator Author

Here's a code profile comparison, v7.7.5 is substantially slower upon tab focus compared to v.7.6.6, and it appears to be related to an anonymous function call that calls functions such as update, getCurrentTime, duration, seekableEnd, and liveWindow which make me think my previous suspicions are correct.

image

Next step may be to fork 7.6.6 and revert the PR linked above and compare.

@DispatchCommit
Copy link
Collaborator Author

Submitted PR with fix: videojs/video.js#6621

@DispatchCommit DispatchCommit removed In Progress Work has begun on this issue needs info Additional information or investigation is needed labels Apr 28, 2020
@DispatchCommit DispatchCommit changed the title [PLAYER] Investigate video.js memory leak [PLAYER] Investigate video.js background tab high CPU usage Apr 28, 2020
@DispatchCommit
Copy link
Collaborator Author

Install temporary dev package with npm install video.js@github:bitwave-tv/video.js#dev
Current version will report 7.8.2

@DispatchCommit
Copy link
Collaborator Author

published on npm, install with: npm install video.js@npm:@bitwave/video.js to avoid issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working video player Something related to video.js features, or display of media
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant