I'm playing 3 videos from Dailymotion by JavaScript SDK. This is my code:
var tag = document.createElement('script');
tag.src = "https://api.dmcdn.net/all.js";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
window.dmAsyncInit = function () {
var player = DM.player("divplayer",
{ video: VideoId, width: "100%", height: "100%", params: { "endscreen-enable": 0,"ui-logo":0 } });
};
}
The first video is played with no problem but after that I get this Error:
Uncaught Error: Invalid first argument sent to DM.player(), this element is already a player: divplayer
divplayer is a div element.
I tried to empty the div content before calling my function but that did not work.
Thanks in advance