From 9aeb77bcd9b4c06b62d3ea6454bdc35fa17c4725 Mon Sep 17 00:00:00 2001 From: Brandon Casey <2381475+brandonocasey@users.noreply.github.com> Date: Tue, 31 Aug 2021 12:09:14 -0400 Subject: [PATCH] fix: only register reloadSourceOnError once (#1191) --- src/videojs-http-streaming.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/videojs-http-streaming.js b/src/videojs-http-streaming.js index 15d1eb42b..d5e78284d 100644 --- a/src/videojs-http-streaming.js +++ b/src/videojs-http-streaming.js @@ -1264,10 +1264,10 @@ if (!videojs.use) { videojs.options.vhs = videojs.options.vhs || {}; videojs.options.hls = videojs.options.hls || {}; -if (videojs.registerPlugin) { - videojs.registerPlugin('reloadSourceOnError', reloadSourceOnError); -} else { - videojs.plugin('reloadSourceOnError', reloadSourceOnError); +if (!videojs.getPlugin || !videojs.getPlugin('reloadSourceOnError')) { + const registerPlugin = videojs.registerPlugin || videojs.plugin; + + registerPlugin('reloadSourceOnError', reloadSourceOnError); } export {