From 33deadcbe04c82f3ba533eedb17e92e0421bff57 Mon Sep 17 00:00:00 2001 From: Brandon Casey Date: Thu, 3 Aug 2017 15:29:44 -0400 Subject: [PATCH] fix: prevent initialization from happening twice (#9) --- src/plugin.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/plugin.js b/src/plugin.js index b00de17e..4c165980 100644 --- a/src/plugin.js +++ b/src/plugin.js @@ -46,6 +46,13 @@ const errors = { */ const vr = function(options) { const player = this; + + // don't initialize twice + if (this.usingPlugin('vr')) { + videojs.log.warn('videojs-vr is already intialized, not going to initialize again'); + return; + } + const settings = videojs.mergeOptions(defaults, options || {}); const videoEl = this.el().getElementsByTagName('video')[0]; const container = this.el();