Add voice broadcast playback pip (#9603)
This commit is contained in:
parent
569a364933
commit
a8e15ebe60
13 changed files with 372 additions and 41 deletions
|
@ -25,7 +25,7 @@ export enum VoiceBroadcastPlaybacksStoreEvent {
|
|||
}
|
||||
|
||||
interface EventMap {
|
||||
[VoiceBroadcastPlaybacksStoreEvent.CurrentChanged]: (recording: VoiceBroadcastPlayback) => void;
|
||||
[VoiceBroadcastPlaybacksStoreEvent.CurrentChanged]: (recording: VoiceBroadcastPlayback | null) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -53,7 +53,14 @@ export class VoiceBroadcastPlaybacksStore
|
|||
this.emit(VoiceBroadcastPlaybacksStoreEvent.CurrentChanged, current);
|
||||
}
|
||||
|
||||
public getCurrent(): VoiceBroadcastPlayback {
|
||||
public clearCurrent(): void {
|
||||
if (this.current === null) return;
|
||||
|
||||
this.current = null;
|
||||
this.emit(VoiceBroadcastPlaybacksStoreEvent.CurrentChanged, null);
|
||||
}
|
||||
|
||||
public getCurrent(): VoiceBroadcastPlayback | null {
|
||||
return this.current;
|
||||
}
|
||||
|
||||
|
@ -80,11 +87,15 @@ export class VoiceBroadcastPlaybacksStore
|
|||
state: VoiceBroadcastPlaybackState,
|
||||
playback: VoiceBroadcastPlayback,
|
||||
): void => {
|
||||
if ([
|
||||
VoiceBroadcastPlaybackState.Buffering,
|
||||
VoiceBroadcastPlaybackState.Playing,
|
||||
].includes(state)) {
|
||||
this.pauseExcept(playback);
|
||||
switch (state) {
|
||||
case VoiceBroadcastPlaybackState.Buffering:
|
||||
case VoiceBroadcastPlaybackState.Playing:
|
||||
this.pauseExcept(playback);
|
||||
this.setCurrent(playback);
|
||||
break;
|
||||
case VoiceBroadcastPlaybackState.Stopped:
|
||||
this.clearCurrent();
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue