Add cowatch-spoiler-gate example (Mux Player + Mux Data)#225
Open
kushankurdas wants to merge 1 commit into
Open
Add cowatch-spoiler-gate example (Mux Player + Mux Data)#225kushankurdas wants to merge 1 commit into
kushankurdas wants to merge 1 commit into
Conversation
Author
|
@philcluff @dylanjha - is this repo still active ? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds
cowatch-spoiler-gate, a small reference application thatsolves the spoiler-leak problem in co-watching: fast viewers reacting in
chat before slow viewers see the same moment. It uses Mux Player and
the Mux Data API (both server-side reads and client-side beacons) to
implement two pieces:
and the server broadcasts the slowest viewer's latency as the room's
sync target.
sender's current
player.currentPdt, and the server holds themessage until every recipient's perceived PDT has passed that stamp.
What this exercises in Mux
@mux/mux-player)public/room.htmlplayer.currentPdt,streamType, Data beacons viaenv-key@mux/mux-node)server.js→/api/metricsdata.realTime.retrieveTimeseries('current-concurrent-viewers'),data.metrics.getOverallValues('rebuffer_percentage'),data.metrics.getOverallValues('video_startup_time'), all filtered byvideo_id:<room>Both surfaces are available on Mux's free plan.
Contributor program self-check
Submitting under the Mux contributor program.
client-side beacons through Mux Player.
requirement (watch parties, live sports rooms, group viewing) and
the spoiler-leak problem is real.
muxinc/examplesforco-watch,watch party,spoiler,sync floor,currentPdt,program-date-time,chat,socket, andwebsocket; noexisting example overlaps.
Test plan
A headless smoke test verifies the WebSocket protocol end-to-end and
needs no Mux account:
The 12 checks cover: HTTP
/,/config.json, sync floor maths, targetoffset, roster, chat held when slow viewer is behind, chat released
after slow viewer catches up, immediate release when no one is behind,
sync floor moves with latency changes, and roster shrinks on disconnect.
For the Mux Data path, copy
.env.exampleto.env, fill inMUX_TOKEN_ID/MUX_TOKEN_SECRET(Data read scope) andMUX_DATA_ENV_KEY, then open two browser tabs againsthttp://localhost:3000. The room view's "Mux Data" panel polls/api/metrics?room=<room>every 10 seconds and shows real-timeconcurrent viewers, rebuffer percentage and video startup time for the
last hour.
Known limitations (documented in the README)
algorithm can be exercised with a single asset.
if a viewer's tab is backgrounded.
Happy to make any changes you'd like.