Stop voice broadcast on delete (#9629)
This commit is contained in:
parent
d6ea92f735
commit
3c7781a561
2 changed files with 23 additions and 0 deletions
|
@ -18,6 +18,7 @@ import {
|
|||
EventType,
|
||||
MatrixClient,
|
||||
MatrixEvent,
|
||||
MatrixEventEvent,
|
||||
MsgType,
|
||||
RelationType,
|
||||
} from "matrix-js-sdk/src/matrix";
|
||||
|
@ -88,6 +89,7 @@ export class VoiceBroadcastPlayback
|
|||
) {
|
||||
super();
|
||||
this.addInfoEvent(this.infoEvent);
|
||||
this.infoEvent.on(MatrixEventEvent.BeforeRedaction, this.onBeforeRedaction);
|
||||
this.setUpRelationsHelper();
|
||||
}
|
||||
|
||||
|
@ -169,6 +171,14 @@ export class VoiceBroadcastPlayback
|
|||
this.setInfoState(state);
|
||||
};
|
||||
|
||||
private onBeforeRedaction = () => {
|
||||
if (this.getState() !== VoiceBroadcastPlaybackState.Stopped) {
|
||||
this.stop();
|
||||
// destroy cleans up everything
|
||||
this.destroy();
|
||||
}
|
||||
};
|
||||
|
||||
private async enqueueChunks(): Promise<void> {
|
||||
const promises = this.chunkEvents.getEvents().reduce((promises, event: MatrixEvent) => {
|
||||
if (!this.playbacks.has(event.getId() || "")) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue