Fix broadcast last sequence number (#9858)
This commit is contained in:
parent
be972bc913
commit
4f0a5d1eb4
2 changed files with 16 additions and 6 deletions
|
@ -60,13 +60,20 @@ export class VoiceBroadcastRecording
|
|||
{
|
||||
private state: VoiceBroadcastInfoState;
|
||||
private recorder: VoiceBroadcastRecorder;
|
||||
private sequence = 1;
|
||||
private dispatcherRef: string;
|
||||
private chunkEvents = new VoiceBroadcastChunkEvents();
|
||||
private chunkRelationHelper: RelationsHelper;
|
||||
private maxLength: number;
|
||||
private timeLeft: number;
|
||||
|
||||
/**
|
||||
* Broadcast chunks have a sequence number to bring them in the correct order and to know if a message is missing.
|
||||
* This variable holds the last sequence number.
|
||||
* Starts with 0 because there is no chunk at the beginning of a broadcast.
|
||||
* Will be incremented when a chunk message is created.
|
||||
*/
|
||||
private sequence = 0;
|
||||
|
||||
public constructor(
|
||||
public readonly infoEvent: MatrixEvent,
|
||||
private client: MatrixClient,
|
||||
|
@ -268,7 +275,8 @@ export class VoiceBroadcastRecording
|
|||
event_id: this.infoEvent.getId(),
|
||||
};
|
||||
content["io.element.voice_broadcast_chunk"] = {
|
||||
sequence: this.sequence++,
|
||||
/** Increment the last sequence number and use it for this message. Also see {@link sequence}. */
|
||||
sequence: ++this.sequence,
|
||||
};
|
||||
|
||||
await this.client.sendMessage(this.infoEvent.getRoomId(), content);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue