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

All other loaded videos pause when one video is playing #1896

Merged

Conversation

walid-i
Copy link
Contributor

@walid-i walid-i commented Aug 16, 2021

No description provided.

Copy link
Contributor

@jpeterson976 jpeterson976 left a comment

Choose a reason for hiding this comment

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

This works really well in most cases, though if you put multiple of the same video on a page then it'll occasionally not pause other videos if their URL happens to match due to them being at the same timestamp in the video. Comparing the video ids instead of their URLs seems to get around this, since each one is given a unique id even if they have the same URL.

@zachberry zachberry changed the base branch from master to dev/25-bixbite August 18, 2021 23:50
Copy link
Member

@zachberry zachberry left a comment

Choose a reason for hiding this comment

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

Forgive me @walid-i but I added a few last minute tweaks to get this into dev/25. Based on what @jpeterson976 found I changed the code that attempts to pause video from using the video URL that I had originally suggested to the id property that exists on the youtube player object. From what I found that just simply increments each time a video is added to the page and should always be unique.

I also noticed that the loadedVideos array was growing as you changed pages and never got rid of the player objects, so I added some code to remove them from loadedVideos on unmount. To make that slightly easier I changed loadedVideos from an array to an object.

@zachberry zachberry merged commit ba03b0a into ucfopen:dev/25-bixbite Aug 19, 2021
@zachberry zachberry added this to the 25 - Bixbite milestone Aug 19, 2021
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

Successfully merging this pull request may close these issues.

3 participants