diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-10-03 13:59:44 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-10-03 14:24:55 +0200 |
| commit | d4cd99df1fdecb28d60c10c87f72a93634128db8 (patch) | |
| tree | d0426aea997f804d4b62d1fc329cdea9c2599804 /packages/meshbay-hub/tests | |
| parent | ab0ba3db76d1accec1ca944e62b325c8d92592a6 (diff) | |
| download | meshbay-d4cd99df1fdecb28d60c10c87f72a93634128db8.tar.gz | |
Player: remote control while casting
Shows the receiver's position with play/pause, ±30 s and a scrubber;
a seek restarts the relay where asked.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-hub/tests')
| -rw-r--r-- | packages/meshbay-hub/tests/test_cast_discovery.py | 30 | ||||
| -rw-r--r-- | packages/meshbay-hub/tests/test_video_audio_track.py | 4 |
2 files changed, 32 insertions, 2 deletions
diff --git a/packages/meshbay-hub/tests/test_cast_discovery.py b/packages/meshbay-hub/tests/test_cast_discovery.py index 77b0ef6..8bbe3c7 100644 --- a/packages/meshbay-hub/tests/test_cast_discovery.py +++ b/packages/meshbay-hub/tests/test_cast_discovery.py @@ -121,3 +121,33 @@ def test_the_local_player_is_silent_while_casting(): assert "mutedBeforeCastRef.current = v.muted;" in effect assert "v.muted = mutedBeforeCastRef.current;" in effect assert "pause()" not in effect, "pausing would stop the stream the receiver is playing" + + +def test_the_player_is_a_remote_while_casting(): + """Phone and television do not play in step, so while a receiver plays the + film the scrubber shows the receiver's position (stream time plus where + the stream started) and every seek goes through the ordinary seek, which + restarts the relay and reloads the receiver there. The copy-URL cast has + no receiver to read and keeps the local player.""" + from spa_source import STATIC + player = (STATIC / "video-player.js").read_text(encoding="utf-8") + remote = player.split("// ── Remote ──", 1)[1].split("return html`", 1)[0] + assert "castDeviceName !== null && platform.cast.canControl" in remote + assert "streamStartRef.current + c.position" in remote + # Until the restart lands, the receiver's position is the old stream's. + assert "!castRestartPendingRef.current" in remote + assert "requestSeekRef.current(target)" in remote + assert "platform.cast.chromecastPause()" in remote + assert "platform.cast.chromecastPlay()" in remote + # A language change restarts the stream where the television is. + assert "remoteFilmPosRef.current ?? (v && v.currentTime)" in player + + +def test_every_locale_names_the_remote_controls(): + from spa_source import STATIC + keys = ["cast.playing_on", "cast.waiting", "cast.back30", "cast.fwd30", "cast.play", "cast.pause"] + for f in sorted((STATIC / "locales").glob("*.js")): + text = f.read_text(encoding="utf-8") + for k in keys: + assert f"'{k}':" in text, f"{f.name} lacks {k}" + assert "{device}" in (STATIC / "locales" / "ja.js").read_text(encoding="utf-8") diff --git a/packages/meshbay-hub/tests/test_video_audio_track.py b/packages/meshbay-hub/tests/test_video_audio_track.py index 82d6e18..6515798 100644 --- a/packages/meshbay-hub/tests/test_video_audio_track.py +++ b/packages/meshbay-hub/tests/test_video_audio_track.py @@ -203,8 +203,8 @@ def test_changing_track_restarts_the_stream_where_the_film_already_was(app): assert "audioTrackRef.current = track.i" in handler assert "requestSeekRef.current" in handler, \ "a track change must go through the seek path" - assert "seek(v.currentTime)" in handler, \ - "a track change must resume where the film already was" + assert "remoteFilmPosRef.current ?? (v && v.currentTime)" in handler, \ + "a track change must resume where the film already was (on the television, when casting)" def test_the_player_believes_the_node_about_which_track_is_playing(app): |