logo
On this page

Forcefully end a livestream room

Live Streaming Kit (ZegoUIKitPrebuiltLiveStreaming) allows to forcefully end a livestream room and dismiss all audience automatically when the host ends the livestream. To implement this, use the onLiveStreamingEnded callback. This callback will be triggered when the host ends the livestream, and all audience will automatically exit the livestream room.

Here is the reference code:

Untitled
import React from 'react';
import { StyleSheet, View } from 'react-native';
import ZegoUIKitPrebuiltLiveStreaming, { HOST_DEFAULT_CONFIG } from '@zegocloud/zego-uikit-prebuilt-live-streaming-rn';
import * as ZIM from 'zego-zim-react-native';

export default function HostPage(props) {
    return (
        <View style={styles.container}>
            <ZegoUIKitPrebuiltLiveStreaming
                appID={yourAppID}
                appSign={yourAppSign}
                userID={userID}
                userName={userName}
                liveID={liveID}

                config={{
                    ...HOST_DEFAULT_CONFIG,
                    onLeaveLiveStreaming: () => { props.navigation.navigate('HomePage') },
                    onLiveStreamingEnded: () => { props.navigation.navigate('HomePage') },
                }}
                plugins={[ZIM]}
            />
        </View>
    );
}
1
Copied!

On this page

Back to top