create static method
Future<JCMediaChannel>
create(
- JCClient client,
- JCMediaDevice mediaDevice,
- JCMediaChannelCallback callback
创建 JCMediaChannel 对象
JCMediaChannel 的所有接口函数,如无特殊说明,都建议在主线程调用
@note
- 调用此方法创建 JCMediaChannel 对象后,期间没有调用过 @ref destroy 方法销毁对象,然后又重复调用此方法,会直接返回第一次创建的 JCMediaChannel 对象
- 调用此方法前确保 JCClient 已完成初始化,即 @ref JCClient.getState "getState" 方法获取的状态值不等于 @ref JCClient.STATE_NOT_INIT "STATE_NOT_INIT"
client JCClient 对象
mediaDevice JCMediaDevice 对象
callback JCMediaChannelCallback 对象,用于回调相关通知
@return JCMediaChannel 对象
@exception "JCClient、JCMediaDevice、JCMediaChannelCallback 任意参数为空就会抛出异常"
Implementation
static Future<JCMediaChannel> create(JCClient client,
JCMediaDevice mediaDevice, JCMediaChannelCallback callback) async {
if (_sMediaChannel == null) {
_sMediaChannel = new JCMediaChannelImpl();
}
bool result = await _sMediaChannel!
.createNativeJCMediaChannel(client, mediaDevice, callback);
if (result) {
return _sMediaChannel!;
} else {
return Future.error("createNativeJCMediaChannel exception");
}
}