# Version 3.0.0 or above Upgrade Guide

This article details the instructions and precautions for upgrading the Express Flutter SDK version 3.0.0 or above+.

*If you are upgrading from version 2.22.0 or earlier, please refer to [v2.23.0_upgrade_guide.md](./v2.23.0_upgrade_guide.md)*

## Disposal Instructions

- [General], [Communication], and [Live] three scenarios in [ZegoScenario](https://pub.dev/documentation/zego_express_engine/latest/zego_express_engine/ZegoScenario.html) scenario enumeration are discarded. For details, please refer to [Scenario Audio and video configuration](https://doc-en.zego.im/article/15134 ) document for adaptation.

- Starting with this release, the Express iOS SDK no longer supports bitcode.

    Please refer to Apple's [Xcode 14 Release Notes](https://developer.apple.com/documentation/xcode-release-notes/xcode-14-release-notes#Deprecations) notes on deprecating bitcode.

    Adaptation method: Open the configuration page of the Xcode project, find the "Enable Bitcode" option in the "Build Settings" page of App Target, and set it to "No".

## Change Description

Changed usage of the following interfaces and objects.

method name/object | Describe
------------|---------
[isVideoEncoderSupported](https://pub.dev/documentation/zego_express_engine/latest/zego_express_engine/ZegoExpressEnginePublisher/isVideoEncoderSupported.html) | Add an optional parameter codecBackend for the specified backend implementation, and modify the return value type to int; 0 means not supported, and this encoding format cannot be used for streaming; 1 means supported, and this encoding format can be used for streaming; 2 means Unconfirmed, it is recommended to call this interface later.
[isVideoDecoderSupported](https://pub.dev/documentation/zego_express_engine/latest/zego_express_engine/ZegoExpressEnginePlayer/isVideoDecoderSupported.html) | Add an optional parameter codecBackend for the specified backend implementation, and modify the return value type to int; 0 means not supported, and this encoding format cannot be used for streaming; 1 means supported, and this encoding format can be used for streaming; 2 means Unconfirmed, it is recommended to call this interface later.
[ZegoCDNConfig](https://pub.dev/documentation/zego_express_engine/latest/zego_express_engine/ZegoCDNConfig/ZegoCDNConfig.html) | The authParam parameter is changed to an optional parameter, and the optional parameter protocol is added to specify the protocol supported by the URL. If there are more than one, separate them with English commas and try them in order; add an optional parameter quicVersion to indicate the QUIC version. If [protocol] has a QUIC protocol, this information needs to be filled in. If there are multiple version numbers, separate them with English commas.

## Sample Code

You can refer to the following sample code for interface and object changes.

### isVideoEncoderSupported

#### Below version 3.0.0

```dart
bool isSupport = await ZegoExpressEngine.instance.isVideoEncoderSupported(ZegoVideoCodecID.H265);
if (isSupport) {
    // Support H265
}
```

#### Version 3.0.0 or above

```dart
// Check whether the current device supports H265 hardcoding
int result = await ZegoExpressEngine.instance.isVideoEncoderSupported(ZegoVideoCodecID.H265, codecBackend: ZegoVideoCodecBackend.Hardware);
if (result == 1) {
    // Support H265 hardcoded
} else if (result == 2) {
    // Indicates unconfirmed, it is recommended to call this interface later. The flexible configuration has not been pulled successfully inside the sdk. It is recommended to call this interface later.
} else if (result == 0) {
    // Not support
}
```

### isVideoDecoderSupported

#### Below version 3.0.0

```dart
bool isSupport = await ZegoExpressEngine.instance.isVideoDecoderSupported(ZegoVideoCodecID.H265);
if (isSupport) {
    // Support H265
}
```

#### Version 3.0.0 or above 

```dart
// Check whether the current device supports H265 hard decoding
int result = await ZegoExpressEngine.instance.isVideoDecoderSupported(ZegoVideoCodecID.H265, codecBackend: ZegoVideoCodecBackend.Hardware);
if (result == 1) {
    // Support H265 hard decoding
} else if (result == 2) {
    // Indicates unconfirmed, it is recommended to call this interface later. The flexible configuration has not been pulled successfully inside the sdk. It is recommended to call this interface later.
} else if (result == 0) {
    // Not support
}
```

### ZegoCDNConfig

#### Below version 3.0.0

```dart
var config = ZegoCDNConfig('url', 'authParam');
```

#### Version 3.0.0 or above

```dart
var config = ZegoCDNConfig('url');
// or
var config = ZegoCDNConfig('url', authParam: 'authParam');
// or
var config = ZegoCDNConfig('url', authParam: 'authParam', protocol: 'protocol', quicVersion: 'quicVersion');
```

## Delete Instructions

Remove the following interfaces that were deprecated in previous versions.

method name | Describe
------------|---------
setDebugVerbose | Set the debug details switch and language. This function is deprecated in version 2.3.0, please use [enableDebugAssistant](https://pub.dev/documentation/zego_express_engine/latest/zego_express_engine/ZegoExpressEngine/enableDebugAssistant.html) to realize the original function.
loginMultiRoom | Sign in to multiroom. This method is obsolete after version 2.9.0. If you need to implement multi-room function, please call [setRoomMode](https://pub.dev/documentation/zego_express_engine/latest/zego_express_engine/ZegoExpressEngine/setRoomMode.html before engine initialization ) function to set the multi-room mode, and then use [loginRoom](https://pub.dev/documentation/zego_express_engine/latest/zego_express_engine/ZegoExpressEngineRoom/loginRoom.html) to log in to the multi-room, if calling [loginRoom](https://pub .dev/documentation/zego_express_engine/latest/zego_express_engine/ZegoExpressEngineRoom/loginRoom.html) function to log in to multi-room, please make sure to pass in the same user information.
setPlayStreamVideoLayer | Set the option to pull the streaming video layer. This function is deprecated after version 2.3.0, please use [setPlayStreamVideoType](https://pub.dev/documentation/zego_express_engine/latest/zego_express_engine/ZegoExpressEnginePlayer/setPlayStreamVideoType.html) instead.
setBuiltInSpeakerOn | Whether to use the built-in speaker to play sound. This function is deprecated after version 2.3.0, please use [setAudioRouteToSpeaker](https://pub.dev/documentation/zego_express_engine/latest/zego_express_engine/ZegoExpressEngineDevice/setAudioRouteToSpeaker.html) instead.
onDeviceError | Device exception notification. This function is deprecated in version 2.15.0 and above, please use [onLocalDeviceExceptionOccurred](https://pub.dev/documentation/zego_express_engine/latest/zego_express_engine/ZegoExpressEngine/onLocalDeviceExceptionOccurred.html) instead.

## Sample Code

You can refer to the following sample code for interface changes.

### setDebugVerbose

#### Below version 3.0.0 

```dart
ZegoExpressEngine.instance.setDebugVerbose(true, ZegoLanguage.English);
```

#### Version 3.0.0 or above

```dart
// Note, do not enable this feature in the online version! Use only during development phase!"
ZegoExpressEngine.instance.enableDebugAssistant(true);
```

### loginMultiRoom

#### Below version 3.0.0 

```dart
ZegoExpressEngine.createEngineWithProfile(profile);

var user = ZegoUser.id("user1");
ZegoExpressEngine.instance.loginRoom("first_room", user);
ZegoExpressEngine.instance.loginMultiRoom("second_room");
```

#### Version 3.0.0 or above

```dart
// Must be set before calling [createEngine] to take effect, otherwise it will fail.
ZegoExpressEngine.setRoomMode(ZegoRoomMode.MultiRoom);

ZegoExpressEngine.createEngineWithProfile(profile);

var user = ZegoUser.id("user1");
ZegoExpressEngine.instance.loginRoom("first_room", user);
ZegoExpressEngine.instance.loginRoom("second_room", user);
```

### setPlayStreamVideoLayer

#### Below version 3.0.0 

```dart
ZegoExpressEngine.instance.setPlayStreamVideoLayer("stream1", ZegoPlayerVideoLayer.Auto);
```

#### Version 3.0.0 or above

```dart
ZegoExpressEngine.instance.setPlayStreamVideoType("stream1", ZegoVideoStreamType.Default);
```

### setBuiltInSpeakerOn

#### Below version 3.0.0 

```dart
ZegoExpressEngine.instance.setBuiltInSpeakerOn(true);
```

#### Version 3.0.0 or above

```dart
ZegoExpressEngine.instance.setAudioRouteToSpeaker(true);
```

### onDeviceError

#### Below version 3.0.0 

```dart
ZegoExpressEngine.onDeviceError(int errorCode, String deviceName) {
    // Handle device error
}
```

#### Version 3.0.0 or above

```dart
ZegoExpressEngine.onLocalDeviceExceptionOccurred(ZegoDeviceExceptionType exceptionType, ZegoDeviceType deviceType, String deviceID) {
    // Handle device error
}
```