mirror of
https://github.com/vector-im/element-call.git
synced 2026-01-18 02:32:27 +00:00
Log when a track is unpublished or runs into an error (#3495)
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
ConnectionState,
|
||||
type E2EEManagerOptions,
|
||||
ExternalE2EEKeyProvider,
|
||||
type LocalTrackPublication,
|
||||
LocalVideoTrack,
|
||||
Room,
|
||||
type RoomOptions,
|
||||
@@ -181,6 +182,33 @@ export function useLivekit(
|
||||
sfuConfig,
|
||||
);
|
||||
|
||||
// Log errors when local participant has issues publishing a track.
|
||||
useEffect(() => {
|
||||
const localTrackUnpublishedFn = (
|
||||
publication: LocalTrackPublication,
|
||||
): void => {
|
||||
logger.info(
|
||||
"Local track unpublished",
|
||||
publication.trackName,
|
||||
publication.trackInfo,
|
||||
);
|
||||
};
|
||||
const mediaDevicesErrorFn = (error: Error): void => {
|
||||
logger.warn("Media devices error when publishing a track", error);
|
||||
};
|
||||
|
||||
room.localParticipant.on("localTrackUnpublished", localTrackUnpublishedFn);
|
||||
room.localParticipant.on("mediaDevicesError", mediaDevicesErrorFn);
|
||||
|
||||
return (): void => {
|
||||
room.localParticipant.off(
|
||||
"localTrackUnpublished",
|
||||
localTrackUnpublishedFn,
|
||||
);
|
||||
room.localParticipant.off("mediaDevicesError", mediaDevicesErrorFn);
|
||||
};
|
||||
}, [room.localParticipant]);
|
||||
|
||||
useEffect(() => {
|
||||
// Sync the requested mute states with LiveKit's mute states. We do it this
|
||||
// way around rather than using LiveKit as the source of truth, so that the
|
||||
|
||||
Reference in New Issue
Block a user