You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not sure if this issue really belongs here or in the react-youtube-player repo, but unmounting a parent component of the React Youtube Player component throws an error at current (however the error appears to be in youtube-player to me, and the best way I can see to fix it is also in here, which is why I figured I would raise the issue here).
So the issue appears to be that when the parent component is unmounted, react-youtube-player's calls stopVideo, and youtube-player in turn passes this call on (once the player promise resolves) to youtubes iFrame API. However, by the time the promise resolves and the method is called, the player iFrame no longer exists and we get: "Uncaught (in promise) Error: The YouTube player is not attached to the DOM."
I believe the best fix for this would be (in YoutubePlayer.js:120):
functions[functionName] = (...args) => {
return playerAPIReady
.then((player) => {
// Only act if the iFrame is still contained in the DOM
if (document.comparePosition(player.a) & 16) {
// eslint-disable-next-line no-warning-comments
// TODO: Just spread the args into the function once Babel is fixed:
// https://github.com/babel/babel/issues/4270
//
// eslint-disable-next-line prefer-spread
return player[functionName].apply(player, args);
}
});
};
thoughts?
The text was updated successfully, but these errors were encountered:
Hello,
Not sure if this issue really belongs here or in the react-youtube-player repo, but unmounting a parent component of the React Youtube Player component throws an error at current (however the error appears to be in youtube-player to me, and the best way I can see to fix it is also in here, which is why I figured I would raise the issue here).
So the issue appears to be that when the parent component is unmounted, react-youtube-player's calls stopVideo, and youtube-player in turn passes this call on (once the player promise resolves) to youtubes iFrame API. However, by the time the promise resolves and the method is called, the player iFrame no longer exists and we get: "Uncaught (in promise) Error: The YouTube player is not attached to the DOM."
I believe the best fix for this would be (in YoutubePlayer.js:120):
thoughts?
The text was updated successfully, but these errors were encountered: