100mslive / 100ms-flutter

Flutter Live Streaming, Video Conferencing SDK & Sample App
https://www.100ms.live/
MIT License
137 stars 68 forks source link

📚 VIDEO CAMERA AND ROOM UPDATE ISSUE - IOS #1778

Closed james-rosales closed 2 months ago

james-rosales commented 3 months ago

IOS all device The camera sometimes work, sometimes not. and when using the toggle it is not in sync. The room update is late, when another user join the room update does not call. but when the user leaves the update call

But this features works fine in android

github-actions[bot] commented 3 months ago

Hello! Thank you for filing an issue.

Please include relevant logs or detailed description for faster resolutions.

We really appreciate your contribution!

Decoder07 commented 3 months ago

Hi @james-rosales which sdk version are you using ? Also are you getting onPeerListUpdate when a new peer joins ?

james-rosales commented 3 months ago

for package this is the version hmssdk_flutter 1.10.2 the flutter version i use is 3.22.0

i dont get any prints onpeerlistupdate. i will send tomorrow video for ios

james-rosales commented 3 months ago

Here is attachment on iOS device, the camera sometimes works sometimes black. But in android it perfectly works fine. Then the in session it was working when my flutter version is 3.16.5 but when i upgrade to 3.22.0 its not working

https://github.com/100mslive/100ms-flutter/assets/114055648/87da918d-31f8-4705-96fb-650f35424dc3

`class _JoinRoomBodyState extends State<JoinRoomBody>
    implements HMSPreviewListener {
  late JoinRoomBloc _bloc;
  late HMSSDK hmsSDK;
  late HMSConfig hmsConfig;
  HMSVideoTrack? videoTrack;
  bool isVideoOn = false;
  bool isAudioOn = false;
  bool loading = true;
  @override
  void initState() {
    super.initState();
    WidgetsBinding.instance.addPostFrameCallback((_) async {
      initHMSSDK();
    });
  }

  @override
  void dispose() {
    super.dispose();
    hmsSDK.removePreviewListener(listener: this);
    hmsSDK.cancelPreview();
  }

  Future<void> initHMSSDK() async {
    hmsSDK = HMSSDK();
    await hmsSDK.build(); // ensure to await while invoking the `build` method

    dynamic authToken = await hmsSDK.getAuthTokenByRoomCode(
        roomCode: _bloc.state.roomCode?.code ?? '');
    hmsConfig = HMSConfig(
      userName: _bloc.state.student?.fullname ?? '',
      authToken: authToken,
    );

    //Here this is an instance of a class that implements HMSPreviewListener, that is, Preview
    hmsSDK.addPreviewListener(listener: this);
    hmsSDK.preview(config: hmsConfig);
  }

  @override
  void onAudioDeviceChanged(
      {HMSAudioDevice? currentAudioDevice,
      List<HMSAudioDevice>? availableAudioDevice}) {}

  @override
  void onHMSError({required HMSException error}) {}

  @override
  void onPeerUpdate({required HMSPeer peer, required HMSPeerUpdate update}) {}

  @override
  void onPreview({required HMSRoom room, required List<HMSTrack> localTracks}) {
    for (var track in localTracks) {
      if (track.kind == HMSTrackKind.kHMSTrackKindVideo) {
        setState(() {
          videoTrack = track as HMSVideoTrack;
          loading = false;
        });
      }
      if (track.kind == HMSTrackKind.kHMSTrackKindAudio) {
        setState(() {
          isAudioOn = !(track.isMute);
        });
      }
    }
    _bloc.add(RoomOnChanged(room));
  }

  @override
  void onRoomUpdate({required HMSRoom room, required HMSRoomUpdate update}) {
    _bloc.add(RoomOnChanged(room));
  }

  @override
  void onPeerListUpdate(
      {required List<HMSPeer> addedPeers,
      required List<HMSPeer> removedPeers}) {}`
Decoder07 commented 3 months ago

Hey @james-rosales Can you book a call here: https://calendly.com/saxena-pushpam/30min Lets debug it on call.

james-rosales commented 3 months ago

Sure but on monday, because the ios device is at my workplace.

Decoder07 commented 3 months ago

Hey @james-rosales are you joining ?

Decoder07 commented 3 months ago

@james-rosales you can follow this flow: https://www.100ms.live/docs/flutter/v2/how-to-guides/set-up-video-conferencing/preview Let me know if you have any questions.

james-rosales commented 3 months ago

okay sir thank you

On Mon, Jun 3, 2024 at 2:42 PM Pushpam @.***> wrote:

@james-rosales https://github.com/james-rosales you can follow this flow: https://www.100ms.live/docs/flutter/v2/how-to-guides/set-up-video-conferencing/preview Let me know if you have any questions.

— Reply to this email directly, view it on GitHub https://github.com/100mslive/100ms-flutter/issues/1778#issuecomment-2144395203, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3GFTYEQUEJWHFF2PN5DCHLZFQF7HAVCNFSM6AAAAABIQSJYE2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBUGM4TKMRQGM . You are receiving this because you were mentioned.Message ID: @.***>

Decoder07 commented 3 months ago

Hey @james-rosales were you able to resolve the issue ?

james-rosales commented 3 months ago

I've managed to fix the issue regarding the Room List Update Listener, but the video camera still not fix. Based on my test, the video camera is working fine at the first try, but when I Leave the preview screen to go back the dashboard and go back again to preview screen it only shows black screen.

In the dispose i called the hmssdk cancel preview and destroy.

James Carlo Rosales Software Engineer KODA Kollectiv Cebu, PH @. @.> +63 931 060 6090

CONFIDENTIALITY NOTICE: The contents of this email message and any attachments are intended solely for the addressee(s) and may contain confidential and/or privileged information and may be legally protected from disclosure. If you are not the intended recipient of this message or their agent, or if this message has been addressed to you in error, please immediately alert the sender by reply email and then delete this message and any attachments. If you are not the intended recipient, you are hereby notified that any use, dissemination, copying, or storage of this message or its attachments is strictly prohibited.

On Wed, Jun 5, 2024 at 2:18 PM Pushpam @.***> wrote:

Hey @james-rosales https://github.com/james-rosales were you able to resolve the issue ?

— Reply to this email directly, view it on GitHub https://github.com/100mslive/100ms-flutter/issues/1778#issuecomment-2148968865, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3GFTYACPE5KJC6M3IJH5KDZF2UUXAVCNFSM6AAAAABIQSJYE2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBYHE3DQOBWGU . You are receiving this because you were mentioned.Message ID: @.***>

Decoder07 commented 3 months ago

@james-rosales Can you share a minimal app where you are able to repro this issue.

james-rosales commented 3 months ago

I can give you the full code

On Thu, Jun 6, 2024 at 5:37 PM Pushpam @.***> wrote:

@james-rosales https://github.com/james-rosales Can you share a minimal app where you are able to repro this issue. I will have a look at the code.

— Reply to this email directly, view it on GitHub https://github.com/100mslive/100ms-flutter/issues/1778#issuecomment-2151843813, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3GFTYCJIMWETTRQQEC3KBDZGAUWVAVCNFSM6AAAAABIQSJYE2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJRHA2DGOBRGM . You are receiving this because you were mentioned.Message ID: @.***>

Decoder07 commented 3 months ago

Okay, please share the zipped project or git repo. I will check it.

ygit commented 2 months ago

@james-rosales Were you able to resolve this issue?