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

(fix): clear video src to prevent old video from continue loading #1360

Merged
merged 1 commit into from
Jul 15, 2022

Conversation

ptgamr
Copy link
Contributor

@ptgamr ptgamr commented Nov 26, 2021

@ptgamr ptgamr changed the title (fix): clear video src to prevent old video from continue to load (fix): clear video src to prevent old video from continue loading Nov 26, 2021
@novyQ
Copy link

novyQ commented Dec 3, 2021

Thanks for fixing it. we had the same issue that the player keeps loading old url.

@ptgamr
Copy link
Contributor Author

ptgamr commented Dec 3, 2021

@novyQ cheers, now just waiting for someone to merge it, hopefully

@novyQ
Copy link

novyQ commented Dec 14, 2021

@novyQ cheers, now just waiting for someone to merge it, hopefully

noticed the CI error. is that why the PR is not being merged?

@@ -38,11 +38,13 @@ export default class FilePlayer extends Component {
this.props.url !== prevProps.url &&
!isMediaStream(this.props.url)
) {
this.player.src = ''
Copy link
Owner

Choose a reason for hiding this comment

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

I don’t think this is needed? This runs when the url has changed and the new one is not a MediaStream, we don’t necessarily want to clear the src here, especially if the new url is also a file path?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cookpete I have tested it without this line and it doesn't really fix the problem (old video still load when I change the URL)

I don't see any downside of clearing src here, as it'll be set again in the next render.

Copy link
Owner

Choose a reason for hiding this comment

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

I don't see any downside of clearing src here, as it'll be set again in the next render.

Will it? This is in componentDidUpdate which fires after everything has finished rendering. When does the "next render" happen?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cookpete Oh you're right. Sorry, I was blind and somehow thought it is componentWillUpdate... Now, I don't even know why it's still working when I have this.

I undo this change, and looks like reseting the src inside componentWillUnmount is enough in my case (as I actually unmount the videoPlayer)

Thanks for looking into this!

@cookpete cookpete merged commit c79565c into cookpete:master Jul 15, 2022
@cookpete
Copy link
Owner

Published in 2.11.0. Sorry for the delay.

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.

Changing url, previous video continue loading
3 participants