Configure layouts
Call Kit (ZegoUIKitPrebuiltCall) currently supports picture-in-picture and gallery layout, each layout has its own configurations. To select and configure the layout you want, use the layout
parameter in the ZegoUIKitPrebuiltCallConfig
:
Picture-in-picture layout
The configurations supported by the picture-in-picture layout are:
-
isSmallViewDraggable
: Whether the position of the small view in the picture-in-picture layout can be changed by dragging. It’s allowed by default.
-
switchLargeOrSmallViewByClick
: Whether to allow users to click on the small view for switching between large view and small view. It’s allowed by default.
The effect is as follows:
Here is the reference code:
ZegoUIKitPrebuiltCallInvitationService().init(
appID: YourAppID,
appSign: YourAppSign,
userID: userID,
userName: userName,
plugins: [ZegoUIKitSignalingPlugin()],
requireConfig: (ZegoCallInvitationData data) {
var config = (data.invitees.length > 1)
? ZegoCallType.videoCall == data.type
? ZegoUIKitPrebuiltCallConfig.groupVideoCall()
: ZegoUIKitPrebuiltCallConfig.groupVoiceCall()
: ZegoCallType.videoCall == data.type
? ZegoUIKitPrebuiltCallConfig.oneOnOneVideoCall()
: ZegoUIKitPrebuiltCallConfig.oneOnOneVoiceCall();
// Modify your custom configurations here.
config.layout = ZegoLayout.pictureInPicture(
isSmallViewDraggable: true,
switchLargeOrSmallViewByClick: true,
);
return config;
},
);
1
class CallPage extends StatelessWidget {
const CallPage({Key? key, required this.callID}) : super(key: key);
final String callID;
@override
Widget build(BuildContext context) {
return ZegoUIKitPrebuiltCall (
appID: YourAppID,
appSign: YourAppSign,
userID: userID,
userName: userName,
callID: callID,
// Modify your custom configurations here.
config: ZegoUIKitPrebuiltCallConfig.oneOnOneVideoCall()
..layout = ZegoLayout.pictureInPicture(
isSmallViewDraggable: true,
switchLargeOrSmallViewByClick: true,
),
);
}
}
1
Gallery layout
The configuration supported by the gallery layout is:
addBorderRadiusAndSpacingBetweenView
: In gallery layout, this can be used to add border radius and spacing between speaker views. true: enabled (by default). false: disabled.
The effect is as follows:
ZegoUIKitPrebuiltCallInvitationService().init(
appID: YourAppID,
appSign: YourAppSign,
userID: userID,
userName: userName,
plugins: [ZegoUIKitSignalingPlugin()],
requireConfig: (ZegoCallInvitationData data) {
var config = (data.invitees.length > 1)
? ZegoCallType.videoCall == data.type
? ZegoUIKitPrebuiltCallConfig.groupVideoCall()
: ZegoUIKitPrebuiltCallConfig.groupVoiceCall()
: ZegoCallType.videoCall == data.type
? ZegoUIKitPrebuiltCallConfig.oneOnOneVideoCall()
: ZegoUIKitPrebuiltCallConfig.oneOnOneVoiceCall();
// Modify your custom configurations here.
config.layout = ZegoLayout.gallery(
addBorderRadiusAndSpacingBetweenView: false,
);
return config;
},
);
1
class CallPage extends StatelessWidget {
const CallPage({Key? key, required this.callID}) : super(key: key);
final String callID;
@override
Widget build(BuildContext context) {
return ZegoUIKitPrebuiltCall(
appID: YourAppID,
appSign: YourAppSign,
userID: userID,
userName: userName,
callID: callID,
// Modify your custom configurations here.
config: ZegoUIKitPrebuiltCallConfig.groupVideoCall()
..layout = ZegoLayout.gallery(
addBorderRadiusAndSpacingBetweenView: false,
),
);
}
}
1