Skip to content

Destroy previous vidyard player before creating new one#894

Merged
cookpete merged 2 commits intocookpete:masterfrom
schipiga:hotfix/destroy-previous-vidyard-player
May 23, 2020
Merged

Destroy previous vidyard player before creating new one#894
cookpete merged 2 commits intocookpete:masterfrom
schipiga:hotfix/destroy-previous-vidyard-player

Conversation

@schipiga
Copy link
Copy Markdown
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
Copy Markdown
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
Comment thread src/players/Vidyard.js Outdated

stop () {
window.VidyardV4.api.destroyPlayer(this.player)
delete this.player
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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