Implement an audio-only live
Live Streaming Kit (ZegoUIKitPrebuiltLiveStreaming) defaults to Video Live Streaming mode. While it allows users to tap the camera button to turn off the camera, converting to an audio-only live.
Camera-related logic is not required for audio-only live, so you can:
bottomMenuBar
: Configure this to delete the camera-related button.turnOnCameraWhenJoining
: Configure this to only use the microphone when a live starts.
Here is the reference code:
Untitled
class LivePage extends StatelessWidget {
const LivePage({Key? key, required this.liveID, this.isHost = false})
: super(key: key);
final String liveID;
final bool isHost;
@override
Widget build(BuildContext context) {
return ZegoUIKitPrebuiltLiveStreaming(
appID: YourSecret.appID,
appSign: YourSecret.appSign,
userID: userID,
userName: 'user_$userID',
liveID: liveID,
// Modify your custom configurations here.
config: isHost
? ZegoUIKitPrebuiltLiveStreamingConfig.host()
: ZegoUIKitPrebuiltLiveStreamingConfig.audience()
..turnOnCameraWhenJoining = false
..bottomMenuBar.hostButtons = [
ZegoLiveStreamingMenuBarButtonName.toggleMicrophoneButton
],
);
}
}
1