AgoraIO-Extensions / react-native-agora

React Native around the Agora RTC SDKs for Android and iOS agora
https://www.agora.io
MIT License
624 stars 227 forks source link

Mobile> Camera doesn't get opened and user can't go live again when app is kept in background while live streaming and relaunched. #828

Open shubh435 opened 3 hours ago

shubh435 commented 3 hours ago

Android device tested on:- Google pixel 7 &Redmi 13c

Android version tested on:- 14


Steps to reproduce:

Launch the app. Log in as user with valid credentials. Tap on the live stream button in the footer . Tap on the go to live button . After 5 seconds , get the app in the background and use another app for 4-5 seconds. Get the current app in the background and launch the Swag tv app from background . Observe Workaround:- The user can go live by navigating to other screens and come back to the live streaming screen.

Expected:- When the app is getting to the background during live streaming an informative message for paused live streaming should be shown and on relaunching the app from background the camera should remains opened and live streaming should be resumed.

Actual: Camera doesn't get opened and user can't go live again when app is kept in background while live streaming and relaunched.

Note :- issue 2 > App responds in the same way when the app is unlocked after locking the mobile device.

"@types/react-native": "0.66.1", "react-native": "0.64.4",

guoxianzhe commented 2 hours ago

@shubh435

  1. you can consider of Foreground Service
  2. you can listen onLocalVideoStateChanged and will tell you the reason when the app is background with LocalVideoStreamReason.LocalVideoStreamReasonDeviceInterrupt
shubh435 commented 2 hours ago

Hi @guoxianzhe thank you for your response I checked and added the foreground services from this code https://docs.agora.io/en/help/quality-issues/android_background but nothing has changed still, the video is stuck when the app goes to the background and opens it again. LOG --------LocalVideoStreamReason.LocalVideoStreamReasonDeviceInterrupt {"reason": 0, "source": 1, "state": 0} 14 LOG --------LocalVideoStreamReason.LocalVideoStreamReasonDeviceInterrupt {"reason": 0, "source": 1, "state": 0} 14 LOG --------LocalVideoStreamReason.LocalVideoStreamReasonDeviceInterrupt {"reason": 0, "source": 1, "state": 1} 14 LOG --------LocalVideoStreamReason.LocalVideoStreamReasonDeviceInterrupt {"reason": 0, "source": 1, "state": 1} 14 LOG --------LocalVideoStreamReason.LocalVideoStreamReasonDeviceInterrupt {"reason": 14, "source": 1, "state": 3} 14 LOG --------LocalVideoStreamReason.LocalVideoStreamReasonDeviceInterrupt {"reason": 14, "source": 1, "state": 3} 14 LOG --------LocalVideoStreamReason.LocalVideoStreamReasonDeviceInterrupt {"reason": 14, "source": 0, "state": 3} 14 LOG --------LocalVideoStreamReason.LocalVideoStreamReasonDeviceInterrupt {"reason": 14, "source": 0, "state": 3} 14

shubh435 commented 1 hour ago

@guoxianzhe

I’ve attached a video showing the exact issue. Please take a moment to review it: Video Link

The problem occurs when the app is sent to the background and then reopened—it either freezes or displays a black screen. I’ve handled the necessary permissions correctly, and my app is still running in the background during this issue.