Add voice broadcast pre-recoding PiP (#9548)
This commit is contained in:
parent
afdf289a78
commit
abec724387
26 changed files with 977 additions and 111 deletions
58
src/voice-broadcast/models/VoiceBroadcastPreRecording.ts
Normal file
58
src/voice-broadcast/models/VoiceBroadcastPreRecording.ts
Normal file
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
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 { MatrixClient, Room, RoomMember } from "matrix-js-sdk/src/matrix";
|
||||
import { TypedEventEmitter } from "matrix-js-sdk/src/models/typed-event-emitter";
|
||||
|
||||
import { IDestroyable } from "../../utils/IDestroyable";
|
||||
import { VoiceBroadcastRecordingsStore } from "../stores/VoiceBroadcastRecordingsStore";
|
||||
import { startNewVoiceBroadcastRecording } from "../utils/startNewVoiceBroadcastRecording";
|
||||
|
||||
type VoiceBroadcastPreRecordingEvent = "dismiss";
|
||||
|
||||
interface EventMap {
|
||||
"dismiss": (voiceBroadcastPreRecording: VoiceBroadcastPreRecording) => void;
|
||||
}
|
||||
|
||||
export class VoiceBroadcastPreRecording
|
||||
extends TypedEventEmitter<VoiceBroadcastPreRecordingEvent, EventMap>
|
||||
implements IDestroyable {
|
||||
public constructor(
|
||||
public room: Room,
|
||||
public sender: RoomMember,
|
||||
private client: MatrixClient,
|
||||
private recordingsStore: VoiceBroadcastRecordingsStore,
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
||||
public start = async (): Promise<void> => {
|
||||
await startNewVoiceBroadcastRecording(
|
||||
this.room,
|
||||
this.client,
|
||||
this.recordingsStore,
|
||||
);
|
||||
this.emit("dismiss", this);
|
||||
};
|
||||
|
||||
public cancel = (): void => {
|
||||
this.emit("dismiss", this);
|
||||
};
|
||||
|
||||
public destroy(): void {
|
||||
this.removeAllListeners();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue