From adc0ea27a9d6270c28ac5d3e73de7703399fe9d7 Mon Sep 17 00:00:00 2001 From: Honore Doktorr Date: Sat, 11 May 2024 14:42:08 -0400 Subject: [PATCH] Add player integration code removed from the dailymotion js sdk Restores https://github.com/dailymotion/dailymotion-sdk-js commit 75b4102 --- player/dailymotion.coffee | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/player/dailymotion.coffee b/player/dailymotion.coffee index 8415ce02..bf33603d 100644 --- a/player/dailymotion.coffee +++ b/player/dailymotion.coffee @@ -18,7 +18,12 @@ window.DailymotionPlayer = class DailymotionPlayer extends Player if quality != 'auto' params.quality = quality - @dm = DM.player('ytapiplayer', + @element = DM.$('ytapiplayer') + if not @element or @element.nodeType != Node.ELEMENT_NODE + throw new Error("Invalid player element in DailymotionPlayer(), requires an existing HTML element: " + @element) + if DM.Player._INSTANCES[@element.id] != undefined + @element = DM.Player.destroy(@element.id) + @dm = DM.Player.create(@element, video: data.id width: parseInt(VWIDTH, 10) height: parseInt(VHEIGHT, 10)