ソースを参照

Send volume after media load; add icon

Add repeat.svg asset and adjust cast volume timing. Move media.volume messages to after media.load (in connectCast and startPlayback) so the cast target receives the correct volume during media initialization and avoids being overridden by defaults. Remove earlier pre-load volume send and add explanatory comments.
Toby Chui 1 週間 前
コミット
747f31c5d2
2 ファイル変更7 行追加3 行削除
  1. 1 0
      src/web/Arozcast/img/repeat.svg
  2. 6 3
      src/web/Movie/index.html

+ 1 - 0
src/web/Arozcast/img/repeat.svg

@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#F3F3F3"><path d="M460-360v-180h-60v-60h120v240h-60ZM280-80 120-240l160-160 56 58-62 62h406v-160h80v240H274l62 62-56 58Zm-80-440v-240h486l-62-62 56-58 160 160-160 160-56-58 62-62H280v160h-80Z"/></svg>

+ 6 - 3
src/web/Movie/index.html

@@ -1382,8 +1382,6 @@ function connectCast() {
                 castWs.send(JSON.stringify({ topic: 'peer.hello', payload: {} }));
 
                 var vid = document.getElementById('main-video');
-                // Volume first so Arozcast has it before media loads
-                _castSend('media.volume', { volume: vid.volume * 100, muted: vid.muted });
 
                 // Load current episode on Arozcast; stop local playback
                 if (playingIndex >= 0 && currentEpisodes[playingIndex]) {
@@ -1396,6 +1394,9 @@ function connectCast() {
                         filepath: ep.filepath, name: ep.name, type: 'video',
                         src: src, startTime: vid.currentTime || 0
                     });
+                    // Volume after load, before play — ensures it overrides any default
+                    // the Arozcast side might apply during media initialisation.
+                    _castSend('media.volume', { volume: vid.volume * 100, muted: vid.muted });
                     _castSend(vid.paused ? 'media.pause' : 'media.play', {});
                     // Stop local video to avoid dual transcoding
                     vid.pause();
@@ -2431,11 +2432,13 @@ function startPlayback(index) {
     if (castMode && _castConnected()) {
         // Don't load locally — avoids transcoding the same file twice
         vid.pause();
-        _castSend('media.volume', { volume: vid.volume * 100, muted: vid.muted });
         _castSend('media.load', {
             filepath: ep.filepath, name: ep.name, type: 'video',
             src: src, startTime: 0
         });
+        // Volume after load, before play — guarantees device volume overrides
+        // whatever Arozcast was previously playing at.
+        _castSend('media.volume', { volume: vid.volume * 100, muted: vid.muted });
         _castSend('media.play', {});
     } else {
         vid.src = src;