Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Fix #3665 - Performance issues with playlist #3690

Merged
merged 4 commits into from
May 19, 2021

Conversation

Brandon-T
Copy link
Collaborator

@Brandon-T Brandon-T commented May 18, 2021

Summary of Changes

  • Removed all mutation observers in favour of overridden properties.
  • Move all JS communication to a background queue and dispatch to main only when necessary.
  • Changed AVAsset.isPlayable to load asynchronously.

This pull request fixes #3665

Submitter Checklist:

  • Unit Tests are updated to cover new or changed functionality
  • User-facing strings use NSLocalizableString()

Test Plan:

For testing:

Go to YouTube or any media site
Make sure network link conditioner is set to very very bad network
While the site is loading, keep trying to scroll the page.
if the page doesn't scroll properly or exhibits freezing, we have a problem.
If the page does scroll and load correctly, the toast will come up properly without lagging.
Page overall should be much snappier.
Tested:

I tested on YouTube, SoundCloud, Vimeo, dailymotion, twitch. Note for SoundCloud you have to press play first then attempt to scroll while it is loading.

Screenshots:

Reviewer Checklist:

  • Issues include necessary QA labels:
    • QA/(Yes|No)
    • release-notes/(include|exclude)
    • bug / enhancement
  • Necessary security reviews have taken place.
  • Adequate unit test coverage exists to prevent regressions.
  • Adequate test plan exists for QA to validate (if applicable).
  • Issue is assigned to a milestone (should happen at merge time).

}

function $<observeDynamicElements>(node) {
/*function $<observeDynamicElements>(node) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can we remove the code instead of commenting it out?

@jumde jumde self-requested a review May 18, 2021 16:50
Copy link
Contributor

@jumde jumde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

Copy link
Contributor

@iccub iccub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove commented out code, rest looks good

Brandon-T added 4 commits May 19, 2021 13:47
Instead of using observers or mutation observers or anything observing, we hook the exact attribute of the element we want to be notified about.
In our case, this is always going to be an HTMLVideoElement and HTMLAudioElement. We can ignore HTMLSourceElement.
@Brandon-T Brandon-T force-pushed the bugfix/PlaylistPerformance branch from e71d0a3 to 5d49d8b Compare May 19, 2021 17:48
@iccub iccub added this to the 1.26 milestone May 19, 2021
@iccub iccub merged commit 4721454 into development May 19, 2021
@iccub iccub deleted the bugfix/PlaylistPerformance branch May 19, 2021 18:45
iccub pushed a commit that referenced this pull request May 19, 2021
* Possible fix for performance issues in playlist for some users.
Instead of using observers or mutation observers or anything observing, we hook the exact attribute of the element we want to be notified about.
In our case, this is always going to be an HTMLVideoElement and HTMLAudioElement. We can ignore HTMLSourceElement.
iccub pushed a commit that referenced this pull request May 21, 2021
* Possible fix for performance issues in playlist for some users.
Instead of using observers or mutation observers or anything observing, we hook the exact attribute of the element we want to be notified about.
In our case, this is always going to be an HTMLVideoElement and HTMLAudioElement. We can ignore HTMLSourceElement.
@kylehickinson kylehickinson modified the milestones: 1.26, 1.25.1 May 21, 2021
@Brandon-T
Copy link
Collaborator Author

Brandon-T commented May 22, 2021

For testing:

  • Go to YouTube or any media site
  • Make sure network link conditioner is set to very very bad network
  • While the site is loading, keep trying to scroll the page.
  • if the page doesn't scroll properly or exhibits freezing, we have a problem.
  • If the page does scroll and load correctly, the toast will come up properly without lagging.
  • Page overall should be much snappier.

Tested:

  • I tested on YouTube, SoundCloud, Vimeo, dailymotion, twitch. Note for SoundCloud you have to press play first then attempt to scroll while it is loading.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add to playlist option freezes on 3aw.com
4 participants