logo
On this page

Set video resolution

If most of your users are using high-end smartphones and find the default 540p resolution not clear enough, you can set the resolution yourself using videoConfig.preset.

We provide the following resolution options:

Untitled

/// Video configuration resolution and bitrate preset enumeration.
enum ZegoVideoConfigPreset {
  /// Set the resolution to 320x180, the default is 15 fps, the code rate is 300 kbps
  Preset180P,

  /// Set the resolution to 480x270, the default is 15 fps, the code rate is 400 kbps
  Preset270P,

  /// Set the resolution to 640x360, the default is 15 fps, the code rate is 600 kbps
  Preset360P,

  /// Set the resolution to 960x540, the default is 15 fps, the code rate is 1200 kbps
  Preset540P,

  /// Set the resolution to 1280x720, the default is 15 fps, the code rate is 1500 kbps
  Preset720P,

  /// Set the resolution to 1920x1080, the default is 15 fps, the code rate is 3000 kbps
  Preset1080P
}
1
Copied!

Here is the reference code:

Untitled
class LivePage extends StatefulWidget {
  final String liveID;
  final bool isHost;

  const LivePage({
    Key? key,
    required this.liveID,
    this.isHost = false,
  }) : super(key: key);

  @override
  State<StatefulWidget> createState() => LivePageState();
}

class LivePageState extends State<LivePage> {
  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: ZegoUIKitPrebuiltLiveStreaming(
        appID: yourAppID /*input your AppID*/,
        appSign: yourAppSign /*input your AppSign*/,
        userID: 'userID',
        userName: 'userName',
        liveID: widget.liveID,
        config: (widget.isHost
            ? ZegoUIKitPrebuiltLiveStreamingConfig.host(
          plugins: [ZegoUIKitSignalingPlugin()],
        )
            : ZegoUIKitPrebuiltLiveStreamingConfig.audience(
          plugins: [ZegoUIKitSignalingPlugin()],
        ))
          ..video = ZegoUIKitVideoConfig.preset1080P(),
      ),
    );
  }
}
1
Copied!

On this page

Back to top