Skip to content

Use existing player on video change #46

@Sivitas

Description

@Sivitas

You're currently destroying the player and calling createPlayer every time the video id (or url/play list) is being changed. I think YouTube just updated their API's to stop this as my site started breaking.

Not sure if there are other use cases that might break this, but my current work around is to modify your loadPlayer function to check if the player exists, and instead of creating a new one, use player.loadVideoById to update the id. There are similar calls for load by url and for playlists.

src: https://developers.google.com/youtube/iframe_api_reference#loadVideoById

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions