diff options
| author | RblSb <msrblsb@gmail.com> | 2021-08-01 14:33:27 +0300 |
|---|---|---|
| committer | RblSb <msrblsb@gmail.com> | 2021-08-01 14:33:27 +0300 |
| commit | b8827aa6df5c58fb5655c8519477ea93694617f3 (patch) | |
| tree | cf67b50990a2864dd8ffe9b094b24241aae48ef3 /src/client/Buttons.hx | |
| parent | 530bee28a0baa653e2be73cba525bd38d5e04b5e (diff) | |
Way to change video src on client
see #27
Diffstat (limited to 'src/client/Buttons.hx')
| -rw-r--r-- | src/client/Buttons.hx | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/client/Buttons.hx b/src/client/Buttons.hx index 7df6486..86a7d82 100644 --- a/src/client/Buttons.hx +++ b/src/client/Buttons.hx @@ -255,9 +255,27 @@ class Buttons { final removeBtn = ge("#removeVideoBtn"); removeBtn.onclick = e -> { - final has = main.toggleVideoElement(); - if (has || main.isListEmpty()) removeBtn.innerText = Lang.get("removeVideo"); - else removeBtn.innerText = Lang.get("addVideo"); + final hasVideo = main.toggleVideoElement(); + if (hasVideo || main.isListEmpty()) { + removeBtn.innerText = Lang.get("removeVideo"); + } else { + removeBtn.innerText = Lang.get("addVideo"); + } + } + final setVideoUrlBtn = ge("#setVideoUrlBtn"); + setVideoUrlBtn.onclick = e -> { + final src = window.prompt(Lang.get("setVideoUrlPrompt")); + if (src.trim() == "") { // reset to default url + main.refreshPlayer(); + return; + } + JsApi.setVideoSrc(src); + } + final selectLocalVideoBtn = ge("#selectLocalVideoBtn"); + selectLocalVideoBtn.onclick = e -> { + Utils.browseFileUrl((url:String, name:String) -> { + JsApi.setVideoSrc(url); + }); } } |
