Fix host stream freeze when a guest joins an in-progress party
A joining member's player always called loadVideo(itemId, 0, false), hardcoding a resume position of 0. Since a party's Emby stream is one shared transcode session (PartyStreamService, keyed by partyId alone), a newcomer's hls.js requesting segments from position 0 against a session that already progressed well past that forces Emby to seek/restart the shared transcode - stalling playback for every member, host included, right as the newcomer joins. Seed the initial resume position from the host's last-reported position (already available in party.members) instead, so the first segment request lands near where the shared session already is. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
076cd7a624
commit
7fbf22419d
1 changed files with 14 additions and 1 deletions
|
|
@ -1260,7 +1260,20 @@ function renderVideoPlayer(root: HTMLElement, partyId: string, party: PartyPubli
|
||||||
|
|
||||||
loadMarkers(party.itemId); // not awaited - see onItemChanged's own comment
|
loadMarkers(party.itemId); // not awaited - see onItemChanged's own comment
|
||||||
await loadTrackOptions(party.itemId);
|
await loadTrackOptions(party.itemId);
|
||||||
loadVideo(party.itemId, 0, false);
|
// Unlike onItemChanged's own loadVideo(..., 0, ...) - genuinely correct
|
||||||
|
// there since a fresh item has no position yet - mounting mid-party
|
||||||
|
// (a joining guest, or the host's own page reload) must NOT hardcode 0:
|
||||||
|
// the party's shared Emby transcode (PartyStreamService) is keyed by
|
||||||
|
// partyId alone, one PlaySessionId for every member, so a hls.js
|
||||||
|
// instance requesting segments from 0 against a session that already
|
||||||
|
// progressed well past that forces Emby to seek/restart the shared
|
||||||
|
// transcode - stalling it for every other member, host included, right
|
||||||
|
// as the newcomer joins. Seeding from the host's last-reported position
|
||||||
|
// (already in party.members, sent to every mount) lands the first
|
||||||
|
// segment request near where the shared session already is instead.
|
||||||
|
const hostMember = party.members.find((m) => m.isHost);
|
||||||
|
const initialResumeSeconds = hostMember ? hostMember.positionTicks / TICKS_PER_SECOND : 0;
|
||||||
|
loadVideo(party.itemId, initialResumeSeconds, false);
|
||||||
|
|
||||||
conn = connectParty(partyId, {
|
conn = connectParty(partyId, {
|
||||||
onMembers: renderMembers,
|
onMembers: renderMembers,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue