Turn off camera during co-hosting
Occasionally, users may value their privacy and prefer their camera to not automatically turn on during co-hosting. In this case, users can manually activate the camera by clicking the camera button at a later time.
You can meet this requirement by configuring the turnOnCameraWhenCohosted
parameter.
Here is the reference code:
public class LiveActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_live);
long appID = YourAppID;
String appSign = YourAppSign;
String userID = "userID";
String userName = "userName";
String liveID = "testLiveID";
ZegoUIKitPrebuiltLiveStreamingConfig config;
if (isHost) {
config = ZegoUIKitPrebuiltLiveStreamingConfig.host();
} else {
config = ZegoUIKitPrebuiltLiveStreamingConfig.audience();
}
// Modify your custom configurations here.
config.turnOnCameraWhenCohosted = false
ZegoUIKitPrebuiltLiveStreamingFragment fragment = ZegoUIKitPrebuiltLiveStreamingFragment
.newInstance(appID, appSign, userID, userName,liveID, config);
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.fragment_container, fragment)
.commitNow();
}
}