AgoraIO-Extensions / Agora-Flutter-SDK

Flutter plugin of Agora RTC SDK for Android/iOS/macOS/Windows
https://pub.dev/packages/agora_rtc_engine
MIT License
747 stars 388 forks source link

Unable to Listen to Cancel Button on the "Start Recording and Casting Screen" dialog. #1991

Closed Sahilpervez closed 1 month ago

Sahilpervez commented 3 months ago

Version of the agora_rtc_engine

^6.2.1

Platforms affected

Steps to reproduce

  1. Initialize the RtcEngineEx in my case its _screenSharingEngine
  2. set the video encoder configuration using setVideoEncoderConfiguration method on _screenSharingEngine.
  3. use startScreenCapture method on _screenSharingEngine to get the "Start Recording and Casting Screen" dialog.
  4. Press Cancel button in the dialog.

Expected results

Expected result is startScreenCapture() method should return a boolean value when any of the buttons in the "Start Recording and Casting Screen" dialog is pressed. Atleaset an exception should be thrown when Cancel button is pressed.

Actual results

Currently a Future<void> is returned by the startScreenCapture() method. Also there is no exception or error thrown on press of Cancel button in "Start Recording and Casting Screen" dialog.

Code sample

Future<bool?> _startScreenSharing() async {
    try {
      // Get and set Token and UID
      bool status = false;
      if (_screenShareUid == null ||
          _screenSharingToken == null ||
          _screenSharingToken!.isEmpty) {
        status = await getScreenSharingToken();
      } else {
        status = true;
      }

      // Join Channel using engine
      if (status == true) {
        await _screenSharingEngine.initialize(RtcEngineContext(
          appId: appId,
          channelProfile: ChannelProfileType.channelProfileLiveBroadcasting,
        ));

        await _screenSharingEngine.setVideoEncoderConfiguration(
          VideoEncoderConfiguration(
            dimensions: VideoDimensions(
                width: MediaQuery.of(context).size.width.truncate(),
                height: MediaQuery.of(context).size.height.truncate()),
            frameRate: 15,
            bitrate: 0,
          ),
        );

        // await _engine.stopDumpVideo();
        await _screenSharingEngine.startScreenCapture(ScreenCaptureParameters2(
          captureVideo: true,
          captureAudio: false,
          videoParams: ScreenVideoParameters(
            dimensions: VideoDimensions(
                // width: MediaQuery.of(context).size.width.truncate(),
                // height: MediaQuery.of(context).size.height.truncate(),
              width: (MediaQuery.of(context).orientation == Orientation.landscape) ? 640 : 480,
              height: (MediaQuery.of(context).orientation == Orientation.landscape) ? 480 : 640,
            ),
            bitrate: 1400,
            frameRate: 25,
          ),
        ));

        await _screenSharingEngine.startPreview(
          sourceType: VideoSourceType.videoSourceScreen,
        );

      if(Platform.isIOS){
        final status = await _iosScreenShareChannel.invokeMethod('stopScreenSharing');
        showToast(status,
            context: context,
            textStyle: const TextStyle(color: AppColors.colorButtonBackgroundPrimary),
            backgroundColor: AppColors.chipBackground,
            textPadding: const EdgeInsets.all(8),
            borderRadius: BorderRadius.circular(4),
            animation: StyledToastAnimation.fade,
            reverseAnimation: StyledToastAnimation.fade,
            animDuration: const Duration(milliseconds: 100),
            duration: const Duration(seconds: 2),
            position: const StyledToastPosition(align: Alignment.bottomCenter,offset: 21)
        );
      }

        await _screenSharingEngine.joinChannelEx(
          token: _screenSharingToken!,
          connection: RtcConnection(
              channelId: widget.channelName, localUid: _screenShareUid!),
          options: const ChannelMediaOptions(
            autoSubscribeAudio: false,
            autoSubscribeVideo: false,
            channelProfile: ChannelProfileType.channelProfileLiveBroadcasting,
            clientRoleType: ClientRoleType.clientRoleBroadcaster,
            publishScreenTrack: true,
            publishSecondaryCameraTrack: false,
            publishCameraTrack: false,
            publishMicrophoneTrack: false,
            publishScreenCaptureAudio: false,
            publishScreenCaptureVideo: true,
            // autoSubscribeAudio: false,
            // autoSubscribeVideo: false,
          ),
        );
        await _screenSharingEngine.muteAllRemoteAudioStreamsEx(
            mute: true,
            connection: RtcConnection(
              channelId: widget.channelName,
              localUid: _screenShareUid,
            ));

        await _screenSharingEngine.muteAllRemoteVideoStreamsEx(
            mute: true,
            connection: RtcConnection(
              channelId: widget.channelName,
              localUid: _screenShareUid,
            ));
        return true;
      } else {
        return false;
      }
    } catch (e) {
      log(e.toString(), name: "ERROR IN SCREEN SHARING");
      setState(() {
        _isScreenSharing = false;
      });
      await _screenSharingEngine.stopScreenCapture();
      if(Platform.isIOS){
        await _iosScreenShareChannel.invokeMethod('stopScreenSharing');
      }
      // await _stopScreenSharing();
      return false;
    }
  }

Screenshots or Video

