diff --git a/example/lib/examples/advanced/multi_channel.dart b/example/lib/examples/advanced/multi_channel.dart index 3e3171f3f..40dca9471 100644 --- a/example/lib/examples/advanced/multi_channel.dart +++ b/example/lib/examples/advanced/multi_channel.dart @@ -235,7 +235,7 @@ class _State extends State { return Expanded( child: Stack( children: [ - RtcLocalView.TextureView( + RtcLocalView.SurfaceView( channelId: renderChannelId, ), if (remoteUid != null) @@ -248,7 +248,7 @@ class _State extends State { (e) => Container( width: 120, height: 120, - child: RtcRemoteView.TextureView( + child: RtcRemoteView.SurfaceView( uid: e, channelId: renderChannelId, ), diff --git a/example/lib/examples/basic/join_channel_video.dart b/example/lib/examples/basic/join_channel_video.dart index 127f4c7ad..d7ad8a1ea 100644 --- a/example/lib/examples/basic/join_channel_video.dart +++ b/example/lib/examples/basic/join_channel_video.dart @@ -173,7 +173,8 @@ class _State extends State { return Expanded( child: Stack( children: [ - if (startPreview) RtcLocalView.TextureView(), + if (startPreview) + kIsWeb ? RtcLocalView.SurfaceView() : RtcLocalView.TextureView(), Align( alignment: Alignment.topLeft, child: SingleChildScrollView( @@ -185,10 +186,15 @@ class _State extends State { child: Container( width: 120, height: 120, - child: RtcRemoteView.TextureView( - uid: e, - channelId: channelId, - ), + child: kIsWeb + ? RtcRemoteView.SurfaceView( + uid: e, + channelId: channelId, + ) + : RtcRemoteView.TextureView( + uid: e, + channelId: channelId, + ), ), ), )), diff --git a/lib/rtc_local_view.dart b/lib/rtc_local_view.dart index 63342f818..9074633ef 100644 --- a/lib/rtc_local_view.dart +++ b/lib/rtc_local_view.dart @@ -41,6 +41,7 @@ class TextureView extends RtcTextureView { mirrorMode = VideoMirrorMode.Disabled, PlatformViewCreatedCallback? onPlatformViewCreated, Set>? gestureRecognizers, + useFlutterTexture = true, }) : super( key: key, uid: 0, @@ -49,5 +50,6 @@ class TextureView extends RtcTextureView { mirrorMode: mirrorMode, onPlatformViewCreated: onPlatformViewCreated, gestureRecognizers: gestureRecognizers, + useFlutterTexture: useFlutterTexture, ); } diff --git a/lib/rtc_remote_view.dart b/lib/rtc_remote_view.dart index 8e6c1d34b..bba526152 100644 --- a/lib/rtc_remote_view.dart +++ b/lib/rtc_remote_view.dart @@ -43,6 +43,7 @@ class TextureView extends RtcTextureView { mirrorMode = VideoMirrorMode.Auto, PlatformViewCreatedCallback? onPlatformViewCreated, Set>? gestureRecognizers, + useFlutterTexture = true, }) : assert(uid != 0), super( key: key, @@ -52,5 +53,6 @@ class TextureView extends RtcTextureView { mirrorMode: mirrorMode, onPlatformViewCreated: onPlatformViewCreated, gestureRecognizers: gestureRecognizers, + useFlutterTexture: useFlutterTexture, ); } diff --git a/lib/src/events.dart b/lib/src/events.dart index 44cd02d31..45c4942a1 100644 --- a/lib/src/events.dart +++ b/lib/src/events.dart @@ -1,6 +1,8 @@ import 'dart:convert'; import 'dart:io'; +import 'package:flutter/foundation.dart'; + import 'classes.dart'; import 'enum_converter.dart'; import 'enums.dart'; @@ -1101,7 +1103,7 @@ class RtcEngineEventHandler { // ignore: public_member_api_docs void process(String methodName, dynamic data) { List newData; - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { methodName = methodName.substring(2); newData = List.from( Map.from(jsonDecode(data as String)).values); @@ -1840,7 +1842,7 @@ class RtcChannelEventHandler { // ignore: public_member_api_docs void process(String methodName, dynamic data) { List newData; - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { methodName = methodName.substring(2); newData = List.from( Map.from(jsonDecode(data as String)).values); diff --git a/lib/src/rtc_channel.dart b/lib/src/rtc_channel.dart index 2ca25bb08..09c4b1dda 100644 --- a/lib/src/rtc_channel.dart +++ b/lib/src/rtc_channel.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'dart:convert'; import 'dart:io'; +import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; import 'classes.dart'; @@ -95,7 +96,7 @@ class RtcChannel with RtcChannelInterface { /// - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "\[", "\]", "^", "_", " {", "}", "|", "~", ",". static Future create(String channelId) async { if (_channels.containsKey(channelId)) return _channels[channelId]!; - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { await _methodChannel.invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelCreateChannel.index, 'params': jsonEncode({'channelId': channelId}) @@ -111,7 +112,7 @@ class RtcChannel with RtcChannelInterface { static void destroyAll() { _channels.forEach((key, value) async { value._handler = null; - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { await value._invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelRelease.index, 'params': jsonEncode({'channelId': value.channelId}) @@ -127,7 +128,7 @@ class RtcChannel with RtcChannelInterface { Future destroy() { _handler = null; _channels.remove(channelId); - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelRelease.index, 'params': jsonEncode({'channelId': channelId}) @@ -148,7 +149,7 @@ class RtcChannel with RtcChannelInterface { final methodName = eventMap['methodName'] as String; var data = eventMap['data']; String channelId; - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { final map = Map.from(jsonDecode(data)); channelId = map.remove('channelId'); data = jsonEncode(map); @@ -161,7 +162,7 @@ class RtcChannel with RtcChannelInterface { @override Future setClientRole(ClientRole role, [ClientRoleOptions? options]) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelSetClientRole.index, 'params': jsonEncode({ @@ -180,7 +181,7 @@ class RtcChannel with RtcChannelInterface { @override Future joinChannel(String? token, String? optionalInfo, int optionalUid, ChannelMediaOptions options) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelJoinChannel.index, 'params': jsonEncode({ @@ -203,7 +204,7 @@ class RtcChannel with RtcChannelInterface { @override Future joinChannelWithUserAccount( String? token, String userAccount, ChannelMediaOptions options) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelJoinChannelWithUserAccount.index, 'params': jsonEncode({ @@ -223,7 +224,7 @@ class RtcChannel with RtcChannelInterface { @override Future leaveChannel() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelLeaveChannel.index, 'params': jsonEncode({'channelId': channelId}) @@ -234,7 +235,7 @@ class RtcChannel with RtcChannelInterface { @override Future renewToken(String token) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelRenewToken.index, 'params': jsonEncode({'channelId': channelId, 'token': token}) @@ -245,7 +246,7 @@ class RtcChannel with RtcChannelInterface { @override Future getConnectionState() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelGetConnectionState.index, 'params': jsonEncode({'channelId': channelId}) @@ -260,7 +261,7 @@ class RtcChannel with RtcChannelInterface { @override Future publish() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelPublish.index, 'params': jsonEncode({'channelId': channelId}) @@ -271,7 +272,7 @@ class RtcChannel with RtcChannelInterface { @override Future unpublish() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelUnPublish.index, 'params': jsonEncode({'channelId': channelId}) @@ -282,7 +283,7 @@ class RtcChannel with RtcChannelInterface { @override Future getCallId() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelGetCallId.index, 'params': jsonEncode({'channelId': channelId}) @@ -293,7 +294,7 @@ class RtcChannel with RtcChannelInterface { @override Future adjustUserPlaybackSignalVolume(int uid, int volume) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelAdjustUserPlaybackSignalVolume.index, 'params': @@ -306,7 +307,7 @@ class RtcChannel with RtcChannelInterface { @override Future muteAllRemoteAudioStreams(bool muted) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelMuteAllRemoteAudioStreams.index, 'params': jsonEncode({'channelId': channelId, 'mute': muted}) @@ -317,7 +318,7 @@ class RtcChannel with RtcChannelInterface { @override Future muteRemoteAudioStream(int uid, bool muted) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelMuteRemoteAudioStream.index, 'params': @@ -330,7 +331,7 @@ class RtcChannel with RtcChannelInterface { @override @deprecated Future setDefaultMuteAllRemoteAudioStreams(bool muted) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelSetDefaultMuteAllRemoteAudioStreams.index, @@ -343,7 +344,7 @@ class RtcChannel with RtcChannelInterface { @override Future muteAllRemoteVideoStreams(bool muted) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelMuteAllRemoteVideoStreams.index, 'params': jsonEncode({'channelId': channelId, 'mute': muted}) @@ -354,7 +355,7 @@ class RtcChannel with RtcChannelInterface { @override Future muteRemoteVideoStream(int uid, bool muted) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelMuteRemoteVideoStream.index, 'params': @@ -367,7 +368,7 @@ class RtcChannel with RtcChannelInterface { @override @deprecated Future setDefaultMuteAllRemoteVideoStreams(bool muted) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelSetDefaultMuteAllRemoteVideoStreams.index, @@ -380,7 +381,7 @@ class RtcChannel with RtcChannelInterface { @override Future addInjectStreamUrl(String url, LiveInjectStreamConfig config) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelAddInjectStreamUrl.index, 'params': jsonEncode( @@ -393,7 +394,7 @@ class RtcChannel with RtcChannelInterface { @override Future addPublishStreamUrl(String url, bool transcodingEnabled) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelAddPublishStreamUrl.index, 'params': jsonEncode({ @@ -410,7 +411,7 @@ class RtcChannel with RtcChannelInterface { @override @deprecated Future createDataStream(bool reliable, bool ordered) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelCreateDataStream.index, 'params': jsonEncode( @@ -423,7 +424,7 @@ class RtcChannel with RtcChannelInterface { @override Future registerMediaMetadataObserver() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelRegisterMediaMetadataObserver.index, 'params': jsonEncode({'channelId': channelId}) @@ -434,7 +435,7 @@ class RtcChannel with RtcChannelInterface { @override Future removeInjectStreamUrl(String url) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelRemoveInjectStreamUrl.index, 'params': jsonEncode({'channelId': channelId, 'url': url}) @@ -445,7 +446,7 @@ class RtcChannel with RtcChannelInterface { @override Future removePublishStreamUrl(String url) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelRemovePublishStreamUrl.index, 'params': jsonEncode({'channelId': channelId, 'url': url}) @@ -456,7 +457,7 @@ class RtcChannel with RtcChannelInterface { @override Future sendMetadata(String metadata) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApiWithBuffer', { 'apiType': _ApiTypeChannel.kChannelSendMetadata.index, 'params': jsonEncode({ @@ -471,7 +472,7 @@ class RtcChannel with RtcChannelInterface { @override Future sendStreamMessage(int streamId, String message) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApiWithBuffer', { 'apiType': _ApiTypeChannel.kChannelSendStreamMessage.index, 'params': jsonEncode({ @@ -489,7 +490,7 @@ class RtcChannel with RtcChannelInterface { @override @deprecated Future setEncryptionMode(EncryptionMode encryptionMode) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelSetEncryptionMode.index, 'params': jsonEncode({ @@ -505,7 +506,7 @@ class RtcChannel with RtcChannelInterface { @override @deprecated Future setEncryptionSecret(String secret) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelSetEncryptionSecret.index, 'params': jsonEncode({'channelId': channelId, 'secret': secret}) @@ -516,7 +517,7 @@ class RtcChannel with RtcChannelInterface { @override Future setLiveTranscoding(LiveTranscoding transcoding) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelSetLiveTranscoding.index, 'params': jsonEncode( @@ -529,7 +530,7 @@ class RtcChannel with RtcChannelInterface { @override Future setMaxMetadataSize(int size) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelSetMaxMetadataSize.index, 'params': jsonEncode({'channelId': channelId, 'size': size}) @@ -540,7 +541,7 @@ class RtcChannel with RtcChannelInterface { @override Future setRemoteDefaultVideoStreamType(VideoStreamType streamType) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelSetRemoteDefaultVideoStreamType.index, @@ -556,7 +557,7 @@ class RtcChannel with RtcChannelInterface { @override Future setRemoteUserPriority(int uid, UserPriority userPriority) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelSetRemoteUserPriority.index, 'params': jsonEncode({ @@ -574,7 +575,7 @@ class RtcChannel with RtcChannelInterface { @override Future setRemoteVideoStreamType(int uid, VideoStreamType streamType) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelSetRemoteVideoStreamType.index, 'params': jsonEncode({ @@ -592,7 +593,7 @@ class RtcChannel with RtcChannelInterface { @override Future setRemoteVoicePosition(int uid, double pan, double gain) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelSetRemoteVoicePosition.index, 'params': jsonEncode( @@ -606,7 +607,7 @@ class RtcChannel with RtcChannelInterface { @override Future startChannelMediaRelay( ChannelMediaRelayConfiguration channelMediaRelayConfiguration) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelStartChannelMediaRelay.index, 'params': jsonEncode({ @@ -622,7 +623,7 @@ class RtcChannel with RtcChannelInterface { @override Future stopChannelMediaRelay() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelStopChannelMediaRelay.index, 'params': jsonEncode({'channelId': channelId}) @@ -633,7 +634,7 @@ class RtcChannel with RtcChannelInterface { @override Future unregisterMediaMetadataObserver() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelUnRegisterMediaMetadataObserver.index, @@ -646,7 +647,7 @@ class RtcChannel with RtcChannelInterface { @override Future updateChannelMediaRelay( ChannelMediaRelayConfiguration channelMediaRelayConfiguration) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelUpdateChannelMediaRelay.index, 'params': jsonEncode({ @@ -662,7 +663,7 @@ class RtcChannel with RtcChannelInterface { @override Future enableEncryption(bool enabled, EncryptionConfig config) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelEnableEncryption.index, 'params': jsonEncode({ @@ -678,7 +679,7 @@ class RtcChannel with RtcChannelInterface { @override Future createDataStreamWithConfig(DataStreamConfig config) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelCreateDataStream.index, 'params': @@ -690,7 +691,7 @@ class RtcChannel with RtcChannelInterface { @override Future enableRemoteSuperResolution(int uid, bool enable) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeChannel.kChannelEnableRemoteSuperResolution.index, 'params': diff --git a/lib/src/rtc_engine.dart b/lib/src/rtc_engine.dart index f9886a6af..23892b93f 100644 --- a/lib/src/rtc_engine.dart +++ b/lib/src/rtc_engine.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'dart:convert'; import 'dart:io'; +import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; import 'classes.dart'; @@ -208,7 +209,7 @@ class RtcEngine with RtcEngineInterface { /// /// The version of the current SDK in the string format. For example, 2.3.0. static Future getSdkVersion() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineGetVersion.index, 'params': jsonEncode({}) @@ -227,7 +228,7 @@ class RtcEngine with RtcEngineInterface { /// /// [WarningCode] or [ErrorCode]. static Future getErrorDescription(int error) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineGetErrorDescription.index, 'params': jsonEncode({'code': error}) @@ -306,7 +307,7 @@ class RtcEngine with RtcEngineInterface { /// - [ErrorCode.InvalidAppId] static Future createWithConfig(RtcEngineConfig config) async { if (_engine != null) return _engine!; - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { await _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineInitialize.index, 'params': jsonEncode({'context': config.toJson()}) @@ -327,7 +328,7 @@ class RtcEngine with RtcEngineInterface { RtcChannel.destroyAll(); _engine?._handler = null; _engine = null; - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineRelease.index, 'params': jsonEncode({}) @@ -353,7 +354,7 @@ class RtcEngine with RtcEngineInterface { @override Future setChannelProfile(ChannelProfile profile) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetChannelProfile.index, 'params': @@ -366,7 +367,7 @@ class RtcEngine with RtcEngineInterface { @override Future setClientRole(ClientRole role, [ClientRoleOptions? options]) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetClientRole.index, 'params': jsonEncode({ @@ -385,7 +386,7 @@ class RtcEngine with RtcEngineInterface { Future joinChannel( String? token, String channelName, String? optionalInfo, int optionalUid, [ChannelMediaOptions? options]) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineJoinChannel.index, 'params': jsonEncode({ @@ -409,7 +410,7 @@ class RtcEngine with RtcEngineInterface { @override Future switchChannel(String? token, String channelName, [ChannelMediaOptions? options]) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSwitchChannel.index, 'params': jsonEncode({ @@ -428,7 +429,7 @@ class RtcEngine with RtcEngineInterface { @override Future leaveChannel() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineLeaveChannel.index, 'params': jsonEncode({}) @@ -439,7 +440,7 @@ class RtcEngine with RtcEngineInterface { @override Future renewToken(String token) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineRenewToken.index, 'params': jsonEncode({'token': token}) @@ -451,7 +452,7 @@ class RtcEngine with RtcEngineInterface { @override @deprecated Future enableWebSdkInteroperability(bool enabled) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineEnableWebSdkInteroperability.index, 'params': jsonEncode({'enabled': enabled}) @@ -462,7 +463,7 @@ class RtcEngine with RtcEngineInterface { @override Future getConnectionState() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineGetConnectionState.index, 'params': jsonEncode({}) @@ -477,7 +478,7 @@ class RtcEngine with RtcEngineInterface { @override Future getCallId() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineGetCallId.index, 'params': jsonEncode({}) @@ -488,7 +489,7 @@ class RtcEngine with RtcEngineInterface { @override Future rate(String callId, int rating, {String? description}) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineRate.index, 'params': jsonEncode( @@ -501,7 +502,7 @@ class RtcEngine with RtcEngineInterface { @override Future complain(String callId, String description) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineComplain.index, 'params': jsonEncode({'callId': callId, 'description': description}) @@ -514,7 +515,7 @@ class RtcEngine with RtcEngineInterface { @override @deprecated Future setLogFile(String filePath) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetLogFile.index, 'params': jsonEncode({'filePath': filePath}) @@ -526,7 +527,7 @@ class RtcEngine with RtcEngineInterface { @override @deprecated Future setLogFilter(LogFilter filter) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetLogFilter.index, 'params': jsonEncode({'filter': LogFilterConverter(filter).value()}) @@ -539,7 +540,7 @@ class RtcEngine with RtcEngineInterface { @override @deprecated Future setLogFileSize(int fileSizeInKBytes) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetLogFileSize.index, 'params': jsonEncode({'fileSizeInKBytes': fileSizeInKBytes}) @@ -551,7 +552,7 @@ class RtcEngine with RtcEngineInterface { @override Future setParameters(String parameters) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetParameters.index, 'params': jsonEncode({'parameters': parameters}) @@ -562,7 +563,7 @@ class RtcEngine with RtcEngineInterface { @override Future getUserInfoByUid(int uid) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineGetUserInfoByUid.index, 'params': jsonEncode({'uid': uid}) @@ -577,7 +578,7 @@ class RtcEngine with RtcEngineInterface { @override Future getUserInfoByUserAccount(String userAccount) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineGetUserInfoByUserAccount.index, 'params': jsonEncode({'userAccount': userAccount}) @@ -595,7 +596,7 @@ class RtcEngine with RtcEngineInterface { Future joinChannelWithUserAccount( String? token, String channelName, String userAccount, [ChannelMediaOptions? options]) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineJoinChannelWithUserAccount.index, 'params': jsonEncode({ @@ -616,7 +617,7 @@ class RtcEngine with RtcEngineInterface { @override Future registerLocalUserAccount(String appId, String userAccount) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineRegisterLocalUserAccount.index, 'params': jsonEncode({'appId': appId, 'userAccount': userAccount}) @@ -628,7 +629,7 @@ class RtcEngine with RtcEngineInterface { @override Future adjustPlaybackSignalVolume(int volume) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineAdjustPlaybackSignalVolume.index, 'params': jsonEncode({'volume': volume}) @@ -639,7 +640,7 @@ class RtcEngine with RtcEngineInterface { @override Future adjustRecordingSignalVolume(int volume) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineAdjustRecordingSignalVolume.index, 'params': jsonEncode({'volume': volume}) @@ -650,7 +651,7 @@ class RtcEngine with RtcEngineInterface { @override Future adjustUserPlaybackSignalVolume(int uid, int volume) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineAdjustUserPlaybackSignalVolume.index, 'params': jsonEncode({'uid': uid, 'volume': volume}) @@ -662,7 +663,7 @@ class RtcEngine with RtcEngineInterface { @override Future disableAudio() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineDisableAudio.index, 'params': jsonEncode({}) @@ -673,7 +674,7 @@ class RtcEngine with RtcEngineInterface { @override Future enableAudio() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineEnableAudio.index, 'params': jsonEncode({}) @@ -685,7 +686,7 @@ class RtcEngine with RtcEngineInterface { @override Future enableAudioVolumeIndication( int interval, int smooth, bool report_vad) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineEnableAudioVolumeIndication.index, 'params': jsonEncode( @@ -698,7 +699,7 @@ class RtcEngine with RtcEngineInterface { @override Future enableLocalAudio(bool enabled) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineEnableLocalAudio.index, 'params': jsonEncode({'enabled': enabled}) @@ -709,7 +710,7 @@ class RtcEngine with RtcEngineInterface { @override Future muteAllRemoteAudioStreams(bool muted) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineMuteAllRemoteAudioStreams.index, 'params': jsonEncode({'mute': muted}) @@ -720,7 +721,7 @@ class RtcEngine with RtcEngineInterface { @override Future muteLocalAudioStream(bool muted) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineMuteLocalAudioStream.index, 'params': jsonEncode({'mute': muted}) @@ -731,7 +732,7 @@ class RtcEngine with RtcEngineInterface { @override Future muteRemoteAudioStream(int uid, bool muted) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineMuteRemoteAudioStream.index, 'params': jsonEncode({'userId': uid, 'mute': muted}) @@ -742,7 +743,7 @@ class RtcEngine with RtcEngineInterface { @override Future setAudioProfile(AudioProfile profile, AudioScenario scenario) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetAudioProfile.index, 'params': jsonEncode({ @@ -760,7 +761,7 @@ class RtcEngine with RtcEngineInterface { @override @deprecated Future setDefaultMuteAllRemoteAudioStreams(bool muted) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetDefaultMuteAllRemoteAudioStreams.index, @@ -773,7 +774,7 @@ class RtcEngine with RtcEngineInterface { @override Future disableVideo() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineDisableVideo.index, 'params': jsonEncode({}) @@ -784,7 +785,7 @@ class RtcEngine with RtcEngineInterface { @override Future enableLocalVideo(bool enabled) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineEnableLocalVideo.index, 'params': jsonEncode({'enabled': enabled}) @@ -795,7 +796,7 @@ class RtcEngine with RtcEngineInterface { @override Future enableVideo() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineEnableVideo.index, 'params': jsonEncode({}) @@ -806,7 +807,7 @@ class RtcEngine with RtcEngineInterface { @override Future muteAllRemoteVideoStreams(bool muted) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineMuteAllRemoteVideoStreams.index, 'params': jsonEncode({'mute': muted}) @@ -817,7 +818,7 @@ class RtcEngine with RtcEngineInterface { @override Future muteLocalVideoStream(bool muted) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineMuteLocalVideoStream.index, 'params': jsonEncode({'mute': muted}) @@ -828,7 +829,7 @@ class RtcEngine with RtcEngineInterface { @override Future muteRemoteVideoStream(int uid, bool muted) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineMuteRemoteVideoStream.index, 'params': jsonEncode({'userId': uid, 'mute': muted}) @@ -839,7 +840,7 @@ class RtcEngine with RtcEngineInterface { @override Future setBeautyEffectOptions(bool enabled, BeautyOptions options) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetBeautyEffectOptions.index, 'params': jsonEncode({'enabled': enabled, 'options': options.toJson()}) @@ -852,7 +853,7 @@ class RtcEngine with RtcEngineInterface { @override @deprecated Future setDefaultMuteAllRemoteVideoStreams(bool muted) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetDefaultMuteAllRemoteVideoStreams.index, @@ -865,7 +866,7 @@ class RtcEngine with RtcEngineInterface { @override Future setVideoEncoderConfiguration(VideoEncoderConfiguration config) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetVideoEncoderConfiguration.index, 'params': jsonEncode({'config': config.toJson()}) @@ -877,7 +878,7 @@ class RtcEngine with RtcEngineInterface { @override Future startPreview() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineStartPreview.index, 'params': jsonEncode({}) @@ -888,7 +889,7 @@ class RtcEngine with RtcEngineInterface { @override Future stopPreview() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineStopPreview.index, 'params': jsonEncode({}) @@ -899,7 +900,7 @@ class RtcEngine with RtcEngineInterface { @override Future adjustAudioMixingPlayoutVolume(int volume) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineAdjustAudioMixingPlayoutVolume.index, 'params': jsonEncode({'volume': volume}) @@ -910,7 +911,7 @@ class RtcEngine with RtcEngineInterface { @override Future adjustAudioMixingPublishVolume(int volume) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineAdjustAudioMixingPublishVolume.index, 'params': jsonEncode({'volume': volume}) @@ -921,7 +922,7 @@ class RtcEngine with RtcEngineInterface { @override Future adjustAudioMixingVolume(int volume) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineAdjustAudioMixingVolume.index, 'params': jsonEncode({'volume': volume}) @@ -932,7 +933,7 @@ class RtcEngine with RtcEngineInterface { @override Future getAudioMixingCurrentPosition() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineGetAudioMixingCurrentPosition.index, 'params': jsonEncode({}) @@ -943,7 +944,7 @@ class RtcEngine with RtcEngineInterface { @override Future getAudioMixingDuration([String? filePath]) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineGetAudioMixingDuration.index, 'params': jsonEncode({}) @@ -956,7 +957,7 @@ class RtcEngine with RtcEngineInterface { @override Future getAudioMixingPlayoutVolume() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineGetAudioMixingPlayoutVolume.index, 'params': jsonEncode({}) @@ -967,7 +968,7 @@ class RtcEngine with RtcEngineInterface { @override Future getAudioMixingPublishVolume() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineGetAudioMixingPublishVolume.index, 'params': jsonEncode({}) @@ -978,7 +979,7 @@ class RtcEngine with RtcEngineInterface { @override Future pauseAudioMixing() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEnginePauseAudioMixing.index, 'params': jsonEncode({}) @@ -989,7 +990,7 @@ class RtcEngine with RtcEngineInterface { @override Future resumeAudioMixing() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineResumeAudioMixing.index, 'params': jsonEncode({}) @@ -1000,7 +1001,7 @@ class RtcEngine with RtcEngineInterface { @override Future setAudioMixingPosition(int pos) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetAudioMixingPosition.index, 'params': jsonEncode({'pos': pos}) @@ -1013,7 +1014,7 @@ class RtcEngine with RtcEngineInterface { Future startAudioMixing( String filePath, bool loopback, bool replace, int cycle, [int? startPos]) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineStartAudioMixing.index, 'params': jsonEncode({ @@ -1035,7 +1036,7 @@ class RtcEngine with RtcEngineInterface { @override Future stopAudioMixing() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineStopAudioMixing.index, 'params': jsonEncode({}) @@ -1046,7 +1047,7 @@ class RtcEngine with RtcEngineInterface { @override Future addInjectStreamUrl(String url, LiveInjectStreamConfig config) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineAddInjectStreamUrl.index, 'params': jsonEncode({'url': url, 'config': config.toJson()}) @@ -1058,7 +1059,7 @@ class RtcEngine with RtcEngineInterface { @override Future addPublishStreamUrl(String url, bool transcodingEnabled) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineAddPublishStreamUrl.index, 'params': @@ -1072,7 +1073,7 @@ class RtcEngine with RtcEngineInterface { @override Future addVideoWatermark( String watermarkUrl, WatermarkOptions options) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineAddVideoWaterMark.index, 'params': jsonEncode( @@ -1085,7 +1086,7 @@ class RtcEngine with RtcEngineInterface { @override Future clearVideoWatermarks() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineClearVideoWaterMarks.index, 'params': jsonEncode({}) @@ -1096,7 +1097,7 @@ class RtcEngine with RtcEngineInterface { @override Future createDataStream(bool reliable, bool ordered) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineCreateDataStream.index, 'params': jsonEncode({'reliable': reliable, 'ordered': ordered}) @@ -1108,7 +1109,7 @@ class RtcEngine with RtcEngineInterface { @override Future disableLastmileTest() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineDisableLastMileTest.index, 'params': jsonEncode({}) @@ -1119,7 +1120,7 @@ class RtcEngine with RtcEngineInterface { @override Future enableDualStreamMode(bool enabled) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineEnableDualStreamMode.index, 'params': jsonEncode({'enabled': enabled}) @@ -1130,7 +1131,7 @@ class RtcEngine with RtcEngineInterface { @override Future enableInEarMonitoring(bool enabled) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineEnableInEarMonitoring.index, 'params': jsonEncode({'enabled': enabled}) @@ -1141,7 +1142,7 @@ class RtcEngine with RtcEngineInterface { @override Future enableLastmileTest() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineEnableLastMileTest.index, 'params': jsonEncode({}) @@ -1152,7 +1153,7 @@ class RtcEngine with RtcEngineInterface { @override Future enableSoundPositionIndication(bool enabled) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineEnableSoundPositionIndication.index, 'params': jsonEncode({'enabled': enabled}) @@ -1163,7 +1164,7 @@ class RtcEngine with RtcEngineInterface { @override Future getCameraMaxZoomFactor() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { throw PlatformException(code: ErrorCode.NotSupported.toString()); } return _invokeMethod('getCameraMaxZoomFactor'); @@ -1171,7 +1172,7 @@ class RtcEngine with RtcEngineInterface { @override Future getEffectsVolume() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineGetEffectsVolume.index, 'params': jsonEncode({}) @@ -1182,7 +1183,7 @@ class RtcEngine with RtcEngineInterface { @override Future isCameraAutoFocusFaceModeSupported() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { throw PlatformException(code: ErrorCode.NotSupported.toString()); } return _invokeMethod('isCameraAutoFocusFaceModeSupported'); @@ -1190,7 +1191,7 @@ class RtcEngine with RtcEngineInterface { @override Future isCameraExposurePositionSupported() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { throw PlatformException(code: ErrorCode.NotSupported.toString()); } return _invokeMethod('isCameraExposurePositionSupported'); @@ -1198,7 +1199,7 @@ class RtcEngine with RtcEngineInterface { @override Future isCameraFocusSupported() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { throw PlatformException(code: ErrorCode.NotSupported.toString()); } return _invokeMethod('isCameraFocusSupported'); @@ -1206,7 +1207,7 @@ class RtcEngine with RtcEngineInterface { @override Future isCameraTorchSupported() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { throw PlatformException(code: ErrorCode.NotSupported.toString()); } return _invokeMethod('isCameraTorchSupported'); @@ -1214,7 +1215,7 @@ class RtcEngine with RtcEngineInterface { @override Future isCameraZoomSupported() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { throw PlatformException(code: ErrorCode.NotSupported.toString()); } return _invokeMethod('isCameraZoomSupported'); @@ -1222,7 +1223,7 @@ class RtcEngine with RtcEngineInterface { @override Future isSpeakerphoneEnabled() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineIsSpeakerPhoneEnabled.index, 'params': jsonEncode({}) @@ -1233,7 +1234,7 @@ class RtcEngine with RtcEngineInterface { @override Future pauseAllEffects() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEnginePauseAllEffects.index, 'params': jsonEncode({}) @@ -1244,7 +1245,7 @@ class RtcEngine with RtcEngineInterface { @override Future pauseEffect(int soundId) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEnginePauseEffect.index, 'params': jsonEncode({'soundId': soundId}) @@ -1257,7 +1258,7 @@ class RtcEngine with RtcEngineInterface { Future playEffect(int soundId, String filePath, int loopCount, double pitch, double pan, double gain, bool publish, [int? startPos]) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEnginePlayEffect.index, 'params': jsonEncode({ @@ -1300,7 +1301,7 @@ class RtcEngine with RtcEngineInterface { @override Future preloadEffect(int soundId, String filePath) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEnginePreloadEffect.index, 'params': jsonEncode({'soundId': soundId, 'filePath': filePath}) @@ -1312,7 +1313,7 @@ class RtcEngine with RtcEngineInterface { @override Future registerMediaMetadataObserver() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineRegisterMediaMetadataObserver.index, 'params': jsonEncode({}) @@ -1323,7 +1324,7 @@ class RtcEngine with RtcEngineInterface { @override Future removeInjectStreamUrl(String url) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineRemoveInjectStreamUrl.index, 'params': jsonEncode({'url': url}) @@ -1334,7 +1335,7 @@ class RtcEngine with RtcEngineInterface { @override Future removePublishStreamUrl(String url) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineRemovePublishStreamUrl.index, 'params': jsonEncode({'url': url}) @@ -1345,7 +1346,7 @@ class RtcEngine with RtcEngineInterface { @override Future resumeAllEffects() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineResumeAllEffects.index, 'params': jsonEncode({}) @@ -1356,7 +1357,7 @@ class RtcEngine with RtcEngineInterface { @override Future resumeEffect(int soundId) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineResumeEffect.index, 'params': jsonEncode({'soundId': soundId}) @@ -1367,7 +1368,7 @@ class RtcEngine with RtcEngineInterface { @override Future sendMetadata(String metadata) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApiWithBuffer', { 'apiType': _ApiTypeEngine.kEngineSendMetadata.index, 'params': jsonEncode({ @@ -1381,7 +1382,7 @@ class RtcEngine with RtcEngineInterface { @override Future sendStreamMessage(int streamId, String message) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApiWithBuffer', { 'apiType': _ApiTypeEngine.kEngineSendStreamMessage.index, 'params': jsonEncode({'streamId': streamId, 'length': message.length}), @@ -1394,7 +1395,7 @@ class RtcEngine with RtcEngineInterface { @override Future setCameraAutoFocusFaceModeEnabled(bool enabled) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { throw PlatformException(code: ErrorCode.NotSupported.toString()); } return _invokeMethod( @@ -1404,7 +1405,7 @@ class RtcEngine with RtcEngineInterface { @override Future setCameraCapturerConfiguration( CameraCapturerConfiguration config) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetCameraCapturerConfiguration.index, 'params': jsonEncode({'config': config.toJson()}) @@ -1417,7 +1418,7 @@ class RtcEngine with RtcEngineInterface { @override Future setCameraExposurePosition( double positionXinView, double positionYinView) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { throw PlatformException(code: ErrorCode.NotSupported.toString()); } return _invokeMethod('setCameraExposurePosition', { @@ -1429,7 +1430,7 @@ class RtcEngine with RtcEngineInterface { @override Future setCameraFocusPositionInPreview( double positionX, double positionY) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { throw PlatformException(code: ErrorCode.NotSupported.toString()); } return _invokeMethod('setCameraFocusPositionInPreview', @@ -1438,7 +1439,7 @@ class RtcEngine with RtcEngineInterface { @override Future setCameraTorchOn(bool isOn) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { throw PlatformException(code: ErrorCode.NotSupported.toString()); } return _invokeMethod('setCameraTorchOn', {'isOn': isOn}); @@ -1446,7 +1447,7 @@ class RtcEngine with RtcEngineInterface { @override Future setCameraZoomFactor(double factor) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { throw PlatformException(code: ErrorCode.NotSupported.toString()); } return _invokeMethod('setCameraZoomFactor', {'factor': factor}); @@ -1454,7 +1455,7 @@ class RtcEngine with RtcEngineInterface { @override Future setDefaultAudioRoutetoSpeakerphone(bool defaultToSpeaker) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetDefaultAudioRouteToSpeakerPhone.index, @@ -1467,7 +1468,7 @@ class RtcEngine with RtcEngineInterface { @override Future setEffectsVolume(double volume) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetEffectsVolume.index, 'params': jsonEncode({'volume': volume}) @@ -1478,7 +1479,7 @@ class RtcEngine with RtcEngineInterface { @override Future setEnableSpeakerphone(bool enabled) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetEnableSpeakerPhone.index, 'params': jsonEncode({'enabled': enabled}) @@ -1490,7 +1491,7 @@ class RtcEngine with RtcEngineInterface { @override @deprecated Future setEncryptionMode(EncryptionMode encryptionMode) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetEncryptionMode.index, 'params': jsonEncode({'encryptionMode': encryptionMode}) @@ -1503,7 +1504,7 @@ class RtcEngine with RtcEngineInterface { @override @deprecated Future setEncryptionSecret(String secret) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetEncryptionSecret.index, 'params': jsonEncode({'secret': secret}) @@ -1514,7 +1515,7 @@ class RtcEngine with RtcEngineInterface { @override Future setInEarMonitoringVolume(int volume) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetInEarMonitoringVolume.index, 'params': jsonEncode({'volume': volume}) @@ -1525,7 +1526,7 @@ class RtcEngine with RtcEngineInterface { @override Future setLiveTranscoding(LiveTranscoding transcoding) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetLiveTranscoding.index, 'params': jsonEncode({'transcoding': transcoding.toJson()}) @@ -1537,7 +1538,7 @@ class RtcEngine with RtcEngineInterface { @override Future setLocalPublishFallbackOption(StreamFallbackOptions option) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetLocalPublishFallbackOption.index, 'params': jsonEncode( @@ -1551,7 +1552,7 @@ class RtcEngine with RtcEngineInterface { @override @deprecated Future setLocalVoiceChanger(AudioVoiceChanger voiceChanger) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetLocalVoiceChanger.index, 'params': jsonEncode( @@ -1565,7 +1566,7 @@ class RtcEngine with RtcEngineInterface { @override Future setLocalVoiceEqualization( AudioEqualizationBandFrequency bandFrequency, int bandGain) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetLocalVoiceEqualization.index, 'params': jsonEncode({ @@ -1584,7 +1585,7 @@ class RtcEngine with RtcEngineInterface { @override Future setLocalVoicePitch(double pitch) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetLocalVoicePitch.index, 'params': jsonEncode({'pitch': pitch}) @@ -1595,7 +1596,7 @@ class RtcEngine with RtcEngineInterface { @override Future setLocalVoiceReverb(AudioReverbType reverbKey, int value) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetLocalVoiceReverb.index, 'params': jsonEncode({ @@ -1613,7 +1614,7 @@ class RtcEngine with RtcEngineInterface { @override @deprecated Future setLocalVoiceReverbPreset(AudioReverbPreset preset) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetLocalVoiceReverbPreset.index, 'params': @@ -1626,7 +1627,7 @@ class RtcEngine with RtcEngineInterface { @override Future setMaxMetadataSize(int size) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetMaxMetadataSize.index, 'params': jsonEncode({'size': size}) @@ -1637,7 +1638,7 @@ class RtcEngine with RtcEngineInterface { @override Future setRemoteDefaultVideoStreamType(VideoStreamType streamType) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetRemoteDefaultVideoStreamType.index, 'params': jsonEncode( @@ -1650,7 +1651,7 @@ class RtcEngine with RtcEngineInterface { @override Future setRemoteSubscribeFallbackOption(StreamFallbackOptions option) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetRemoteSubscribeFallbackOption.index, 'params': jsonEncode( @@ -1663,7 +1664,7 @@ class RtcEngine with RtcEngineInterface { @override Future setRemoteUserPriority(int uid, UserPriority userPriority) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetRemoteUserPriority.index, 'params': jsonEncode({ @@ -1680,7 +1681,7 @@ class RtcEngine with RtcEngineInterface { @override Future setRemoteVideoStreamType(int uid, VideoStreamType streamType) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetRemoteVideoStreamType.index, 'params': jsonEncode({ @@ -1697,7 +1698,7 @@ class RtcEngine with RtcEngineInterface { @override Future setRemoteVoicePosition(int uid, double pan, double gain) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetRemoteVoicePosition.index, 'params': jsonEncode({'uid': uid, 'pan': pan, 'gain': gain}) @@ -1709,7 +1710,7 @@ class RtcEngine with RtcEngineInterface { @override Future setVolumeOfEffect(int soundId, double volume) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetVolumeOfEffect.index, 'params': jsonEncode({'soundId': soundId, 'volume': volume}) @@ -1723,7 +1724,7 @@ class RtcEngine with RtcEngineInterface { @deprecated Future startAudioRecording(String filePath, AudioSampleRateType sampleRate, AudioRecordingQuality quality) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineStartAudioRecording.index, 'params': jsonEncode({ @@ -1749,7 +1750,7 @@ class RtcEngine with RtcEngineInterface { @override Future startChannelMediaRelay( ChannelMediaRelayConfiguration channelMediaRelayConfiguration) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineStartChannelMediaRelay.index, 'params': jsonEncode( @@ -1783,7 +1784,7 @@ class RtcEngine with RtcEngineInterface { @override Future startEchoTest(int intervalInSeconds) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineStartEchoTest.index, 'params': jsonEncode({'intervalInSeconds': intervalInSeconds}) @@ -1795,7 +1796,7 @@ class RtcEngine with RtcEngineInterface { @override Future startLastmileProbeTest(LastmileProbeConfig config) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineStartLastMileProbeTest.index, 'params': jsonEncode({'config': config.toJson()}) @@ -1806,7 +1807,7 @@ class RtcEngine with RtcEngineInterface { @override Future stopAllEffects() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineStopAllEffects.index, 'params': jsonEncode({}) @@ -1817,7 +1818,7 @@ class RtcEngine with RtcEngineInterface { @override Future stopAudioRecording() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineStopAudioRecording.index, 'params': jsonEncode({}) @@ -1828,7 +1829,7 @@ class RtcEngine with RtcEngineInterface { @override Future stopChannelMediaRelay() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineStopChannelMediaRelay.index, 'params': jsonEncode({}) @@ -1839,7 +1840,7 @@ class RtcEngine with RtcEngineInterface { @override Future stopEchoTest() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineStopEchoTest.index, 'params': jsonEncode({}) @@ -1850,7 +1851,7 @@ class RtcEngine with RtcEngineInterface { @override Future stopEffect(int soundId) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineStopEffect.index, 'params': jsonEncode({'soundId': soundId}) @@ -1861,7 +1862,7 @@ class RtcEngine with RtcEngineInterface { @override Future stopLastmileProbeTest() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineStopLastMileProbeTest.index, 'params': jsonEncode({}) @@ -1872,7 +1873,7 @@ class RtcEngine with RtcEngineInterface { @override Future switchCamera() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSwitchCamera.index, 'params': jsonEncode({}) @@ -1883,7 +1884,7 @@ class RtcEngine with RtcEngineInterface { @override Future unloadEffect(int soundId) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineUnloadEffect.index, 'params': jsonEncode({'soundId': soundId}) @@ -1894,7 +1895,7 @@ class RtcEngine with RtcEngineInterface { @override Future unregisterMediaMetadataObserver() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineUnRegisterMediaMetadataObserver.index, 'params': jsonEncode({}) @@ -1906,7 +1907,7 @@ class RtcEngine with RtcEngineInterface { @override Future updateChannelMediaRelay( ChannelMediaRelayConfiguration channelMediaRelayConfiguration) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineUpdateChannelMediaRelay.index, 'params': jsonEncode( @@ -1920,7 +1921,7 @@ class RtcEngine with RtcEngineInterface { @override Future enableFaceDetection(bool enable) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineEnableFaceDetection.index, 'params': jsonEncode({'enable': enable}) @@ -1931,7 +1932,7 @@ class RtcEngine with RtcEngineInterface { @override Future setAudioMixingPitch(int pitch) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetAudioMixingPitch.index, 'params': jsonEncode({'pitch': pitch}) @@ -1942,7 +1943,7 @@ class RtcEngine with RtcEngineInterface { @override Future enableEncryption(bool enabled, EncryptionConfig config) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineEnableEncryption.index, 'params': jsonEncode({'enabled': enabled, 'config': config.toJson()}) @@ -1955,7 +1956,7 @@ class RtcEngine with RtcEngineInterface { @override Future sendCustomReportMessage( String id, String category, String event, String label, int value) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSendCustomReportMessage.index, 'params': jsonEncode({ @@ -1979,7 +1980,7 @@ class RtcEngine with RtcEngineInterface { @override Future setAudioSessionOperationRestriction( AudioSessionOperationRestriction restriction) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetAudioSessionOperationRestriction.index, @@ -1997,7 +1998,7 @@ class RtcEngine with RtcEngineInterface { @override Future getNativeHandle() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { // TODO } return _invokeMethod('getNativeHandle'); @@ -2006,7 +2007,7 @@ class RtcEngine with RtcEngineInterface { @override Future setAudioEffectParameters( AudioEffectPreset preset, int param1, int param2) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetAudioEffectParameters.index, 'params': jsonEncode({ @@ -2025,7 +2026,7 @@ class RtcEngine with RtcEngineInterface { @override Future setAudioEffectPreset(AudioEffectPreset preset) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetAudioEffectPreset.index, 'params': @@ -2038,7 +2039,7 @@ class RtcEngine with RtcEngineInterface { @override Future setVoiceBeautifierPreset(VoiceBeautifierPreset preset) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetVoiceBeautifierPreset.index, 'params': jsonEncode( @@ -2051,7 +2052,7 @@ class RtcEngine with RtcEngineInterface { @override Future createDataStreamWithConfig(DataStreamConfig config) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineCreateDataStream.index, 'params': jsonEncode({'config': config.toJson()}) @@ -2062,7 +2063,7 @@ class RtcEngine with RtcEngineInterface { @override Future enableDeepLearningDenoise(bool enabled) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineEnableDeepLearningDenoise.index, 'params': jsonEncode({'enabled': enabled}) @@ -2073,7 +2074,7 @@ class RtcEngine with RtcEngineInterface { @override Future enableRemoteSuperResolution(int uid, bool enable) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineEnableRemoteSuperResolution.index, 'params': jsonEncode({'uid': uid, 'enable': enable}) @@ -2085,7 +2086,7 @@ class RtcEngine with RtcEngineInterface { @override Future setCloudProxy(CloudProxyType proxyType) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetCloudProxy.index, 'params': @@ -2098,7 +2099,7 @@ class RtcEngine with RtcEngineInterface { @override Future uploadLogFile() { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineUploadLogFile.index, 'params': jsonEncode({}) @@ -2110,7 +2111,7 @@ class RtcEngine with RtcEngineInterface { @override Future setVoiceBeautifierParameters( VoiceBeautifierPreset preset, int param1, int param2) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetVoiceBeautifierParameters.index, 'params': jsonEncode({ @@ -2129,7 +2130,7 @@ class RtcEngine with RtcEngineInterface { @override Future setVoiceConversionPreset(VoiceConversionPreset preset) { - if (Platform.isWindows) { + if (!kIsWeb && Platform.isWindows) { return _invokeMethod('callApi', { 'apiType': _ApiTypeEngine.kEngineSetVoiceConversionPreset.index, 'params': diff --git a/lib/src/rtc_render_view.dart b/lib/src/rtc_render_view.dart index c06d79713..52f2b9caf 100644 --- a/lib/src/rtc_render_view.dart +++ b/lib/src/rtc_render_view.dart @@ -1,3 +1,5 @@ +import 'dart:html'; + import 'package:flutter/foundation.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; @@ -11,9 +13,10 @@ import 'rtc_engine.dart'; final Map _channels = {}; -/// Use SurfaceView in Android. -/// -/// Use [UIView](https://developer.apple.com/documentation/uikit/uiview) in iOS. +/// Use SurfaceView on Android. +/// Use UIView on iOS. +/// Use DivElement on Web. +/// Not support Mac/Windows. class RtcSurfaceView extends StatefulWidget { /// User ID. final int uid; @@ -38,12 +41,12 @@ class RtcSurfaceView extends StatefulWidget { /// Control whether the surface view's surface is placed on top of its window. /// - /// See [TargetPlatform.android]. + /// Only support [TargetPlatform.android]. final bool zOrderOnTop; /// Control whether the surface view's surface is placed on top of another regular surface view in the window (but still behind the window itself). /// - /// See [TargetPlatform.android]. + /// Only support [TargetPlatform.android]. final bool zOrderMediaOverlay; /// Callback signature for when a platform view was created. @@ -272,9 +275,9 @@ class _HtmlElementViewController extends PlatformViewController } } -/// Use TextureView in Android. -/// Not support for iOS. -/// [TargetPlatform.android] +/// Use TextureView or FlutterTexture on Android. +/// Use FlutterTexture on iOS/Mac/Windows. +/// Not support Web. class RtcTextureView extends StatefulWidget { /// User ID. final int uid; @@ -313,6 +316,7 @@ class RtcTextureView extends StatefulWidget { /// were not claimed by any other gesture recognizer. final Set>? gestureRecognizers; + /// Use Flutter Texture to render. final bool useFlutterTexture; /// Constructs a [RtcTextureView] @@ -340,6 +344,9 @@ class _RtcTextureViewState extends State { @override Widget build(BuildContext context) { + if (kIsWeb) { + return Text('Web is not yet supported by the plugin'); + } if (widget.useFlutterTexture) { if (_id != null) { return Texture(textureId: _id!);