本文将介绍 Express Flutter 平台 SDK 版本升级至 3.0.0 以上版本时的说明和注意事项。
若从 2.22.0 或更早版本升级上来,请先查阅 v2.23.0_upgrade_guide_zh.md 文档。
-
废弃 ZegoScenario 场景枚举中的 [General], [Communication], [Live] 三种场景,详情请参考 场景化音视频配置 文档进行适配。
-
从这个版本开始,Express iOS SDK 不再支持 bitcode。
请参考 Apple Xcode 14 Release Notes 中关于废弃 bitcode 的说明。
适配方式:打开 Xcode 工程的配置页面,在 App Target 的 "Build Settings" 页面中找到 "Enable Bitcode" 选项,将其设置为 "No"。
变更下列接口和对象的使用方式
方法名/对象 | 描述 |
---|---|
isVideoEncoderSupported | 增加可选参数 codecBackend 用于指定的后端实现,修改返回值类型为int ; 0 表示不支持,不可以使用该编码格式进行推流;1 表示支持,可以使用该编码格式进行推流;2 表示未确认,建议稍后再调用本接口。 |
isVideoDecoderSupported | 增加可选参数 codecBackend 用于指定的后端实现,修改返回值类型为int ; 0 表示不支持,不可以使用该编码格式进行推流;1 表示支持,可以使用该编码格式进行推流;2 表示未确认,建议稍后再调用本接口。 |
ZegoCDNConfig | authParam 参数改为可选参数,增加可选参数 protocol 用于指定URL 支持的协议。如果有多个,用英文的逗号分割,按顺序尝试;增加可选参数 quicVersion 表示 QUIC 版本。如果 [protocol] 有 QUIC 协议,需要填写该信息。如果有多个版本号,用英文的逗号分割。 |
您可以参考以下示例代码进行接口和对象变更。
bool isSupport = await ZegoExpressEngine.instance.isVideoEncoderSupported(ZegoVideoCodecID.H265);
if (isSupport) {
// 支持H265
}
// 检查当前设备是否支持H265硬编码
int result = await ZegoExpressEngine.instance.isVideoEncoderSupported(ZegoVideoCodecID.H265, codecBackend: ZegoVideoCodecBackend.Hardware);
if (result == 1) {
// 支持H265硬编码
} else if (result == 2) {
// 表示未确认,建议稍后再调用本接口。sdk 内部还未拉取成功柔性配置建议稍后再调用本接口。
} else if (result == 0) {
// 不支持
}
bool isSupport = await ZegoExpressEngine.instance.isVideoDecoderSupported(ZegoVideoCodecID.H265);
if (isSupport) {
// 支持H265
}
// 检查当前设备是否支持H265硬解码
int result = await ZegoExpressEngine.instance.isVideoDecoderSupported(ZegoVideoCodecID.H265, codecBackend: ZegoVideoCodecBackend.Hardware);
if (result == 1) {
// 支持H265硬解码
} else if (result == 2) {
// 表示未确认,建议稍后再调用本接口。sdk 内部还未拉取成功柔性配置建议稍后再调用本接口。
} else if (result == 0) {
// 不支持
}
var config = ZegoCDNConfig('url', 'authParam');
var config = ZegoCDNConfig('url');
// 或者
var config = ZegoCDNConfig('url', authParam: 'authParam');
// 或者
var config = ZegoCDNConfig('url', authParam: 'authParam', protocol: 'protocol', quicVersion: 'quicVersion');
删除下列在先前版本已经废弃的接口
方法名 | 描述 |
---|---|
setDebugVerbose | 设置调试详细信息开关以及语言。此函数在 2.3.0 版本废弃,请使用 enableDebugAssistant 来实现原来的功能。 |
loginMultiRoom | 登录多房间。此方法在版本 2.9.0 以后已废弃,若需实现多房间功能,请先在引擎初始化之前调用 setRoomMode 函数设置多房间模式,再使用 loginRoom 登录多房间,如果调用 loginRoom 函数登录多房间,请确保传入相同的用户信息。 |
setPlayStreamVideoLayer | 设置选取拉流视频图层。此函数在 2.3.0 版本以后已废弃, 请使用 setPlayStreamVideoType 代替。 |
setBuiltInSpeakerOn | 是否使用内置扬声器播放声音。此函数在 2.3.0 版本以后已废弃,请使用 setAudioRouteToSpeaker 代替。 |
onDeviceError | 设备异常通知。此函数在 2.15.0 版本及以上已废弃,请使用 onLocalDeviceExceptionOccurred 代替。 |
您可以参考以下示例代码进行接口变更。
ZegoExpressEngine.instance.setDebugVerbose(true, ZegoLanguage.English);
// 注意,请勿在线上版本开启此功能!仅在开发阶段使用!
// Note, do not enable this feature in the online version! Use only during development phase!"
ZegoExpressEngine.instance.enableDebugAssistant(true);
ZegoExpressEngine.createEngineWithProfile(profile);
var user = ZegoUser.id("user1");
ZegoExpressEngine.instance.loginRoom("first_room", user);
ZegoExpressEngine.instance.loginMultiRoom("second_room");
// 必须在调用 [createEngine] 之前设置才生效,否则会失败。
// 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);
ZegoExpressEngine.instance.setPlayStreamVideoLayer("stream1", ZegoPlayerVideoLayer.Auto);
ZegoExpressEngine.instance.setPlayStreamVideoType("stream1", ZegoVideoStreamType.Default);
ZegoExpressEngine.instance.setBuiltInSpeakerOn(true);
ZegoExpressEngine.instance.setAudioRouteToSpeaker(true);
ZegoExpressEngine.onDeviceError(int errorCode, String deviceName) {
// Handle device error
// 处理设备错误
}
ZegoExpressEngine.onLocalDeviceExceptionOccurred(ZegoDeviceExceptionType exceptionType, ZegoDeviceType deviceType, String deviceID) {
// Handle device error
// 处理设备错误
}