"Start Recording and Casting Screen" Dialog [`Start Recording and Casting Screen` Dialog] ![img1](https://github.com/user-attachments/assets/24985417-2256-4f43-8a96-a82d8cf03c70)
"Start Now" button Pressed - Everything works good in this case [`Start Now` button Pressed] ![Screenshot from 2024-09-02 11-22-29](https://github.com/user-attachments/assets/523f7bcf-ea2d-4e0b-8a10-7c7893eeaa9e)

The problem arises from here :

"Cancel" button Pressed - There is no Exception thrown in this case - ScreenSharing engine just joins the channel and the screen preview screen goes blank. [`Cancel` button Pressed] ![Screenshot from 2024-09-02 11-26-35](https://github.com/user-attachments/assets/8bd99f52-90b0-4636-b09f-e28d11afd879)

Logs

agora-iris.log

Logs ```console [2024-09-02 11:18:20.420] [7849] [info] [iris_logger.cc:113] reset logger to /storage/emulated/0/Android/data/com.faceon.FaceOn/files/agora-iris.log [2024-09-02 11:18:20.996] [7849] [info] [iris_rtc_engine_impl.cc:52] IrisRtcEngineImpl Initialize [2024-09-02 11:18:21.017] [7849] [info] [iris_rtc_engine_impl.cc:94] api name RtcEngine_initialize params {"context":{"appId":"2da***************3e6","channelProfile":1}} [2024-09-02 11:18:21.018] [7849] [info] [iris_logger.cc:113] reset logger to /storage/emulated/0/Android/data/com.faceon.FaceOn/files/agora-iris.log [2024-09-02 11:18:21.578] [7849] [info] [iris_rtc_device_manager_impl.cc:29] IrisRtcDeviceManagerImpl Initialize [2024-09-02 11:18:21.579] [7849] [info] [iris_rtc_media_player_impl.cc:30] IrisMediaPlayerImpl Initialize [2024-09-02 11:18:21.580] [7849] [info] [iris_rtc_spatial_audio_engine_impl.cc:205] IrisLocalSpatialAudioEngineImpl Initialize [2024-09-02 11:18:21.580] [7849] [info] [iris_rtc_media_recorder_impl.cc:17] IrisMediaRecorderImpl Initialize [2024-09-02 11:18:21.581] [7849] [info] [iris_rtc_music_center_impl.cc:20] IrisMusicPlayerImpl Initialize [2024-09-02 11:18:21.581] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_initialize ret 0 result {"result":0} [2024-09-02 11:18:21.583] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_setAppType params {"appType":4} [2024-09-02 11:18:21.584] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_setAppType ret 0 result {"result":0} [2024-09-02 11:18:21.591] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_registerEventHandler params {"event":133802582910704} [2024-09-02 11:18:21.592] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_registerEventHandler ret 0 result {"result":0} [2024-09-02 11:18:21.592] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_setClientRole params {"role":1,"options":null} [2024-09-02 11:18:21.593] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_setClientRole ret 0 result {"result":0} [2024-09-02 11:18:21.594] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_setAudioProfile params {"profile":5,"scenario":0} [2024-09-02 11:18:21.595] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_setAudioProfile ret 0 result {"result":0} [2024-09-02 11:18:21.596] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_enableAudio params {} [2024-09-02 11:18:21.597] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_enableAudio ret 0 result {"result":0} [2024-09-02 11:18:21.598] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_enableVideo params {} [2024-09-02 11:18:21.599] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_enableVideo ret 0 result {"result":0} [2024-09-02 11:18:21.599] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_startPreview2 params {"sourceType":0} [2024-09-02 11:18:21.599] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_startPreview2 ret 0 result {"result":0} [2024-09-02 11:18:21.601] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_muteLocalVideoStream params {"mute":false} [2024-09-02 11:18:21.882] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_muteLocalVideoStream ret 0 result {"result":0} [2024-09-02 11:18:21.890] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_enableLocalVideo params {"enabled":true} [2024-09-02 11:18:21.890] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_enableLocalVideo ret 0 result {"result":0} [2024-09-02 11:18:21.892] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_enableLocalAudio params {"enabled":true} [2024-09-02 11:18:21.894] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_enableLocalAudio ret 0 result {"result":0} [2024-09-02 11:18:21.896] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_enableAudioVolumeIndication params {"interval":200,"smooth":3,"reportVad":false} [2024-09-02 11:18:21.898] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_enableAudioVolumeIndication ret 0 result {"result":0} [2024-09-02 11:18:21.910] [7849] [info] [iris_rtc_engine_impl.cc:94] api name RtcEngine_joinChannel2 params {"token":"0062***************ldZm","channelId":"46d96cb8-2c40-4c5c-a936-5d8646f41315","uid":1725256098,"options":{"clientRoleType":1,"channelProfile":0}} [2024-09-02 11:18:22.038] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_joinChannel2 ret 0 result {"result":0} [2024-09-02 11:18:22.243] [7849] [info] [rtc_engine_event_handler.cc:51] channel 46d96cb8-2c40-4c5c-a936-5d8646f41315 uid 1725256098 [2024-09-02 11:18:22.566] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_setupLocalVideo params {"canvas":{"view":15590,"uid":0}} [2024-09-02 11:18:22.567] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_setupLocalVideo ret 0 result {"result":0} [2024-09-02 11:18:58.097] [7849] [info] [iris_rtc_engine_impl.cc:94] api name RtcEngine_initialize params {"context":{"appId":"2da***************3e6","channelProfile":1}} [2024-09-02 11:18:58.097] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_initialize ret 0 result {"result":0} [2024-09-02 11:18:58.128] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_setAppType params {"appType":4} [2024-09-02 11:18:58.128] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_setAppType ret 0 result {"result":0} [2024-09-02 11:18:58.143] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_setVideoEncoderConfiguration params {"config":{"dimensions":{"width":392,"height":807},"frameRate":15,"bitrate":0}} [2024-09-02 11:18:58.154] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_setVideoEncoderConfiguration ret 0 result {"result":0} [2024-09-02 11:18:58.199] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_startScreenCapture params {"captureParams":{"captureAudio":false,"captureVideo":true,"videoParams":{"dimensions":{"width":480,"height":640},"frameRate":25,"bitrate":1400}}} [2024-09-02 11:18:58.225] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_startScreenCapture ret 0 result {"result":0} [2024-09-02 11:18:58.228] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_startPreview2 params {"sourceType":2} [2024-09-02 11:18:58.228] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_startPreview2 ret 0 result {"result":0} [2024-09-02 11:18:58.241] [7849] [info] [iris_rtc_engine_impl.cc:94] api name RtcEngineEx_joinChannelEx params {"token":"0062***************ldZm","connection":{"channelId":"46d96cb8-2c40-4c5c-a936-5d8646f41315","localUid":1725256137},"options":{"publishCameraTrack":false,"publishSecondaryCameraTrack":false,"publishMicrophoneTrack":false,"publishScreenCaptureVideo":true,"publishScreenCaptureAudio":false,"publishScreenTrack":true,"autoSubscribeAudio":false,"autoSubscribeVideo":false,"clientRoleType":1,"channelProfile":1}} [2024-09-02 11:18:58.519] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngineEx_joinChannelEx ret 0 result {"result":0} [2024-09-02 11:18:58.681] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngineEx_muteAllRemoteAudioStreamsEx params {"mute":true,"connection":{"channelId":"46d96cb8-2c40-4c5c-a936-5d8646f41315","localUid":1725256137}} [2024-09-02 11:18:58.681] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngineEx_muteAllRemoteAudioStreamsEx ret 0 result {"result":0} [2024-09-02 11:18:58.686] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngineEx_muteAllRemoteVideoStreamsEx params {"mute":true,"connection":{"channelId":"46d96cb8-2c40-4c5c-a936-5d8646f41315","localUid":1725256137}} [2024-09-02 11:18:58.688] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngineEx_muteAllRemoteVideoStreamsEx ret 0 result {"result":0} [2024-09-02 11:18:58.747] [7849] [info] [rtc_engine_event_handler.cc:51] channel 46d96cb8-2c40-4c5c-a936-5d8646f41315 uid 1725256137 [2024-09-02 11:19:00.996] [7849] [info] [rtc_engine_event_handler.cc:1667] channel 46d96cb8-2c40-4c5c-a936-5d8646f41315 uid 1725256137 remoteUid 1725256098 [2024-09-02 11:19:01.341] [7849] [info] [rtc_engine_event_handler.cc:1667] channel 46d96cb8-2c40-4c5c-a936-5d8646f41315 uid 1725256098 remoteUid 1725256137 [2024-09-02 11:20:49.199] [7849] [info] [rtc_engine_event_handler.cc:1837] channel 46d96cb8-2c40-4c5c-a936-5d8646f41315 uid 1725256098 [2024-09-02 11:20:49.656] [7849] [info] [rtc_engine_event_handler.cc:1837] channel 46d96cb8-2c40-4c5c-a936-5d8646f41315 uid 1725256137 [2024-09-02 11:20:54.158] [7849] [info] [rtc_engine_event_handler.cc:85] channel 46d96cb8-2c40-4c5c-a936-5d8646f41315 uid 1725256137 [2024-09-02 11:20:54.347] [7849] [info] [rtc_engine_event_handler.cc:85] channel 46d96cb8-2c40-4c5c-a936-5d8646f41315 uid 1725256098 [2024-09-02 11:21:51.985] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_stopScreenCapture params {} [2024-09-02 11:21:52.090] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_stopScreenCapture ret 0 result {"result":0} [2024-09-02 11:21:52.127] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngineEx_leaveChannelEx params {"connection":{"channelId":"46d96cb8-2c40-4c5c-a936-5d8646f41315","localUid":1725256137},"options":{"stopAllEffect":false}} [2024-09-02 11:21:52.184] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngineEx_leaveChannelEx ret 0 result {"result":0} [2024-09-02 11:21:52.186] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_startPreview2 params {"sourceType":0} [2024-09-02 11:21:52.186] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_startPreview2 ret 0 result {"result":0} [2024-09-02 11:21:52.202] [7849] [info] [rtc_engine_event_handler.cc:1457] channel 46d96cb8-2c40-4c5c-a936-5d8646f41315 uid 1725256137 [2024-09-02 11:21:52.203] [7849] [info] [rtc_engine_event_handler.cc:1687] channel 46d96cb8-2c40-4c5c-a936-5d8646f41315 uid 1725256098 remoteUid 1725256137 [2024-09-02 11:21:56.483] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_leaveChannel params {"options":null} [2024-09-02 11:21:56.755] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_leaveChannel ret 0 result {"result":0} [2024-09-02 11:21:56.755] [7849] [info] [rtc_engine_event_handler.cc:1457] channel 46d96cb8-2c40-4c5c-a936-5d8646f41315 uid 1725256098 [2024-09-02 11:21:56.802] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_unregisterEventHandler params {"event":133802582910704} [2024-09-02 11:21:56.802] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_unregisterEventHandler ret 0 result {"result":0} [2024-09-02 11:21:56.814] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_release params {"sync":false} [2024-09-02 11:21:56.814] [7849] [info] [iris_rtc_engine_impl.cc:194] IrisRtcEngineImpl __release [2024-09-02 11:21:56.814] [7849] [info] [iris_rtc_device_manager_impl.cc:36] IrisRtcDeviceManagerImpl Release [2024-09-02 11:21:56.814] [7849] [info] [iris_rtc_device_manager_wrapper.cc:791] IDeviceManagerWrapper release [2024-09-02 11:21:56.814] [7849] [info] [iris_rtc_media_player_impl.cc:41] IrisMediaPlayerImpl Release [2024-09-02 11:21:56.814] [7849] [info] [iris_rtc_media_player_wrapper.cc:39] IMediaPlayerWrapper release [2024-09-02 11:21:56.814] [7849] [info] [iris_rtc_spatial_audio_engine_impl.cc:212] IrisLocalSpatialAudioEngineImpl Release [2024-09-02 11:21:56.814] [7849] [info] [iris_rtc_spatial_audio_engine_wrapper.cc:388] ILocalSpatialAudioEngineWrapper release [2024-09-02 11:21:56.814] [7849] [info] [iris_rtc_media_recorder_impl.cc:24] IrisMediaRecorderImpl Release [2024-09-02 11:21:56.814] [7849] [info] [iris_rtc_music_center_impl.cc:26] IrisMusicCenterImpl Release [2024-09-02 11:21:56.814] [7849] [info] [iris_rtc_music_center_wrapper.cc:27] IrisMusicContentCenterWrapper release [2024-09-02 11:21:56.815] [7849] [info] [iris_rtc_engine_wrapper.cc:8115] IRtcEngineWrapper release [2024-09-02 11:21:56.897] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_release ret 0 result {"result":0} [2024-09-02 11:21:56.898] [7849] [error] [iris_rtc_engine_impl.cc:69] error code: -7 [2024-09-02 11:21:56.982] [7849] [info] [iris_rtc_engine_impl.cc:42] IrisRtcEngineImpl Destroy [2024-09-02 11:21:57.000] [7849] [info] [iris_rtc_music_center_impl.cc:16] IrisMusiImpl Destroy [2024-09-02 11:21:57.000] [7849] [info] [iris_rtc_media_recorder_impl.cc:13] IrisMediaRecodrerImpl Destroy [2024-09-02 11:21:57.000] [7849] [info] [iris_rtc_spatial_audio_engine_impl.cc:201] IrisLocalSpatialAudioEngineImpl Destroy [2024-09-02 11:21:57.000] [7849] [info] [iris_rtc_media_player_impl.cc:26] IrisMediaPlayerImpl Destroy [2024-09-02 11:21:57.000] [7849] [info] [iris_rtc_device_manager_impl.cc:25] IrisRtcDeviceManagerImpl Destroy [2024-09-02 11:22:02.118] [7849] [info] [iris_rtc_engine_impl.cc:52] IrisRtcEngineImpl Initialize [2024-09-02 11:22:02.123] [7849] [info] [iris_rtc_engine_impl.cc:94] api name RtcEngine_initialize params {"context":{"appId":"2da***************3e6","channelProfile":1}} [2024-09-02 11:22:02.296] [7849] [info] [iris_rtc_device_manager_impl.cc:29] IrisRtcDeviceManagerImpl Initialize [2024-09-02 11:22:02.296] [7849] [info] [iris_rtc_media_player_impl.cc:30] IrisMediaPlayerImpl Initialize [2024-09-02 11:22:02.296] [7849] [info] [iris_rtc_spatial_audio_engine_impl.cc:205] IrisLocalSpatialAudioEngineImpl Initialize [2024-09-02 11:22:02.296] [7849] [info] [iris_rtc_media_recorder_impl.cc:17] IrisMediaRecorderImpl Initialize [2024-09-02 11:22:02.296] [7849] [info] [iris_rtc_music_center_impl.cc:20] IrisMusicPlayerImpl Initialize [2024-09-02 11:22:02.296] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_initialize ret 0 result {"result":0} [2024-09-02 11:22:02.297] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_setAppType params {"appType":4} [2024-09-02 11:22:02.297] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_setAppType ret 0 result {"result":0} [2024-09-02 11:22:02.299] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_registerEventHandler params {"event":133802584037648} [2024-09-02 11:22:02.299] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_registerEventHandler ret 0 result {"result":0} [2024-09-02 11:22:02.299] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_setClientRole params {"role":1,"options":null} [2024-09-02 11:22:02.300] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_setClientRole ret 0 result {"result":0} [2024-09-02 11:22:02.301] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_setAudioProfile params {"profile":5,"scenario":0} [2024-09-02 11:22:02.302] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_setAudioProfile ret 0 result {"result":0} [2024-09-02 11:22:02.302] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_enableAudio params {} [2024-09-02 11:22:02.303] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_enableAudio ret 0 result {"result":0} [2024-09-02 11:22:02.304] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_enableVideo params {} [2024-09-02 11:22:02.304] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_enableVideo ret 0 result {"result":0} [2024-09-02 11:22:02.305] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_startPreview2 params {"sourceType":0} [2024-09-02 11:22:02.305] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_startPreview2 ret 0 result {"result":0} [2024-09-02 11:22:02.305] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_muteLocalVideoStream params {"mute":false} [2024-09-02 11:22:02.309] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_muteLocalVideoStream ret 0 result {"result":0} [2024-09-02 11:22:02.310] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_enableLocalVideo params {"enabled":true} [2024-09-02 11:22:02.311] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_enableLocalVideo ret 0 result {"result":0} [2024-09-02 11:22:02.312] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_enableLocalAudio params {"enabled":true} [2024-09-02 11:22:02.312] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_enableLocalAudio ret 0 result {"result":0} [2024-09-02 11:22:02.312] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_enableAudioVolumeIndication params {"interval":200,"smooth":3,"reportVad":false} [2024-09-02 11:22:02.313] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_enableAudioVolumeIndication ret 0 result {"result":0} [2024-09-02 11:22:02.313] [7849] [info] [iris_rtc_engine_impl.cc:94] api name RtcEngine_joinChannel2 params {"token":"0062***************ldZm","channelId":"46d96cb8-2c40-4c5c-a936-5d8646f41315","uid":1725256098,"options":{"clientRoleType":1,"channelProfile":0}} [2024-09-02 11:22:02.416] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_joinChannel2 ret 0 result {"result":0} [2024-09-02 11:22:02.843] [7849] [info] [rtc_engine_event_handler.cc:51] channel 46d96cb8-2c40-4c5c-a936-5d8646f41315 uid 1725256098 [2024-09-02 11:22:03.135] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_setupLocalVideo params {"canvas":{"view":12906,"uid":0}} [2024-09-02 11:22:03.136] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_setupLocalVideo ret 0 result {"result":0} [2024-09-02 11:22:10.097] [7849] [info] [iris_rtc_engine_impl.cc:94] api name RtcEngine_initialize params {"context":{"appId":"2da***************3e6","channelProfile":1}} [2024-09-02 11:22:10.097] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_initialize ret 0 result {"result":0} [2024-09-02 11:22:10.098] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_setAppType params {"appType":4} [2024-09-02 11:22:10.099] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_setAppType ret 0 result {"result":0} [2024-09-02 11:22:10.113] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_setVideoEncoderConfiguration params {"config":{"dimensions":{"width":392,"height":807},"frameRate":15,"bitrate":0}} [2024-09-02 11:22:10.149] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_setVideoEncoderConfiguration ret 0 result {"result":0} [2024-09-02 11:22:10.165] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_startScreenCapture params {"captureParams":{"captureAudio":false,"captureVideo":true,"videoParams":{"dimensions":{"width":480,"height":640},"frameRate":25,"bitrate":1400}}} [2024-09-02 11:22:10.187] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_startScreenCapture ret 0 result {"result":0} [2024-09-02 11:22:10.195] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_startPreview2 params {"sourceType":2} [2024-09-02 11:22:10.195] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_startPreview2 ret 0 result {"result":0} [2024-09-02 11:22:10.198] [7849] [info] [iris_rtc_engine_impl.cc:94] api name RtcEngineEx_joinChannelEx params {"token":"0062***************ldZm","connection":{"channelId":"46d96cb8-2c40-4c5c-a936-5d8646f41315","localUid":1725256137},"options":{"publishCameraTrack":false,"publishSecondaryCameraTrack":false,"publishMicrophoneTrack":false,"publishScreenCaptureVideo":true,"publishScreenCaptureAudio":false,"publishScreenTrack":true,"autoSubscribeAudio":false,"autoSubscribeVideo":false,"clientRoleType":1,"channelProfile":1}} [2024-09-02 11:22:10.336] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngineEx_joinChannelEx ret 0 result {"result":0} [2024-09-02 11:22:10.339] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngineEx_muteAllRemoteAudioStreamsEx params {"mute":true,"connection":{"channelId":"46d96cb8-2c40-4c5c-a936-5d8646f41315","localUid":1725256137}} [2024-09-02 11:22:10.342] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngineEx_muteAllRemoteAudioStreamsEx ret 0 result {"result":0} [2024-09-02 11:22:10.348] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngineEx_muteAllRemoteVideoStreamsEx params {"mute":true,"connection":{"channelId":"46d96cb8-2c40-4c5c-a936-5d8646f41315","localUid":1725256137}} [2024-09-02 11:22:10.364] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngineEx_muteAllRemoteVideoStreamsEx ret 0 result {"result":0} [2024-09-02 11:22:10.538] [7849] [info] [rtc_engine_event_handler.cc:51] channel 46d96cb8-2c40-4c5c-a936-5d8646f41315 uid 1725256137 [2024-09-02 11:22:11.412] [7849] [info] [rtc_engine_event_handler.cc:1667] channel 46d96cb8-2c40-4c5c-a936-5d8646f41315 uid 1725256137 remoteUid 1725256098 [2024-09-02 11:22:13.256] [7849] [info] [rtc_engine_event_handler.cc:1667] channel 46d96cb8-2c40-4c5c-a936-5d8646f41315 uid 1725256098 remoteUid 1725256137 [2024-09-02 11:22:14.221] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngineEx_setupRemoteVideoEx params {"canvas":{"view":18790,"uid":1725256137,"renderMode":2},"connection":{"channelId":"46d96cb8-2c40-4c5c-a936-5d8646f41315"}} [2024-09-02 11:22:14.288] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngineEx_setupRemoteVideoEx ret 0 result {"result":0} [2024-09-02 11:22:37.779] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_stopScreenCapture params {} [2024-09-02 11:22:37.969] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_stopScreenCapture ret 0 result {"result":0} [2024-09-02 11:22:37.971] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngineEx_leaveChannelEx params {"connection":{"channelId":"46d96cb8-2c40-4c5c-a936-5d8646f41315","localUid":1725256137},"options":{"stopAllEffect":false}} [2024-09-02 11:22:38.100] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngineEx_leaveChannelEx ret 0 result {"result":0} [2024-09-02 11:22:38.134] [7849] [info] [rtc_engine_event_handler.cc:1457] channel 46d96cb8-2c40-4c5c-a936-5d8646f41315 uid 1725256137 [2024-09-02 11:22:38.135] [7849] [info] [rtc_engine_event_handler.cc:1687] channel 46d96cb8-2c40-4c5c-a936-5d8646f41315 uid 1725256098 remoteUid 1725256137 [2024-09-02 11:22:38.151] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_startPreview2 params {"sourceType":0} [2024-09-02 11:22:38.151] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_startPreview2 ret 0 result {"result":0} [2024-09-02 11:22:38.208] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngineEx_setupRemoteVideoEx params {"canvas":{"view":0,"uid":1725256137,"renderMode":2},"connection":{"channelId":"46d96cb8-2c40-4c5c-a936-5d8646f41315"}} [2024-09-02 11:22:38.232] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngineEx_setupRemoteVideoEx ret 0 result {"result":0} [2024-09-02 11:26:26.712] [7849] [info] [iris_rtc_engine_impl.cc:94] api name RtcEngine_initialize params {"context":{"appId":"2da***************3e6","channelProfile":1}} [2024-09-02 11:26:26.712] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_initialize ret 0 result {"result":0} [2024-09-02 11:26:26.713] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_setAppType params {"appType":4} [2024-09-02 11:26:26.714] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_setAppType ret 0 result {"result":0} [2024-09-02 11:26:26.723] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_setVideoEncoderConfiguration params {"config":{"dimensions":{"width":392,"height":807},"frameRate":15,"bitrate":0}} [2024-09-02 11:26:26.734] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_setVideoEncoderConfiguration ret 0 result {"result":0} [2024-09-02 11:26:26.737] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_startScreenCapture params {"captureParams":{"captureAudio":false,"captureVideo":true,"videoParams":{"dimensions":{"width":480,"height":640},"frameRate":25,"bitrate":1400}}} [2024-09-02 11:26:26.752] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_startScreenCapture ret 0 result {"result":0} [2024-09-02 11:26:26.757] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_startPreview2 params {"sourceType":2} [2024-09-02 11:26:26.757] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_startPreview2 ret 0 result {"result":0} [2024-09-02 11:26:26.759] [7849] [info] [iris_rtc_engine_impl.cc:94] api name RtcEngineEx_joinChannelEx params {"token":"0062***************ldZm","connection":{"channelId":"46d96cb8-2c40-4c5c-a936-5d8646f41315","localUid":1725256137},"options":{"publishCameraTrack":false,"publishSecondaryCameraTrack":false,"publishMicrophoneTrack":false,"publishScreenCaptureVideo":true,"publishScreenCaptureAudio":false,"publishScreenTrack":true,"autoSubscribeAudio":false,"autoSubscribeVideo":false,"clientRoleType":1,"channelProfile":1}} [2024-09-02 11:26:26.994] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngineEx_joinChannelEx ret 0 result {"result":0} [2024-09-02 11:26:27.029] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngineEx_muteAllRemoteAudioStreamsEx params {"mute":true,"connection":{"channelId":"46d96cb8-2c40-4c5c-a936-5d8646f41315","localUid":1725256137}} [2024-09-02 11:26:27.058] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngineEx_muteAllRemoteAudioStreamsEx ret 0 result {"result":0} [2024-09-02 11:26:27.059] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngineEx_muteAllRemoteVideoStreamsEx params {"mute":true,"connection":{"channelId":"46d96cb8-2c40-4c5c-a936-5d8646f41315","localUid":1725256137}} [2024-09-02 11:26:27.238] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngineEx_muteAllRemoteVideoStreamsEx ret 0 result {"result":0} [2024-09-02 11:26:27.340] [7849] [info] [rtc_engine_event_handler.cc:51] channel 46d96cb8-2c40-4c5c-a936-5d8646f41315 uid 1725256137 [2024-09-02 11:26:27.342] [7849] [info] [rtc_engine_event_handler.cc:1667] channel 46d96cb8-2c40-4c5c-a936-5d8646f41315 uid 1725256098 remoteUid 1725256137 [2024-09-02 11:26:28.524] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngineEx_setupRemoteVideoEx params {"canvas":{"view":18586,"uid":1725256137,"renderMode":2},"connection":{"channelId":"46d96cb8-2c40-4c5c-a936-5d8646f41315"}} [2024-09-02 11:26:28.673] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngineEx_setupRemoteVideoEx ret 0 result {"result":0} [2024-09-02 11:26:29.514] [7849] [info] [rtc_engine_event_handler.cc:1667] channel 46d96cb8-2c40-4c5c-a936-5d8646f41315 uid 1725256137 remoteUid 1725256098 [2024-09-02 11:26:52.465] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_stopScreenCapture params {} [2024-09-02 11:26:52.473] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_stopScreenCapture ret 0 result {"result":0} [2024-09-02 11:26:52.502] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngineEx_leaveChannelEx params {"connection":{"channelId":"46d96cb8-2c40-4c5c-a936-5d8646f41315","localUid":1725256137},"options":{"stopAllEffect":false}} [2024-09-02 11:26:52.554] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngineEx_leaveChannelEx ret 0 result {"result":0} [2024-09-02 11:26:52.563] [7849] [info] [rtc_engine_event_handler.cc:1457] channel 46d96cb8-2c40-4c5c-a936-5d8646f41315 uid 1725256137 [2024-09-02 11:26:52.563] [7849] [info] [rtc_engine_event_handler.cc:1687] channel 46d96cb8-2c40-4c5c-a936-5d8646f41315 uid 1725256098 remoteUid 1725256137 [2024-09-02 11:26:52.575] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_stopScreenCapture params {} [2024-09-02 11:26:52.610] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_stopScreenCapture ret 0 result {"result":0} [2024-09-02 11:26:52.627] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngineEx_setupRemoteVideoEx params {"canvas":{"view":0,"uid":1725256137,"renderMode":2},"connection":{"channelId":"46d96cb8-2c40-4c5c-a936-5d8646f41315"}} [2024-09-02 11:26:52.648] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngineEx_setupRemoteVideoEx ret 0 result {"result":0} [2024-09-02 11:26:52.648] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_startPreview2 params {"sourceType":0} [2024-09-02 11:26:52.649] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_startPreview2 ret 0 result {"result":0} [2024-09-02 11:26:52.649] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngineEx_leaveChannelEx params {"connection":{"channelId":"46d96cb8-2c40-4c5c-a936-5d8646f41315","localUid":1725256137},"options":{"stopAllEffect":false}} [2024-09-02 11:26:52.660] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngineEx_leaveChannelEx ret 0 result {"result":-2} [2024-09-02 11:26:52.668] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_startPreview2 params {"sourceType":0} [2024-09-02 11:26:52.668] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_startPreview2 ret 0 result {"result":0} [2024-09-02 11:40:02.338] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_leaveChannel params {"options":null} [2024-09-02 11:40:02.533] [7849] [info] [rtc_engine_event_handler.cc:1457] channel 46d96cb8-2c40-4c5c-a936-5d8646f41315 uid 1725256098 [2024-09-02 11:40:02.539] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_leaveChannel ret 0 result {"result":0} [2024-09-02 11:40:02.551] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_unregisterEventHandler params {"event":133802584037648} [2024-09-02 11:40:02.551] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_unregisterEventHandler ret 0 result {"result":0} [2024-09-02 11:40:02.551] [7849] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_release params {"sync":false} [2024-09-02 11:40:02.552] [7849] [info] [iris_rtc_engine_impl.cc:194] IrisRtcEngineImpl __release [2024-09-02 11:40:02.552] [7849] [info] [iris_rtc_device_manager_impl.cc:36] IrisRtcDeviceManagerImpl Release [2024-09-02 11:40:02.552] [7849] [info] [iris_rtc_device_manager_wrapper.cc:791] IDeviceManagerWrapper release [2024-09-02 11:40:02.552] [7849] [info] [iris_rtc_media_player_impl.cc:41] IrisMediaPlayerImpl Release [2024-09-02 11:40:02.552] [7849] [info] [iris_rtc_media_player_wrapper.cc:39] IMediaPlayerWrapper release [2024-09-02 11:40:02.552] [7849] [info] [iris_rtc_spatial_audio_engine_impl.cc:212] IrisLocalSpatialAudioEngineImpl Release [2024-09-02 11:40:02.552] [7849] [info] [iris_rtc_spatial_audio_engine_wrapper.cc:388] ILocalSpatialAudioEngineWrapper release [2024-09-02 11:40:02.552] [7849] [info] [iris_rtc_media_recorder_impl.cc:24] IrisMediaRecorderImpl Release [2024-09-02 11:40:02.553] [7849] [info] [iris_rtc_music_center_impl.cc:26] IrisMusicCenterImpl Release [2024-09-02 11:40:02.553] [7849] [info] [iris_rtc_music_center_wrapper.cc:27] IrisMusicContentCenterWrapper release [2024-09-02 11:40:02.554] [7849] [info] [iris_rtc_engine_wrapper.cc:8115] IRtcEngineWrapper release [2024-09-02 11:40:02.876] [7849] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_release ret 0 result {"result":0} [2024-09-02 11:40:02.878] [7849] [error] [iris_rtc_engine_impl.cc:69] error code: -7 [2024-09-02 11:40:02.895] [7849] [info] [iris_rtc_engine_impl.cc:42] IrisRtcEngineImpl Destroy [2024-09-02 11:40:02.897] [7849] [info] [iris_rtc_music_center_impl.cc:16] IrisMusiImpl Destroy [2024-09-02 11:40:02.898] [7849] [info] [iris_rtc_media_recorder_impl.cc:13] IrisMediaRecodrerImpl Destroy [2024-09-02 11:40:02.899] [7849] [info] [iris_rtc_spatial_audio_engine_impl.cc:201] IrisLocalSpatialAudioEngineImpl Destroy [2024-09-02 11:40:02.899] [7849] [info] [iris_rtc_media_player_impl.cc:26] IrisMediaPlayerImpl Destroy [2024-09-02 11:40:02.899] [7849] [info] [iris_rtc_device_manager_impl.cc:25] IrisRtcDeviceManagerImpl Destroy ```

Flutter Doctor output

Doctor output ```console [✓] Flutter (Channel stable, 3.22.2, on Pop!_OS 22.04 LTS 6.9.3-76060903-generic, locale en_US.UTF-8) • Flutter version 3.22.2 on channel stable at /home/sahilpervez/dev/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 761747bfc5 (3 months ago), 2024-06-05 22:15:13 +0200 • Engine revision edd8546116 • Dart version 3.4.3 • DevTools version 2.34.3 [✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0) • Android SDK at /home/sahilpervez/Android/Sdk/ • Platform android-35, build-tools 35.0.0 • ANDROID_HOME = /home/sahilpervez/Android/Sdk/ • Java binary at: /home/sahilpervez/.local/share/JetBrains/Toolbox/apps/android-studio/jbr/b in/java • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11609105) • All Android licenses accepted. [✓] Chrome - develop for the web • Chrome at google-chrome [✓] Linux toolchain - develop for Linux desktop • Ubuntu clang version 14.0.0-1ubuntu1.1 • cmake version 3.22.1 • ninja version 1.10.1 • pkg-config version 0.29.2 [✓] Android Studio (version 2024.1) • Android Studio at /home/sahilpervez/.local/share/JetBrains/Toolbox/apps/android-studio • Flutter plugin version 81.0.2 • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11609105) [✓] VS Code (version 1.92.2) • VS Code at /usr/share/code • Flutter extension version 3.94.0 [✓] Connected device (3 available) • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 14 (API 34) (emulator) • Linux (desktop) • linux • linux-x64 • Pop!_OS 22.04 LTS 6.9.3-76060903-generic • Chrome (web) • chrome • web-javascript • Google Chrome 128.0.6613.113 [✓] Network resources • All expected network resources are available. • No issues found! ```
littleGnAl commented 2 months ago

I think you need to listen to the onLocalVideoStateChanged callback to handle this. https://github.com/AgoraIO-Extensions/Agora-Flutter-SDK/blob/5fa017aceceb33035c5a72f0ddd82a5e7e533606/example/lib/examples/advanced/screen_sharing/screen_sharing.dart#L66

Sahilpervez commented 2 months ago

I think you need to listen to the onLocalVideoStateChanged callback to handle this.

https://github.com/AgoraIO-Extensions/Agora-Flutter-SDK/blob/5fa017aceceb33035c5a72f0ddd82a5e7e533606/example/lib/examples/advanced/screen_sharing/screen_sharing.dart#L66

This resolved the issue!! I was stuck in this problem from past 2 weeks

Thanks a lot @littleGnAl for your help.

github-actions[bot] commented 2 months ago

Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. If you find this problem please file a new issue with the same description, what happens, logs and the output. All system setups can be slightly different so it's always better to open new issues and reference the related ones. Thanks for your contribution.

Sahilpervez commented 2 months ago

WhatsApp Image 2024-10-02 at 11 42 27 PM

@littleGnAl This is the iOS system dialog box if we start the broadcast and then stop or restart the broadcast I didn't find any option or listeners to listen to the Stop Broadcast Button shown in the above screenshot, so that we can close the screen sharing engine and again initialize the engine if we restart the broadcast.

Can you please help me with this issue, I've been stuck at this since 3 weeks.

RonanJehnna commented 2 months ago

@Sahilpervez @littleGnAl I am also stuck on the same iOS issue

littleGnAl commented 1 month ago

@RonanJehnna @Sahilpervez Do you mean that you want to start screen-sharing even if your app has not been opened?

RonanJehnna commented 1 month ago

@littleGnAl No, actually we start screen sharing for that we start screen sharing from agora and call native method written in AppDelegate.swift to show the dialog for screen sharing but that dialog box is not closing once you start the video call and you the option to stop video call from that dialog box. so if I stop at the same time how can i listen to stop event in flutter. As dialog box was created from AppDelegate.swift. and also after stopping the screen sharing from native dialog box it gives option to start screen sharing again how can we listen to that event.

RonanJehnna commented 1 month ago

@littleGnAl

  1. Flutter app button to screen Share
  2. Flutter app calls the native ios method to open the dailog box (show above in picture)
  3. Now we can start and stop screen sharing a lot of times from here as dialog box does not close on its own.
  4. now I press the start screen share button in dialog, after start button is pressed in dialog box it changes to stop Broadcast button.
  5. I tap the Stop Broadcast button and Stop Broadcast button is changed to Start Broadcast and I tap the Start Broadcast button again
  6. Button now in flutter I am not able to catch this start event again as it is started from native dialog and not from flutter.

What I want is to listen to start and stop events in flutter which are triggered from this native ios dialog box.

littleGnAl commented 1 month ago

Does the onLocalVideoStateChanged receive any callbacks?

RonanJehnna commented 1 month ago

AppDelegate.swift


import UIKit
import Flutter
import GoogleMaps
import ReplayKit

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  var eventSink: FlutterEventSink?  // Make eventSink accessible to the entire class

  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    GeneratedPluginRegistrant.register(with: self)

    let controller: FlutterViewController = window?.rootViewController as! FlutterViewController

    // MethodChannel to receive method calls from Flutter
    let methodChannel = FlutterMethodChannel(
        name: "screensharing_ios",
        binaryMessenger: controller.binaryMessenger)

    methodChannel.setMethodCallHandler { [weak self] (call: FlutterMethodCall, result: @escaping FlutterResult) in
        guard let self = self else { return }
        switch call.method {
        case "startScreenSharing":
            self.startScreenSharing()
            result(true)
        case "stopScreenSharing":
            self.stopScreenSharing()
            result(true)
        default:
            result(FlutterMethodNotImplemented)
        }
    }

    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }

  func startScreenSharing() {
    if let url = Bundle.main.url(forResource: nil, withExtension: "appex", subdirectory: "PlugIns"),
       let bundle = Bundle(url: url) {
        let picker = RPSystemBroadcastPickerView(frame: CGRect(x: 0, y: 0, width: 100, height: 200))
        picker.showsMicrophoneButton = true
        picker.preferredExtension = bundle.bundleIdentifier

        window?.rootViewController?.view.addSubview(picker)

        let recorder = RPScreenRecorder.shared()
        let recordingObserver = recorder.observe(\.isRecording, options: [.new]) { [weak self] (recorder, change) in
            guard let self = self else { return }
            if recorder.isRecording {
                picker.removeFromSuperview()
                self.eventSink?("Screen sharing started")
            } else {
                self.eventSink?("Screen sharing stopped")
            }
        }

        for view in picker.subviews {
            if let button = view as? UIButton {
                button.sendActions(for: .touchUpInside)
            }
        }

        DispatchQueue.main.asyncAfter(deadline: .now() + 10.0) {
            recordingObserver.invalidate()
            picker.removeFromSuperview()
            if !recorder.isRecording {
                self.eventSink?("Screen sharing not started")
            }
        }
    } else {
        eventSink?("Error finding the broadcast extension")
    }
  }

  func stopScreenSharing() {
    let recorder = RPScreenRecorder.shared()
    if recorder.isRecording {
        recorder.stopRecording { [weak self] (previewController, error) in
            guard let self = self else { return }
            if let error = error {
                self.eventSink?(FlutterError(code: "STOP_SCREEN_SHARING_FAILED", message: error.localizedDescription, details: nil))
            } else {
                previewController?.dismiss(animated: true, completion: nil)
                self.eventSink?("Screen sharing stopped")
            }
        }
    } else {
        eventSink?("Screen sharing is not active")
    }
  }
}

in the video_call.dart

class _VideoCallState extends State<VideoCall> {
  static const MethodChannel _iosScreenShareChannel =
      MethodChannel('screensharing_ios');
      .
      .
      .
      final status = await _iosScreenShareChannel.invokeMethod('startScreenSharing');

onLocalVideoStateChanged just checks the localVideoState but how can we connect it with screensharing so that we can _iosScreenShareChannel.invokeMethod('startScreenSharing'); and _iosScreenShareChannel.invokeMethod('stopScreenSharing');

littleGnAl commented 1 month ago

@RonanJehnna

What I want is to listen to start and stop events in flutter which are triggered from this native ios dialog box.

This is not what our SDK does, the RPSystemBroadcastPickerView is controlled by the developer, you can refer to this answer to see if it helps or not https://stackoverflow.com/questions/51982235/how-to-detect-when-the-rpsystembroadcastpickerview-is-tapped

github-actions[bot] commented 1 month ago

Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. If you find this problem please file a new issue with the same description, what happens, logs and the output. All system setups can be slightly different so it's always better to open new issues and reference the related ones. Thanks for your contribution.

github-actions[bot] commented 1 month ago

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please raise a new issue.