2

I have this embed code to create a simple player :

var player = DM.player(document.getElementById("player"), {
video: "xp3omu",
  width: "480px",
  height: "360px",
  params: {
    start: 150,
    sharing-enable: false,
    queue-enable: false,
  }
});

Everytime I try to use parameters with dash as sharing-enable, queue-enable, ui-highlight etc I find that the player fail to load. The doc is here : https://developer.dailymotion.com/player#embedding

However when using the iframe tag, there is no problem :

<iframe frameborder="0" width="480" height="360"
src="//www.dailymotion.com/embed/video/xp3omu?start=150&sharing-enable=false&queue-enable=false" allowfullscreen allow="autoplay"></iframe>

What am I missing? Can anyone tell me if he has the same issues?

pedro
  • 23
  • 3

1 Answers1

3

You should escape those dashed words (wrap them in quotation marks):

params: {
  start: 150,
  'sharing-enable': false,
  'queue-enable': false,
}

... as only valid identifiers can be used directly (without wrapping them) as object literal keys, and - character cannot be a part of valid identifier in JS. By the way, console should probably show the helpful message here.

raina77ow
  • 103,633
  • 15
  • 192
  • 229