diff options
| author | RblSb <msrblsb@gmail.com> | 2020-02-28 19:55:32 +0300 |
|---|---|---|
| committer | RblSb <msrblsb@gmail.com> | 2020-02-28 19:55:32 +0300 |
| commit | ec7e4b5ad120828f1464cf4186287d4928b462a8 (patch) | |
| tree | 6ea0accbe62983f3f174df9bf9ebc89bec17977a /src/client/Main.hx | |
| parent | c5903d5670dad72c840c30a302f8238c8cff9f8a (diff) | |
Youtube player support
Diffstat (limited to 'src/client/Main.hx')
| -rw-r--r-- | src/client/Main.hx | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/src/client/Main.hx b/src/client/Main.hx index 1804ca1..d3271e9 100644 --- a/src/client/Main.hx +++ b/src/client/Main.hx @@ -161,7 +161,7 @@ class Main { if (matchName.match(name)) name = matchName.matched(1); else name = Lang.get("rawVideo"); - getRemoteVideoDuration(url, (duration:Float) -> { + player.getRemoteDuration(url, (duration:Float) -> { if (duration == 0) { serverMessage(4, Lang.get("addVideoError")); return; @@ -205,22 +205,6 @@ class Main { return url.replace(globalIp, host); } - function getRemoteVideoDuration(src:String, callback:(duration:Float)->Void):Void { - final player:Element = ge("#ytapiplayer"); - final video = document.createVideoElement(); - video.src = src; - // TODO catch errors on AddVideo and getRemoteVideoDuration - video.onerror = e -> { - if (player.contains(video)) player.removeChild(video); - callback(0); - } - video.onloadedmetadata = () -> { - if (player.contains(video)) player.removeChild(video); - callback(video.duration); - } - Utils.prepend(player, video); - } - function onMessage(e):Void { final data:WsEvent = Json.parse(e.data); final t:String = cast data.type; |
