You've already forked matrix-react-sdk
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:
@ -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,
|
||||
});
|
||||
};
|
||||
|
Reference in New Issue
Block a user