Pause non-live broadcast from other room (#9825)
This commit is contained in:
parent
5912c7a637
commit
539a50ae30
4 changed files with 143 additions and 1 deletions
|
@ -57,6 +57,7 @@ import {
|
|||
} from "../voice-broadcast";
|
||||
import { IRoomStateEventsActionPayload } from "../actions/MatrixActionCreators";
|
||||
import { showCantStartACallDialog } from "../voice-broadcast/utils/showCantStartACallDialog";
|
||||
import { pauseNonLiveBroadcastFromOtherRoom } from "../voice-broadcast/utils/pauseNonLiveBroadcastFromOtherRoom";
|
||||
|
||||
const NUM_JOIN_RETRY = 5;
|
||||
|
||||
|
@ -445,6 +446,7 @@ export class RoomViewStore extends EventEmitter {
|
|||
}
|
||||
|
||||
if (room) {
|
||||
pauseNonLiveBroadcastFromOtherRoom(room, this.stores.voiceBroadcastPlaybacksStore);
|
||||
this.doMaybeSetCurrentVoiceBroadcastPlayback(room);
|
||||
}
|
||||
} else if (payload.room_alias) {
|
||||
|
|
|
@ -37,7 +37,7 @@ export class VoiceBroadcastPlaybacksStore
|
|||
extends TypedEventEmitter<VoiceBroadcastPlaybacksStoreEvent, EventMap>
|
||||
implements IDestroyable
|
||||
{
|
||||
private current: VoiceBroadcastPlayback | null;
|
||||
private current: VoiceBroadcastPlayback | null = null;
|
||||
|
||||
/** Playbacks indexed by their info event id. */
|
||||
private playbacks = new Map<string, VoiceBroadcastPlayback>();
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { Room } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import { VoiceBroadcastPlaybacksStore } from "..";
|
||||
|
||||
export const pauseNonLiveBroadcastFromOtherRoom = (
|
||||
room: Room,
|
||||
voiceBroadcastPlaybacksStore: VoiceBroadcastPlaybacksStore,
|
||||
): void => {
|
||||
const playingBroadcast = voiceBroadcastPlaybacksStore.getCurrent();
|
||||
|
||||
if (
|
||||
!playingBroadcast ||
|
||||
playingBroadcast?.getLiveness() === "live" ||
|
||||
playingBroadcast?.infoEvent.getRoomId() === room.roomId
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
voiceBroadcastPlaybacksStore.clearCurrent();
|
||||
playingBroadcast.pause();
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue