Event Listeners Enums

HMSPeerUpdate

import { HMSPeerUpdate, HMSUpdateListenerActions, HMSRoom, HMSLocalPeer, HMSRemotePeer } from '@100mslive/react-native-hms'; // hms instance acquired from build method hmsInstance?.addEventListener(HMSUpdateListenerActions.ON_PEER_UPDATE, onPeerListener); const onPeerListener = ({ peer, type }: { peer: HMSPeer, type: HMSPeerUpdate }) => { if (type === HMSPeerUpdate.PEER_JOINED) { // when a peer joins } if (type === HMSPeerUpdate.PEER_LEFT) { // when a peer leaves } if (type === HMSPeerUpdate.ROLE_CHANGED) { // when a peer's role is changed } if (type === HMSPeerUpdate.METADATA_CHANGED) { // when a peer's metadata is changed } if (type === HMSPeerUpdate.NAME_CHANGED) { // when a peer's name is changed } if (type === HMSPeerUpdate.NETWORK_QUALITY_UPDATED) { // when a peer's network quality is changed } };

HMSTrackUpdate

import { HMSTrackUpdate, HMSUpdateListenerActions, HMSRoom, HMSLocalPeer, HMSRemotePeer } from '@100mslive/react-native-hms'; // hms instance acquired from build method hmsInstance?.addEventListener(HMSUpdateListenerActions.ON_TRACK_UPDATE, onTrackListener); const onTrackListener = ({ track, peer, type }: { track: HMSTrack, peer: HMSPeer, type: HMSTrackUpdate }) => { if (type === HMSTrackUpdate.TRACK_ADDED) { // when track is added } if (type === HMSTrackUpdate.TRACK_REMOVED) { // when track is removed } if (type === HMSTrackUpdate.TRACK_MUTED) { // when track is muted } if (type === HMSTrackUpdate.TRACK_UNMUTED) { // when track is unmuted } if (type === HMSTrackUpdate.TRACK_DESCRIPTION_CHANGED) { // when track's description is changed } if (type === HMSTrackUpdate.TRACK_DEGRADED) { // when track is degraded } if (type === HMSTrackUpdate.TRACK_RESTORED) { // when track is restored } };

HMSRoomUpdate

import { HMSRoomUpdate, HMSUpdateListenerActions, HMSRoom, HMSLocalPeer, HMSRemotePeer } from '@100mslive/react-native-hms'; // hms instance acquired from build method hmsInstance?.addEventListener(HMSUpdateListenerActions.ON_ROOM_UPDATE, onRoomListener); const onRoomListener = ({ room, type }: { room: HMSRoom, type: HMSRoomUpdate }) => { if (type === HMSRoomUpdate.ROOM_MUTED) { // when room is muted } if (type === HMSRoomUpdate.ROOM_UNMUTED) { // when room is unmuted } if (type === HMSRoomUpdate.SERVER_RECORDING_STATE_UPDATED) { // when server recording state is updated } if (type === HMSRoomUpdate.RTMP_STREAMING_STATE_UPDATED) { // when rtmp streaming state is updated } if (type === HMSRoomUpdate.BROWSER_RECORDING_STATE_UPDATED) { // when browser recording state is updated } if (type === HMSRoomUpdate.HLS_RECORDING_STATE_UPDATED) { // when hls recording state is updated } if (type === HMSRoomUpdate.HLS_STREAMING_STATE_UPDATED) { // when hls streaming state is updated } };

Have a suggestion? Recommend changes ->

Was this helpful?

1234