aboutsummaryrefslogtreecommitdiff
path: root/web/script/player/mod.ts
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-01-29 08:39:38 +0100
committermetamuffin <metamuffin@disroot.org>2024-01-29 08:39:38 +0100
commitdef9b13d911fa28f7b1fb8bb3766e2873cc6d628 (patch)
tree2f4df844bfe34841c10dd9533dd2496083011395 /web/script/player/mod.ts
parent88fa84cd5a2e17d758a65dc2773fa0a80f096815 (diff)
downloadjellything-def9b13d911fa28f7b1fb8bb3766e2873cc6d628.tar
jellything-def9b13d911fa28f7b1fb8bb3766e2873cc6d628.tar.bz2
jellything-def9b13d911fa28f7b1fb8bb3766e2873cc6d628.tar.zst
make track creation instant
Diffstat (limited to 'web/script/player/mod.ts')
-rw-r--r--web/script/player/mod.ts43
1 files changed, 3 insertions, 40 deletions
diff --git a/web/script/player/mod.ts b/web/script/player/mod.ts
index a53789f..0f30d45 100644
--- a/web/script/player/mod.ts
+++ b/web/script/player/mod.ts
@@ -11,7 +11,7 @@ import { EncodingProfile } from "./jhls.d.ts";
import { TrackKind, get_track_kind } from "./mediacaps.ts";
import { Player } from "./player.ts";
import { Popup } from "./popup.ts";
-import { Playersync } from "./sync.ts"
+import { Playersync, playersync_controls } from "./sync.ts"
import { MSEPlayerTrack } from "./track/mse.ts";
globalThis.addEventListener("DOMContentLoaded", () => {
@@ -110,49 +110,12 @@ function initialize_player(el: HTMLElement, node_id: string) {
)
return button
}
+
const settings_popup = () => {
const button = e("button", "settings", { class: "icon" })
- let channel_name: HTMLInputElement;
- let channel_name_copy: HTMLInputElement;
new Popup(button, popups, () => e("div", { class: "jsp-settings-popup" },
e("h2", "Settings"),
- e("div", { class: ["jsp-controlgroup", "jsp-playersync-controls"] },
- e("h3", "Playersync"),
- sync_state.map(sync => {
- console.log("aaaaa", sync);
- return sync
- ? e("div",
- e("span", "Sync enabled."),
- e("button", "Disable", {
- onclick: () => { sync_state.value?.destroy(); sync_state.value = undefined }
- }),
- e("p", "Session ID: ",
- channel_name_copy = e("input", { type: "text", disabled: true, value: sync.name }),
- e("button", "content_paste_go", {
- class: "icon",
- onclick: () => {
- logger.log("Session ID copied to clipboard.")
- navigator.clipboard.writeText(channel_name_copy.value)
- }
- })
- ))
- : e("div",
- channel_name = e("input", { type: "text", placeholder: "someroom:example.org" }),
- e("button", "Join", {
- onclick: () => {
- if (!channel_name.value.length) return
- sync_state.value?.destroy()
- sync_state.value = new Playersync(player, logger, channel_name.value)
- }
- }), e("br"),
- e("button", "Create new session", {
- onclick: () => {
- sync_state.value?.destroy()
- sync_state.value = new Playersync(player, logger)
- }
- }))
- })
- )
+ playersync_controls(sync_state, player)
))
return button;
}