Skip to content

Commit

Permalink
fix: prevent initialization from happening twice (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonocasey authored Aug 3, 2017
1 parent d5ef81e commit 33deadc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 33deadc

Please sign in to comment.