blob: f0a04c51677bbce95e1e7112b4925a9201639aa1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
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;
}
if (video.firstChild.nodeName == "IFRAME") {
video.setAttribute("sandbox", "allow-scripts");
}
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 {}
}
|