Picture in Picture Mode
Hi, I want to implement PIP mode for live Streamer. How can I change the texture view while streaming?
In this case you can use background example to know how to replace actual view using replaceView method (You will need use a service to avoid remove stream instance).
The idea is use replaceView with context on surfaceDestroyed callback and wait until your new openglview is recreated and use replaceView on surfaceChanged to reload your preview and if you want go back to activity exactly the same.
What is a "replaceView" ? Do you mean the new openGLView?
This is the method: https://github.com/pedroSG94/rtmp-rtsp-stream-client-java/blob/master/rtplibrary/src/main/java/com/pedro/rtplibrary/base/Camera2Base.java#L452 https://github.com/pedroSG94/rtmp-rtsp-stream-client-java/blob/master/rtplibrary/src/main/java/com/pedro/rtplibrary/base/Camera2Base.java#L457
This method allow you change preview on fly. Context if you want go to background and OpenGlView if you want change OpenGlView (maybe because you last OpenGlView was destroyed and it is not usable anymore).
with new OpenGlView I mean that for Picture in Picture maybe you need to use a widget or other different view that make your Activity die so you can use replaceView for this case.

This is the method: https://github.com/pedroSG94/rtmp-rtsp-stream-client-java/blob/master/rtplibrary/src/main/java/com/pedro/rtplibrary/base/Camera2Base.java#L452 https://github.com/pedroSG94/rtmp-rtsp-stream-client-java/blob/master/rtplibrary/src/main/java/com/pedro/rtplibrary/base/Camera2Base.java#L457
This method allow you change preview on fly. Context if you want go to background and OpenGlView if you want change OpenGlView (maybe because you last OpenGlView was destroyed and it is not usable anymore).
with new OpenGlView I mean that for Picture in Picture maybe you need to use a widget or other different view that make your Activity die so you can use replaceView for this case.
you are awesome, I inspect your suggested method and inform you about the result
@mneckoee Hi, did you manage to implement pip mode? @pedroSG94 These url's don't work, can you give working links?
https://github.com/pedroSG94/rtmp-rtsp-stream-client-java/blob/master/rtplibrary/src/main/java/com/pedro/rtplibrary/base/Camera2Base.java#L452 https://github.com/pedroSG94/rtmp-rtsp-stream-client-java/blob/master/rtplibrary/src/main/java/com/pedro/rtplibrary/base/Camera2Base.java#L457
My problem is that after starting the stream, when changing the orientation I want to change the orientation of the preview, but since the stream is already in progress I get an error "Streaming or preview stopped, ignored"
Maybe someone can help me, thank you all in advance!
Hello,
Updated links: https://github.com/pedroSG94/RootEncoder/blob/master/library/src/main/java/com/pedro/library/base/Camera2Base.java#L465 https://github.com/pedroSG94/RootEncoder/blob/master/library/src/main/java/com/pedro/library/base/Camera2Base.java#L470
About your case. You can test rotation example in the app module: https://github.com/pedroSG94/RootEncoder/tree/master/app/src/main/java/com/pedro/streamer/rotation
Try to compile the project and test rotation example.
thanks for the quick reply