-
-
Notifications
You must be signed in to change notification settings - Fork 784
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can we stream to RTMP when activity is put in background. #1682
Comments
Tried with customizing StreamBase |
Hello, I don't fully understand you but you have a code example to stream in background using the app example. In this case that example use ScreenSource as videoSource but you can use any VideoSource. |
Hello, We are using Camera2Source for streaming and recording . we are testing on Android 12 device. Will try adding Service with Camera2Source. @pedroSG94 Thanks. |
Hello, Getting below error when using camera2Source with foreground Service and app is put in background java.lang.RuntimeException: drawScreen end. GL error: 1285 Using below code inside Service class Code:
|
Hello, For now, try to remove the Android view filter. Maybe the problem is that you can't render that filter properly. |
Hi @pedroSG94, Camera2Source RTMP streaming in background service is working good only when Android view filter is removed. please suggest steps to add Android view filter with backgound streaming. Thanks |
Ok, in this case you should change the way you are creating that view used in the filter. Can you share the way you are inflating the view? |
You can try using picture-in-picture mode. At least that will keep your activity running but also visible, albeit taking up a 3rd of your screen. You'll be able to interact with your device at least |
Hi @pedroSG94, Adding overlays as you suggested are working fine for RTMP streaming using foreground service. When app is in background microphone audio is not working. I think its a restriction from Android 12. Thanks for the solution. |
Hello,
RTMP Streaming using GenericStream and TextureView working good when activity is in foreground, but when app is put in background RTMP streaming stops.
NOTE: Can't use Media Projection as we need to record HD content
//STEP: 1 For showing Camera Preview
genericStream.prepareVideo(1280, 720, bitrate, 30,2, 0, -1, -1, 1280, 720, 30);
genericStream.prepareAudio(sampleRate, isStereo, aBitrate);
mTextureView.setSurfaceTextureListener(new TextureView.SurfaceTextureListener() {
});
//STEP 2: For RTMP streaming and recording local video
genericStream.startStream(rtmpUrl);
genericStream.startRecord(mediaFile.getPath(), new RecordController.Listener() {
@OverRide
public void onStatusChange(RecordController.Status status) {
How can we stream camera content when app is in backgound
The text was updated successfully, but these errors were encountered: