diff options
| author | RblSb <msrblsb@gmail.com> | 2025-02-06 06:41:49 +0300 |
|---|---|---|
| committer | RblSb <msrblsb@gmail.com> | 2025-02-07 01:12:14 +0300 |
| commit | d86f0c30e1726a56e670955c3b995945c1daf834 (patch) | |
| tree | 2cff6b1c76191df76291f93c5a46810f09181727 /src/client/Main.hx | |
| parent | 382f9b2ebedca905028341825350a0fa69d88673 (diff) | |
Fixes pack
- Fix timer seek on server pause with double timer.pause() calls
- Implement multi-caching
- Better uploading progress with XMLHttpRequest
- Better upload/cache error reporting
Diffstat (limited to 'src/client/Main.hx')
| -rw-r--r-- | src/client/Main.hx | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/src/client/Main.hx b/src/client/Main.hx index 84f6838..5c4b28d 100644 --- a/src/client/Main.hx +++ b/src/client/Main.hx @@ -120,7 +120,7 @@ class Main { if (!player.isVideoLoaded()) return; gotFirstPageInteraction = true; player.unmute(); - if (!hasLeader() && !showingServerPause) player.play(); + if (!hasLeader() && !showingServerPause && !player.inUserInteraction) player.play(); document.removeEventListener("click", onFirstInteraction); } @@ -508,24 +508,7 @@ class Main { serverMessage(text); case Progress: - final data = data.progress; - final text = switch data.type { - case Caching: - final caching = Lang.get("caching"); - final name = data.data; - '$caching $name'; - case Downloading: Lang.get("downloading"); - case Uploading: Lang.get("uploading"); - } - final percent = (data.ratio * 100).toFixed(1); - var text = '$text...'; - if (percent > 0) text += ' $percent%'; - showProgressInfo(text); - if (data.ratio == 1) { - Timer.delay(() -> { - hideDynamicChin(); - }, 500); - } + onProgressEvent(data); case AddVideo: player.addVideoItem(data.addVideo.item, data.addVideo.atEnd); @@ -675,6 +658,27 @@ class Main { } } + public function onProgressEvent(data:WsEvent):Void { + final data = data.progress; + final text = switch data.type { + case Caching: + final caching = Lang.get("caching"); + final name = data.data; + '$caching $name'; + case Downloading: Lang.get("downloading"); + case Uploading: Lang.get("uploading"); + } + final percent = (data.ratio * 100).toFixed(1); + var text = '$text...'; + if (percent > 0) text += ' $percent%'; + showProgressInfo(text); + if (data.ratio == 1) { + Timer.delay(() -> { + hideDynamicChin(); + }, 500); + } + } + function updateLastStateTime():Void { if (lastStateTimeStamp == 0) { lastStateTimeStamp = Timer.stamp(); |
