1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-07-31 13:44:28 +03:00

Display voice broadcast total length (#9517)

This commit is contained in:
Michael Weimann
2022-10-31 18:35:02 +01:00
committed by GitHub
parent 9b644844da
commit 66c20a0798
10 changed files with 443 additions and 94 deletions

View File

@ -14,9 +14,13 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import { MatrixEvent } from "matrix-js-sdk/src/matrix";
import { EventType, MatrixEvent, MsgType } from "matrix-js-sdk/src/matrix";
import { VoiceBroadcastInfoEventType, VoiceBroadcastInfoState } from "../../../src/voice-broadcast";
import {
VoiceBroadcastChunkEventType,
VoiceBroadcastInfoEventType,
VoiceBroadcastInfoState,
} from "../../../src/voice-broadcast";
import { mkEvent } from "../../test-utils";
export const mkVoiceBroadcastInfoStateEvent = (
@ -48,3 +52,31 @@ export const mkVoiceBroadcastInfoStateEvent = (
},
});
};
export const mkVoiceBroadcastChunkEvent = (
userId: string,
roomId: string,
duration: number,
sequence?: number,
timestamp?: number,
): MatrixEvent => {
return mkEvent({
event: true,
user: userId,
room: roomId,
type: EventType.RoomMessage,
content: {
msgtype: MsgType.Audio,
["org.matrix.msc1767.audio"]: {
duration,
},
info: {
duration,
},
[VoiceBroadcastChunkEventType]: {
...(sequence ? { sequence } : {}),
},
},
ts: timestamp,
});
};