Skip to content

Commit

Permalink
Better error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
screeley committed Oct 24, 2017
1 parent ec20430 commit 7ba2021
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ playerjs.Player.prototype.init = function(elem, options){

this.elem = elem;

// make sure we have an iframe
playerjs.assert(elem.nodeName === 'IFRAME',
'playerjs.Player constructor requires an Iframe, got "'+elem.nodeName+'"');
playerjs.assert(elem.src,
'playerjs.Player constructor requires a Iframe with a \'src\' attribute.');

// Figure out the origin of where we are sending messages.
this.origin = playerjs.origin(elem.src);

Expand Down
2 changes: 1 addition & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,4 +298,4 @@ for (var f in FRAMES){
} else {
iframe.onload = loadPlayers;
}
}
}

0 comments on commit 7ba2021

Please sign in to comment.