fix(playback): reconcile webpage sources and clarify controls
This commit is contained in:
1 parent
20bd264b95
commit
36cd8788df
12 files changed
+129
-38
No files matched your search
@@ -369,7 +369,7 @@ Renaming changes presentation without replacing media paths or input grants.
|
||||
Personal feedback sounds are off by default. **More options → Feedback sounds**
|
||||
sets the shared volume for this browser origin. Messages and throws can each be
|
||||
muted or previewed. A fresh message from another user, including an attachment-only message,
|
||||
plays a short cue while the main page is hidden, unless the recipient is reading
|
||||
plays a short cue while the main page is hidden or unfocused, unless the recipient is reading
|
||||
that room in a visible, focused popout. Foreground tomato and poop throws
|
||||
play for their sender and addressed user, whether directed at a person, message
|
||||
or shared picture. Other reactions and routine connection changes stay silent.
|
||||
|
||||
@@ -16,6 +16,30 @@ the feedback period; they do not delay that delivery.
|
||||
|
||||
### Active work
|
||||
|
||||
- [ ] **Audio device selection.** Provide explicit playback-device selection
|
||||
through supported output APIs and shared playback owners. Distinguish room
|
||||
microphones, source audio inputs and system-output capture; keep device
|
||||
changes local to the intended audio path.
|
||||
- [ ] **Message sounds in an unfocused window.** Verify beta.51 feedback where
|
||||
message cues are silent while throw sounds work, including a visible but
|
||||
unfocused main window and a focused conversation popout.
|
||||
- [ ] **Voice shortcut discovery.** Make the existing microphone and listening
|
||||
shortcuts easy to find and configure, with the same activity target for page
|
||||
and global keyboard input.
|
||||
- [ ] **Webpage source selection and watching continuity.** Reduce the steps
|
||||
to choose and replace a webpage video. Keep existing viewers' surfaces during
|
||||
replacement or temporary source absence, release old media and permissions,
|
||||
and end retained viewing on explicit exit. Define replacement ownership
|
||||
before changing the activity contract.
|
||||
- [ ] **Playback control hierarchy.** Make progress, elapsed time and volume
|
||||
immediately legible in screen and webpage playback, retaining shared controls
|
||||
and usable narrow and touch layouts.
|
||||
- [ ] **Webpage viewer readiness.** Reproduce reports of a loading viewer shown
|
||||
as already watching, including Native original-page playback. Keep membership
|
||||
distinct from proved playable media in the viewer surface and participant list.
|
||||
- [ ] **Direct webpage delivery clarity.** Verify original-site playback and
|
||||
explicit receipt from the sharer's App on the same source. Make the selected
|
||||
route and upload responsibility clear without adding a competing route setting.
|
||||
- [ ] **Virtual LAN invitations time out.** Investigate intermittent page access
|
||||
and media failures reported on Android across several browsers in 2.x.
|
||||
Correlate the selected virtual address, effective firewall rules and incoming
|
||||
|
||||
@@ -122,7 +122,6 @@ export function ChannelWatchVideo({ player, owned, paused, label, presentation,
|
||||
const livePosition = live?.active ? live.syncPosition : null;
|
||||
const thumbnail = presentation === "thumbnail";
|
||||
const showTimeline = !embedded && !thumbnail && seekAvailable;
|
||||
const seekOverlay = showTimeline ? " lr-media-overlay" : "";
|
||||
const [seekPreview, setSeekPreview] = useState<number | null>(null);
|
||||
const draggingSeek = useRef(false);
|
||||
const position = Math.max(seekStart, Math.min(seekPreview ?? media.position, seekEnd || 1));
|
||||
@@ -252,8 +251,8 @@ export function ChannelWatchVideo({ player, owned, paused, label, presentation,
|
||||
</>}
|
||||
</div></div>
|
||||
: player.blocked && <div className="c3-mini-message"><Btn icon={localSeek ? "refresh" : "play"} title={resumeLabel} cap={resumeLabel} onClick={onResume} /></div>}
|
||||
{hasControls && <div ref={controls} className={`c3-mini-controls c3-watch-controls lr-media-toolbar lr-media-controls${showTimeline ? "" : " lr-media-overlay"}`} role="group" aria-label={t("playback.controls")}>
|
||||
{showTimeline && <div className={`c3-watch-timeline${owned ? "" : " lr-media-overlay"}`}>
|
||||
{hasControls && <div ref={controls} className={`c3-mini-controls c3-watch-controls lr-media-toolbar lr-media-controls lr-media-overlay`} role="group" aria-label={t("playback.controls")}>
|
||||
{showTimeline && <div className="c3-watch-timeline">
|
||||
{owned ? <input type="range" min={seekStart} max={seekEnd} step="0.1" value={position}
|
||||
aria-label={t("watch.seek")} disabled={disabled}
|
||||
aria-valuetext={timeLabel} onPointerDown={() => { draggingSeek.current = true; }}
|
||||
@@ -267,18 +266,18 @@ export function ChannelWatchVideo({ player, owned, paused, label, presentation,
|
||||
: <progress max={seekEnd - seekStart} value={position - seekStart} aria-label={t("watch.following")} />}
|
||||
</div>}
|
||||
<div className="c3-watch-actions">
|
||||
{!embedded && <div className={`c3-watch-shared${seekOverlay}`} role="group" aria-label={t(owned ? "watch.sharedControls" : "watch.following")}>
|
||||
{!embedded && <div className="c3-watch-shared" role="group" aria-label={t(owned ? "watch.sharedControls" : "watch.following")}>
|
||||
{owned && <Btn icon={ownerPaused ? "play" : "pause"} quiet size="dense"
|
||||
title={ownerPaused ? "watch.play" : "watch.pause"} disabled={disabled} onClick={() => onPlayback({ paused: !ownerPaused })} />}
|
||||
{!thumbnail && <div className="c3-watch-position" data-seeking={seekPreview !== null || undefined}>
|
||||
{ended && <span className="c3-watch-status" role="status">{t("watch.ended")}</span>}
|
||||
{live?.active && !seekAvailable && <span className="c3-watch-status">{t("watch.live")}</span>}
|
||||
{(!live || seekAvailable) && <span className="c3-watch-time" title={timeLabel}>{timeLabel}</span>}
|
||||
{(!live || seekAvailable) && <span className="c3-watch-time" title={timeLabel}>{live ? timeLabel : <><strong>{formatMediaTime(position)}</strong>{` / ${formatMediaTime(media.duration || Number.NaN)}`}</>}</span>}
|
||||
</div>}
|
||||
{owned && livePosition !== null && <Btn icon="arrowRight" quiet size="dense" title="watch.goLive" textTooltip
|
||||
disabled={disabled} onClick={() => onPlayback({ position: livePosition, paused: false })} />}
|
||||
</div>}
|
||||
{localControls && <div className={`c3-watch-local${seekOverlay}`}>
|
||||
{localControls && <div className="c3-watch-local">
|
||||
{localVolume &&
|
||||
<Btn icon={silent ? "speakerOff" : "speaker"} quiet size="dense" title={silent ? "playback.unmute" : "playback.mute"}
|
||||
onClick={() => { const video = player.video; if (!video) return; if (video.volume === 0) video.volume = 1; video.muted = !silent; }} />}
|
||||
|
||||
@@ -18,7 +18,7 @@ import { VoiceOverlay } from "./voice-overlay";
|
||||
import { useVoiceLevels } from "../../room-voice/use-voice-levels";
|
||||
import { resolveVoiceDockControls } from "../voice-dock-controls";
|
||||
import { useVoiceShortcuts } from "../use-voice-shortcuts";
|
||||
import { voiceShortcutAria } from "../voice-shortcut-binding";
|
||||
import { voiceShortcutAria, voiceShortcutLabel } from "../voice-shortcut-binding";
|
||||
|
||||
/** One persistent control surface for this endpoint's independently joined rooms. */
|
||||
export function ChannelVoiceDock({ channel, selected, onSelect, onBrowse }: {
|
||||
@@ -41,6 +41,7 @@ export function ChannelVoiceDock({ channel, selected, onSelect, onBrowse }: {
|
||||
const roomName = nameOfRoom(roomId);
|
||||
const multipleRooms = joined.length > 1;
|
||||
const { muted, deafened } = activity;
|
||||
const { microphone, listening } = shortcuts.bindings;
|
||||
const available = channel.connection === "connected" && !!state.channel.rooms.find(room => room.id === roomId)?.available;
|
||||
const appearances = overlay?.target ? roomVoicePeople(state, roomId, levels) : null;
|
||||
const run = (operation: Promise<void>) => { void operation.catch(() => {}); };
|
||||
@@ -93,11 +94,12 @@ export function ChannelVoiceDock({ channel, selected, onSelect, onBrowse }: {
|
||||
<div className="c3-voice-controls">
|
||||
<AudioVolumeMenu volume={channel.voiceInput.volume} onVolume={channel.setInputVolume} label="host.microphone.volume">
|
||||
<VoiceMicrophoneButton active={!muted} level={levels.get(channel.sessionId ?? "")} disabled={microphoneDisabled}
|
||||
cancelPending={microphonePending} quiet keyShortcuts={voiceShortcutAria(shortcuts.bindings.microphone)} onClick={() => toggle("microphone")} />
|
||||
cancelPending={microphonePending} quiet keyShortcuts={microphoneDisabled ? undefined : voiceShortcutAria(microphone)}
|
||||
shortcutLabel={!microphoneDisabled && microphone ? voiceShortcutLabel(microphone, shortcuts.mac) : undefined} onClick={() => toggle("microphone")} />
|
||||
</AudioVolumeMenu>
|
||||
<AudioVolumeMenu volume={channel.listeningVolume} onVolume={channel.setListeningVolume} label="voice.listeningVolume">
|
||||
<VoiceListeningButton deafened={deafened} quiet
|
||||
keyShortcuts={voiceShortcutAria(shortcuts.bindings.listening)} onClick={() => toggle("listening")} />
|
||||
keyShortcuts={voiceShortcutAria(listening)} shortcutLabel={listening ? voiceShortcutLabel(listening, shortcuts.mac) : undefined} onClick={() => toggle("listening")} />
|
||||
</AudioVolumeMenu>
|
||||
{overlay && <>
|
||||
<Btn icon={overlay.mode === "editing" ? "check" : "pip"} size="compact" quiet textTooltip
|
||||
|
||||
@@ -30,6 +30,7 @@ export function ChannelVoiceSettings({ channel, roomId, available, shortcuts }:
|
||||
</span>
|
||||
<div ref={panel} id={id} popover="auto" role="dialog" aria-label={t("voice.settings")} className="lr-anchored-card c3-voice-settings"
|
||||
onToggle={event => { if (event.target === event.currentTarget) setOpen(event.newState === "open"); }}>
|
||||
<ChannelVoiceShortcutSettings open={open} {...shortcuts} />
|
||||
<strong>{t("voice.settings.sharedMicrophone")}</strong>
|
||||
{open && <MicrophoneSettings host={false} enabled={enabled} disabled={!available || busy}
|
||||
loadDevices={channel.microphones} deviceId={channel.voiceInput.deviceId} onDevice={deviceId => configure({ deviceId })}
|
||||
@@ -43,7 +44,6 @@ export function ChannelVoiceSettings({ channel, roomId, available, shortcuts }:
|
||||
{room?.canManage && <AudioBitrateControl purpose="voice" value={room.voiceBitrate} max={MAX_AUDIO_SEND_BITRATE}
|
||||
disabled={!available || channel.pending.has(`room:${roomId}`)}
|
||||
onChange={bitrate => { void channel.setRoomVoiceBitrate(roomId, bitrate).catch(() => {}); }} />}
|
||||
<ChannelVoiceShortcutSettings open={open} {...shortcuts} />
|
||||
</div>
|
||||
</>;
|
||||
}
|
||||
@@ -120,7 +120,6 @@
|
||||
@container (max-width: 280px) {
|
||||
.c3-mini-controls { --mini-controls-inset: 2px; width: calc(100% - 2 * var(--mini-controls-inset)); gap: 0; padding: 2px; }
|
||||
.c3-mini-controls .c3-mini-space { display: none; }
|
||||
.c3-watch-actions > .lr-media-overlay { column-gap: 0; }
|
||||
/* Leave room for the shared timeline readout and direct actions at tile minimum. */
|
||||
.c3-watch-inline-volume { display: none; }
|
||||
.c3-watch-volume { display: grid; }
|
||||
@@ -128,11 +127,20 @@
|
||||
.c3-mini-player[data-thumbnail] .c3-mini-controls { width: fit-content; }
|
||||
.c3-mini-player[data-thumbnail] .c3-mini-controls .lr-btn:not(:where(.c3-mini-controls [popover] *)) { --button-size: var(--control-dense-size); }
|
||||
.c3-mini-controls.c3-watch-controls { display: grid; grid-template-columns: minmax(0, 1fr); row-gap: 0; border-radius: var(--c3-inset-radius); }
|
||||
.c3-watch-controls:has(.c3-watch-timeline) { width: calc(100% - 2 * var(--mini-controls-inset)); row-gap: 4px; padding: 0; background: none; border: 0; box-shadow: none; }
|
||||
.c3-watch-timeline { padding-inline: clamp(5px, 1.5cqi, 10px); }
|
||||
.c3-watch-timeline, .c3-watch-actions > .lr-media-overlay { border-radius: var(--c3-inset-radius); }
|
||||
.c3-watch-actions > .lr-media-overlay { padding-inline: clamp(2px, 0.8cqi, 4px); }
|
||||
.c3-watch-timeline + .c3-watch-actions { column-gap: clamp(2px, 0.8cqi, 8px); }
|
||||
.c3-watch-controls:has(.c3-watch-timeline) {
|
||||
width: calc(100% - 2 * var(--mini-controls-inset));
|
||||
padding: 2px clamp(6px, 1.5cqi, 12px) 5px;
|
||||
}
|
||||
.c3-watch-timeline { padding-inline: 2px; }
|
||||
.c3-watch-actions { gap: clamp(3px, 1cqi, 10px); }
|
||||
.c3-watch-time strong { color: var(--ink); font-weight: 650; }
|
||||
.c3-watch-position[data-seeking] .c3-watch-time strong { color: var(--action); }
|
||||
.c3-watch-controls:has(.c3-watch-timeline) .c3-watch-local { flex: 1 0 auto; }
|
||||
.c3-watch-controls:has(.c3-watch-timeline) .c3-watch-settings { margin-inline-start: auto; }
|
||||
@container (max-width: 280px) {
|
||||
.c3-watch-controls:has(.c3-watch-timeline) { padding-inline: 4px; }
|
||||
.c3-watch-actions { gap: 2px; }
|
||||
}
|
||||
.c3-watch-receiving .lr-btn:has(> .lr-cap) { width: fit-content; min-height: var(--control-compact-size); padding-inline: 8px; }
|
||||
@media (pointer: coarse) {
|
||||
.c3-watch-controls .lr-btn:not(:where(.c3-watch-controls [popover] *)) { --button-size: clamp(28px, 11.5cqi, var(--control-compact-size)); }
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
.c3-voice-settings > p { margin: 6px 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
|
||||
.c3-voice-settings > .lr-switch-item { margin-block-start: 6px; }
|
||||
.c3-voice-settings .lr-switch-item .lr-cap { white-space: normal; }
|
||||
.c3-voice-shortcuts { margin-top: 14px; padding-top: 8px; border-top: 1px solid var(--control-edge); }
|
||||
.c3-voice-shortcuts { margin-bottom: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--control-edge); }
|
||||
.c3-voice-shortcuts > header { display: flex; align-items: center; justify-content: space-between; }
|
||||
.c3-voice-shortcuts strong { font-size: var(--control-label-size); }
|
||||
.c3-voice-shortcuts p { margin: 4px 0 6px; color: var(--muted); font-size: 12px; line-height: 1.5; }
|
||||
|
||||
@@ -435,13 +435,13 @@ export class ChannelSession {
|
||||
const self = this.view.self?.id;
|
||||
if (this.closed || !self || !this.view.feedbackSound.enabled) return;
|
||||
const popout = this.conversationPopout;
|
||||
const foreground = !document.hidden || (popout?.roomId === roomId && !popout.document.hidden && popout.document.hasFocus());
|
||||
const popoutFocused = popout?.roomId === roomId && !popout.document.hidden && popout.document.hasFocus();
|
||||
if (event.payload.kind === "chat") {
|
||||
if (event.messageSeq !== undefined && event.messageSeq <= (this.view.readByRoom[roomId] ?? 0)) return;
|
||||
if (!foreground && event.sender.peerId !== self) this.feedbackAudio.play("message");
|
||||
if (!popoutFocused && (document.hidden || !document.hasFocus()) && event.sender.peerId !== self) this.feedbackAudio.play("message");
|
||||
return;
|
||||
}
|
||||
if (!foreground || !isThrow(event.payload.reaction)) return;
|
||||
if ((document.hidden && !popoutFocused) || !isThrow(event.payload.reaction)) return;
|
||||
const target = event.contentTarget;
|
||||
const recipient = target ? "messageSeq" in target
|
||||
? this.view.messagesByRoom[roomId]?.find(message => message.seq === target.messageSeq && message.id === target.messageId)?.userId
|
||||
@@ -3156,6 +3156,24 @@ export class ChannelSession {
|
||||
});
|
||||
};
|
||||
private activateWatchOwner(id: string, player: WatchPlayer): void {
|
||||
const page = player.media.page;
|
||||
if (page instanceof AppPage) {
|
||||
const reconcile = () => {
|
||||
if (this.watchPlayers.get(id) === player && this.view.connection === "connected")
|
||||
void this.reconcileWatchBytes(id, player).catch(() => {});
|
||||
};
|
||||
const release = page.listenMediaSources(reconcile);
|
||||
let previous: WatchByteSource | undefined;
|
||||
const publicationChanged = () => {
|
||||
const declared = this.view.state?.watchActivities.find(activity => activity.id === id)?.byteSource;
|
||||
if (previous === declared || (previous && sameWatchByteSource(previous, declared))) return;
|
||||
previous = declared;
|
||||
if (declared) reconcile();
|
||||
};
|
||||
const unsubscribe = this.subscribe(publicationChanged);
|
||||
player.signal.addEventListener("abort", () => { release(); unsubscribe(); }, { once: true });
|
||||
publicationChanged();
|
||||
}
|
||||
player.activate(async playback => {
|
||||
if (this.watchPlayers.get(id) === player && this.view.connection === "connected")
|
||||
await this.request({ type: "update_watch", roomId: player.roomId, id, playback }, undefined, player.roomId);
|
||||
|
||||
@@ -57,6 +57,7 @@ export function Btn({
|
||||
expanded,
|
||||
hasPopup,
|
||||
keyShortcuts,
|
||||
shortcutLabel,
|
||||
controls,
|
||||
popoverTarget,
|
||||
onClick,
|
||||
@@ -89,6 +90,7 @@ export function Btn({
|
||||
controls?: string;
|
||||
popoverTarget?: string;
|
||||
keyShortcuts?: string;
|
||||
shortcutLabel?: string;
|
||||
onClick?: () => void;
|
||||
type?: "button" | "submit";
|
||||
/** Shared hint comic with its localized caption. */
|
||||
@@ -153,7 +155,7 @@ export function Btn({
|
||||
);
|
||||
return hint ? (
|
||||
<Tooltip kind={hint} disabled={expanded} tone={hintTone} motion={hintMotion} place={hintPlace} align={hintAlign} text={hintText ? t(hintText, hintVars) : label}>{button}</Tooltip>
|
||||
) : textTooltip ? <Tooltip text={label} disabled={expanded}>{button}</Tooltip> : (
|
||||
) : textTooltip ? <Tooltip text={shortcutLabel ? label + " · " + shortcutLabel : label} disabled={expanded}>{button}</Tooltip> : (
|
||||
button
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { ComponentProps } from "react";
|
||||
import { Btn } from "../components/living/primitives";
|
||||
import { MicrophoneLevel } from "./MicrophoneLevel";
|
||||
|
||||
type ButtonState = Pick<ComponentProps<typeof Btn>, "disabled" | "busy" | "quiet" | "hint" | "hintText" | "keyShortcuts" | "onClick">;
|
||||
type ButtonState = Pick<ComponentProps<typeof Btn>, "disabled" | "busy" | "quiet" | "hint" | "hintText" | "keyShortcuts" | "shortcutLabel" | "onClick">;
|
||||
|
||||
export function VoiceMicrophoneButton({ active, level, cancelPending, ...button }: ButtonState & { active: boolean; level?: number; cancelPending?: boolean }) {
|
||||
return <Btn {...button} icon={active ? "microphone" : "microphoneOff"}
|
||||
@@ -13,5 +13,5 @@ export function VoiceMicrophoneButton({ active, level, cancelPending, ...button
|
||||
|
||||
export function VoiceListeningButton({ deafened, ...button }: ButtonState & { deafened: boolean }) {
|
||||
return <Btn {...button} icon={deafened ? "headphonesOff" : "headphones"} title="voice.listening"
|
||||
size="compact" draw="voice-listening" pressed={!deafened} />;
|
||||
textTooltip={Boolean(button.shortcutLabel)} size="compact" draw="voice-listening" pressed={!deafened} />;
|
||||
}
|
||||
@@ -467,7 +467,7 @@ test("accepted history resolves offline author, reply and mention IDs through th
|
||||
});
|
||||
|
||||
test("confirmed room events own personal feedback across text, attachments and throw targets", async () => {
|
||||
const document = Object.assign(new EventTarget(), { hidden: true });
|
||||
const document = Object.assign(new EventTarget(), { hidden: true, hasFocus: (): boolean => true });
|
||||
vi.stubGlobal("document", document);
|
||||
const play = vi.spyOn(FeedbackAudio.prototype, "play").mockImplementation(() => {});
|
||||
const configure = vi.spyOn(FeedbackAudio.prototype, "configure").mockImplementation(() => {});
|
||||
@@ -517,43 +517,48 @@ test("confirmed room events own personal feedback across text, attachments and t
|
||||
expect(play).toHaveBeenCalledTimes(3);
|
||||
|
||||
document.hidden = false;
|
||||
document.hasFocus = () => false;
|
||||
peer.live(fresh(94));
|
||||
expect(play).toHaveBeenLastCalledWith("message");
|
||||
expect(play).toHaveBeenCalledTimes(4);
|
||||
document.hasFocus = () => true;
|
||||
peer.live(fresh(95));
|
||||
const reaction = (id: string, senderUserId: string, target: import("../src/client/channel/protocol").ReactionTarget, reaction = "tomato") => {
|
||||
peer.reply(peer.interactions[0], { type: "reaction", nonce: 1, snapshot: null,
|
||||
event: { id, senderUserId, target, reaction, occurredAt: Date.now() } });
|
||||
};
|
||||
reaction("self-person", "self-user-1234", { type: "person", userId: "friend-user-1234" });
|
||||
expect(play.mock.calls.length, "self-person").toBe(4);
|
||||
expect(play.mock.calls.length, "self-person").toBe(5);
|
||||
reaction("self-person", "self-user-1234", { type: "person", userId: "friend-user-1234" });
|
||||
reaction("to-person", "friend-user-1234", { type: "person", userId: "self-user-1234" });
|
||||
expect(play.mock.calls.length, "to-person").toBe(5);
|
||||
expect(play.mock.calls.length, "to-person").toBe(6);
|
||||
reaction("to-message", "friend-user-1234", { type: "message", messageSeq: 90, messageId: message(90).id }, "poop");
|
||||
expect(play.mock.calls.length, "to-message").toBe(6);
|
||||
expect(play.mock.calls.length, "to-message").toBe(7);
|
||||
reaction("to-screen", "friend-user-1234", { type: "publication", publicationId: "own-screen" });
|
||||
expect(play.mock.calls.length, "to-screen").toBe(7);
|
||||
expect(play.mock.calls.length, "to-screen").toBe(8);
|
||||
reaction("self-message", "self-user-1234", { type: "message", messageSeq: 91, messageId: message(91).id });
|
||||
expect(play.mock.calls.length, "self-message").toBe(8);
|
||||
expect(play.mock.calls.length, "self-message").toBe(9);
|
||||
reaction("self-screen", "self-user-1234", { type: "publication", publicationId: "own-screen" }, "poop");
|
||||
expect(play.mock.calls.length, "self-screen").toBe(9);
|
||||
expect(play.mock.calls.map(([cue]) => cue)).toEqual(["message", "message", "message", ...Array(6).fill("throw")]);
|
||||
expect(play.mock.calls.length, "self-screen").toBe(10);
|
||||
expect(play.mock.calls.map(([cue]) => cue)).toEqual(["message", "message", "message", "message", ...Array(6).fill("throw")]);
|
||||
reaction("emoji", "friend-user-1234", { type: "person", userId: "self-user-1234" }, "heart");
|
||||
reaction("bystander", "friend-user-1234", { type: "person", userId: "bystander" });
|
||||
reaction("other-message", "friend-user-1234", { type: "message", messageSeq: 91, messageId: message(91).id });
|
||||
reaction("unknown-screen", "friend-user-1234", { type: "publication", publicationId: "other-screen" });
|
||||
document.hidden = true;
|
||||
reaction("hidden-throw", "friend-user-1234", { type: "person", userId: "self-user-1234" });
|
||||
expect(play).toHaveBeenCalledTimes(9);
|
||||
expect(play).toHaveBeenCalledTimes(10);
|
||||
session.setConversationPopout("first", popout);
|
||||
reaction("popout-throw", "friend-user-1234", { type: "person", userId: "self-user-1234" });
|
||||
expect(play).toHaveBeenCalledTimes(10);
|
||||
expect(play).toHaveBeenCalledTimes(11);
|
||||
expect(play).toHaveBeenLastCalledWith("throw");
|
||||
session.setFeedbackSound({ enabled: false });
|
||||
peer.live(fresh(93));
|
||||
expect(play).toHaveBeenCalledTimes(10);
|
||||
expect(play).toHaveBeenCalledTimes(11);
|
||||
} finally { session.close(); }
|
||||
expect(close).toHaveBeenCalledOnce();
|
||||
peer.live(fresh(94));
|
||||
expect(play).toHaveBeenCalledTimes(10);
|
||||
expect(play).toHaveBeenCalledTimes(11);
|
||||
});
|
||||
|
||||
function stubFeedbackAudio() {
|
||||
@@ -12520,6 +12525,35 @@ test('closing forwarding settings during direct preparation releases the reader
|
||||
} finally { session.close(); }
|
||||
});
|
||||
|
||||
test.each(["before activation", "before publication", "after publication"])("a native page source change %s withdraws the retired grant", async timing => {
|
||||
let active: unknown = null;
|
||||
const { session, page, socket } = await websiteSourceSelection(async () => ({ choices: [], indexedCandidates: [], byteSource: active }));
|
||||
const media = new AppPageMedia(page);
|
||||
await media.opening;
|
||||
const player = new WatchPlayer("first", true, media, () => {});
|
||||
const owner = session as unknown as { watchPlayers: Map<string, WatchPlayer>; activateWatchOwner(id: string, player: WatchPlayer): void };
|
||||
owner.watchPlayers.set("owned", player);
|
||||
const state = session.getSnapshot().state!;
|
||||
const activity = {
|
||||
id: "owned", roomId: "first", viewerSessionIds: [], sessionId: "endpoint", userId: "self",
|
||||
source: { kind: "website", url: page.url }, playback: { timeline: "media", position: 0, paused: true, rate: 1, anchorTime: 1000 },
|
||||
byteSource: { sessionId: crypto.randomUUID(), resourceId: crypto.randomUUID(), format: "file" },
|
||||
};
|
||||
try {
|
||||
const publish = () => socket.receive({ type: "state", state: { ...state, watchActivities: [activity] } });
|
||||
const revoke = () => { active = null; page.receive({ type: "page_media_changed", pageId: page.id }); };
|
||||
active = activity.byteSource;
|
||||
if (timing !== "before publication") publish();
|
||||
if (timing === "before activation") revoke();
|
||||
owner.activateWatchOwner("owned", player);
|
||||
if (timing !== "before activation") revoke();
|
||||
if (timing === "before publication") publish();
|
||||
await vi.waitFor(() => expect(socket.sent.at(-1)).toMatchObject({ type: "set_watch_byte_source", id: "owned", byteSource: null }));
|
||||
socket.receive({ type: "room_reply", roomId: "first", requestId: socket.sent.at(-1)!.requestId, result: { type: "done" } });
|
||||
expect(owner.watchPlayers.get("owned")).toBe(player);
|
||||
} finally { session.close(); }
|
||||
});
|
||||
|
||||
test("foreground recovery cannot withdraw a replacement watch byte source", async () => {
|
||||
let completeRead!: (result: unknown) => void;
|
||||
const delayed = new Promise<unknown>(resolve => { completeRead = resolve; });
|
||||
|
||||
@@ -33,6 +33,10 @@ function withWatchDocument(render: () => string): string {
|
||||
try { return render(); } finally { vi.unstubAllGlobals(); }
|
||||
}
|
||||
|
||||
function watchTimeReadout(html: string): string | undefined {
|
||||
return html.match(/<span class="c3-watch-time"[^>]*>(.*?)<\/span>/)?.[1].replace(/<[^>]+>/g, "");
|
||||
}
|
||||
|
||||
describe("Webpage watch presentation", () => {
|
||||
it("reserves a native slot only for a full stage with a local page and shell bridge", () => {
|
||||
const render = (pageId?: string, nativeStage = true, selected = true) => renderToStaticMarkup(createElement(ChannelWatchVideo, {
|
||||
@@ -121,7 +125,7 @@ describe("Webpage watch presentation", () => {
|
||||
const owner = render(true), viewer = render(false);
|
||||
expect(owner).toContain('aria-label="Playback progress for everyone"');
|
||||
expect(owner).toContain('aria-valuetext="0:12 / 2:00"');
|
||||
expect(viewer).toContain('>0:12 / 2:00<');
|
||||
expect(watchTimeReadout(viewer)).toBe("0:12 / 2:00");
|
||||
expect(owner).toMatch(/popover="auto"[\s\S]*<select[^>]*aria-label="Playback speed for everyone"/);
|
||||
expect(viewer).toMatch(/<progress[^>]*max="120"[^>]*value="12"/);
|
||||
expect(viewer).not.toContain('type="range"');
|
||||
@@ -367,7 +371,7 @@ describe("Webpage watch presentation", () => {
|
||||
expect(html).toContain(`role="group" aria-label="${t("en", "playback.controls")}"`);
|
||||
expect(html.includes('aria-label="Playback for everyone"')).toBe(owned);
|
||||
expect(html.includes('aria-label="Playback progress for everyone"')).toBe(owned);
|
||||
expect(html).toContain('>0:42 / 4:00<');
|
||||
expect(watchTimeReadout(html)).toBe("0:42 / 4:00");
|
||||
if (owned) expect(html).toMatch(/<input[^>]*type="range"[^>]*max="240"/);
|
||||
else {
|
||||
expect(html).toMatch(/<progress[^>]*max="240"[^>]*value="42"/);
|
||||
|
||||
Reference in new issue
Block a user