Skip to content

Commit

Permalink
Merge pull request #37 from dailymotion/fix-early-calls
Browse files Browse the repository at this point in the history
[PLAYER] Provide meaningfull warn message for early player API calls
  • Loading branch information
briganti committed Sep 2, 2016
2 parents 60ba9ef + 80725c2 commit a291d89
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/core/player.js
Expand Up @@ -203,6 +203,14 @@ DM.provide('Player',

_send: function(command, parameters)
{
if (!this.apiReady) {
try {
if (console && typeof console.warn === 'function') {
console.warn('Player not ready. Ignoring command : "'+command+'"');
}
} catch (e) {}
return;
}
if (DM.Player.API_MODE == 'postMessage')
{
this.contentWindow.postMessage(JSON.stringify({
Expand Down

0 comments on commit a291d89

Please sign in to comment.