From c5cb1028aee54ba89f7b79f2046b26747c02ab25 Mon Sep 17 00:00:00 2001 From: matjaz321 Date: Thu, 13 Aug 2020 22:35:04 +0200 Subject: [PATCH] Added onError eventListener to the youtube iframe video player to destroy itself whenever it receives any errors --- src/plugins/youtubePlayer/plugin.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/youtubePlayer/plugin.js b/src/plugins/youtubePlayer/plugin.js index eed75a8116..c83fac1b82 100644 --- a/src/plugins/youtubePlayer/plugin.js +++ b/src/plugins/youtubePlayer/plugin.js @@ -142,7 +142,11 @@ function setCurrentSrc(instance, elem, options) { } else if (event.data === YT.PlayerState.PAUSED) { events.trigger(instance, 'pause'); } - } + }, + 'onError': () => { + instance.destroy(); + loading.hide(); + }, }, playerVars: { controls: 0,