diff options
| author | RblSb <msrblsb@gmail.com> | 2020-05-01 10:11:40 +0300 |
|---|---|---|
| committer | RblSb <msrblsb@gmail.com> | 2020-05-01 10:11:40 +0300 |
| commit | 104d4edeb5c0874412b0e91d0cb3c768995a0ce1 (patch) | |
| tree | 36c7b72976305a682a8f4e8b96d58a64b130e54f /src/client/Main.hx | |
| parent | 7408555ad16b5d0e380d1d90eb62e64eb14987f1 (diff) | |
Support youtube streams
Diffstat (limited to 'src/client/Main.hx')
| -rw-r--r-- | src/client/Main.hx | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/src/client/Main.hx b/src/client/Main.hx index 3400595..900f841 100644 --- a/src/client/Main.hx +++ b/src/client/Main.hx @@ -250,7 +250,7 @@ class Main { author: personal.name, duration: data.duration, isTemp: isTemp, - isIframe: false + isIframe: data.isIframe == true }, atEnd: atEnd }}); @@ -263,23 +263,31 @@ class Main { final iframe = iframeCode.value; if (iframe.length == 0) return; iframeCode.value = ""; - final mediaName:InputElement = cast ge("#customembed-title"); - final name = mediaName.value.length == 0 ? "Custom Media" : mediaName.value; - mediaName.value = ""; + final mediaTitle:InputElement = cast ge("#customembed-title"); + final title = mediaTitle.value; + mediaTitle.value = ""; final checkbox:InputElement = cast ge("#customembed").querySelector(".add-temp"); final isTemp = checkbox.checked; - send({ - type: AddVideo, addVideo: { - item: { - url: iframe, - title: name, - author: personal.name, - duration: 99 * 60 * 60, - isTemp: isTemp, - isIframe: true - }, - atEnd: atEnd - }}); + player.getIframeData(iframe, (data:VideoData) -> { + if (data.duration == 0) { + serverMessage(4, Lang.get("addVideoError")); + return; + } + if (title.length > 0) data.title = title; + if (data.url == null) data.url = iframe; + send({ + type: AddVideo, addVideo: { + item: { + url: data.url, + title: data.title, + author: personal.name, + duration: data.duration, + isTemp: isTemp, + isIframe: true + }, + atEnd: atEnd + }}); + }); } public function toggleVideoElement():Bool { |
