logo
On this page

Event

onLeaveLiveStreaming

This callback will be triggered when user click exit button.

  • function prototype:
onLeaveLiveStreaming(duration)
  • example:
<ZegoUIKitPrebuiltLiveStreaming
   appID={Your_APPID}
   appSign={Your_APPSign}
   userID={Your_UserID}
   userName={Your_UserName}
   liveID={liveID}
   config={{
       onLeaveLiveStreaming: (duration) => {
           //...
       },
   }}
/>

onLiveStreamingEnded

This callback will be triggered to audience in livestreaming room when the live is end by host.

  • function prototype:
onLiveStreamingEnded(duration)
  • example:
<ZegoUIKitPrebuiltLiveStreaming
   appID={Your_APPID}
   appSign={Your_APPSign}
   userID={Your_UserID}
   userName={Your_UserName}
   liveID={liveID}
   config={{
       onLiveStreamingEnded: () => {
           //...
       },
   }}
/>

onStartLiveButtonPressed

This callback will be triggered when host click start live button.

  • function prototype:
onStartLiveButtonPressed()
  • example:
<ZegoUIKitPrebuiltLiveStreaming
   appID={Your_APPID}
   appSign={Your_APPSign}
   userID={Your_UserID}
   userName={Your_UserName}
   liveID={liveID}
   config={{
       onStartLiveButtonPressed: () => {
           //...
       },
   }}
/>

onUsersEnter and onUsersLeave

This callback will be triggered when other users enter the room.

  • function prototype:
onUsersEnter(userInfoList: any[])

onUsersLeave(userInfoList: any[])
  • example:
const prebuiltRef = useRef(null);

<ZegoUIKitPrebuiltLiveStreaming
   ref={prebuiltRef}
   appID={Your_APPID}
   appSign={Your_APPSign}
   userID={Your_UserID}
   userName={Your_UserName}
   liveID={liveID}
   config={{
       roomConfig: {
          onUsersEnter: (userInfoList: any[]) => {
              userInfoList.map((userInfo) => {
                  (prebuiltRef.current as any)?.sendSystemMessage?.(userInfo.userName + ' entered the room');
              })
          },
          onUsersLeave: (userInfoList: any[]) => {
              //...
          },
       },
   }}
/>

Previous

More config

Next

Migrating to v2.0

On this page

Back to top