diff options
| author | RblSb <msrblsb@gmail.com> | 2020-03-04 00:06:52 +0300 |
|---|---|---|
| committer | RblSb <msrblsb@gmail.com> | 2020-03-04 00:10:09 +0300 |
| commit | f369250f8a20f926855e9d0d3d054632e322b987 (patch) | |
| tree | 34790e7d1a73aa230f68cb75fcf3a2c44866675e /src/client/players | |
| parent | 3c5e157371e623630c648a274386c11b7cae3586 (diff) | |
Iframe items
Diffstat (limited to 'src/client/players')
| -rw-r--r-- | src/client/players/Iframe.hx | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/client/players/Iframe.hx b/src/client/players/Iframe.hx new file mode 100644 index 0000000..37d2fe6 --- /dev/null +++ b/src/client/players/Iframe.hx @@ -0,0 +1,59 @@ +package client.players; + +import haxe.Timer; +import js.html.Element; +import js.html.VideoElement; +import js.Browser.document; +import client.Main.ge; +import Types.VideoData; +import Types.VideoItem; + +class Iframe implements IPlayer { + + final main:Main; + final player:Player; + final playerEl:Element = ge("#ytapiplayer"); + var video:Element; + + public function new(main:Main, player:Player) { + this.main = main; + this.player = player; + } + + public function getVideoData(url:String, callback:(data:VideoData)->Void):Void { + callback({ + duration: 99 * 60 * 60, + title: "Custom Media" + }); + } + + public function loadVideo(item:VideoItem):Void { + video = document.createDivElement(); + video.id = "videoplayer"; + video.innerHTML = item.url; + if (video.firstChild.nodeName != "IFRAME" + && video.firstChild.nodeName != "OBJECT") { + // TODO move to getVideoData too + video = null; + return; + } + playerEl.appendChild(video); + } + + public function removeVideo():Void { + if (video == null) return; + playerEl.removeChild(video); + video = null; + } + + public function play():Void {} + + public function pause():Void {} + + public function getTime():Float { + return 0; + } + + public function setTime(time:Float):Void {} + +} |
