pedroSG94 / RootEncoder

RootEncoder for Android (rtmp-rtsp-stream-client-java) is a stream encoder to push video/audio to media servers using protocols RTMP, RTSP, SRT and UDP with all code written in Java/Kotlin
Apache License 2.0
2.56k stars 773 forks source link

RtpService background camera stops when device is switched off. #1522

Open RedwanSharafatKabir opened 3 months ago

RedwanSharafatKabir commented 3 months ago

I am using RtpService for camera streaming in Android Kotlin Application. The service was perfect and was working in background even the device is switched off. But now It's not working.

I have a previous issue related this: Issue no. #1369: Title "Camera screen black when turn on device after switch off."

How to solve this issue.

pedroSG94 commented 3 months ago

Hello,

I haven't enought info for this case.

Did you test using Screen example and replace ScreenSource to CameraSource? Remember update service permissions here: https://github.com/pedroSG94/RootEncoder/blob/master/app/src/main/AndroidManifest.xml#L64 You need add camera and microphone like:

        android:foregroundServiceType="mediaProjection|camera|microphone"

If the problem persists check the service status (if the service die when you lock device). Check if you can recover camera after unlock device again or other any test to debug the case.

RedwanSharafatKabir commented 3 months ago

Hello,

I haven't enought info for this case.

Did you test using Screen example and replace ScreenSource to CameraSource? Remember update service permissions here: https://github.com/pedroSG94/RootEncoder/blob/master/app/src/main/AndroidManifest.xml#L64 You need add camera and microphone like:

        android:foregroundServiceType="mediaProjection|camera|microphone"

If the problem persists check the service status (if the service die when you lock device). Check if you can recover camera after unlock device again or other any test to debug the case.

I am using for camera. Already added this code in Manifest.

  <service android:name=".utils.servicesBackgroundForeground.RtpService"
        android:foregroundServiceType="camera|microphone" />

Still not working.

pedroSG94 commented 3 months ago

Did you tried the suggested above to debug your case? This seems a problem in the service side.

If the problem persists check the service status (if the service die when you lock device). Check if you can recover camera after unlock device again or other any test to debug the case.