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

Destroy previous vidyard player before creating new one #894

Merged

Conversation

schipiga
Copy link
Contributor

@schipiga schipiga commented May 21, 2020

I had met a bug, that react-player calls several time Vidyard.api.renderPlayer if i switch video, which leads several vidyard players presence in same page.
Fix is to destroy previous player before creating new one.

@schipiga
Copy link
Contributor Author

schipiga commented May 22, 2020

@cookpete could you pls review this pr, it's quite important in my work

@schipiga schipiga force-pushed the hotfix/destroy-previous-vidyard-player branch 2 times, most recently from 3824f02 to 0973658 Compare May 22, 2020 13:40
@schipiga schipiga force-pushed the hotfix/destroy-previous-vidyard-player branch from 0973658 to 5d22a19 Compare May 22, 2020 13:55
@@ -50,6 +53,7 @@ export default class Vidyard extends Component {

stop () {
window.VidyardV4.api.destroyPlayer(this.player)
delete this.player
Copy link
Owner

Choose a reason for hiding this comment

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

Is this really necessary?

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 think it's logical. If you destroy object and this.player doesn't exist, you don't need to keep reference to non-existing object.

Copy link
Owner

Choose a reason for hiding this comment

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

I’ve merged this but left this line out for the time being. I’m not a fan of the delete statement and would rather be consistent with the rest of the codebase (which avoids calling delete anywhere)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok clear :) any case, I checked new release with fix and works well

@cookpete cookpete merged commit f89f340 into cookpete:master May 23, 2020
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.

2 participants