Skip to content
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

GenericStream in BackgroudActivity #1454

Open
milazki opened this issue Apr 10, 2024 · 6 comments
Open

GenericStream in BackgroudActivity #1454

milazki opened this issue Apr 10, 2024 · 6 comments

Comments

@milazki
Copy link

milazki commented Apr 10, 2024

Hi, Pedro!
I am currently doing a project that allows the user to stream from the camera in the background. For this task, I used the background example, everything worked well in the background, but there was a problem with orientation: if the user turned the phone, the camera would not turn on the stream. After that, I saw a Generic Stream in your project that solves this problem, but I don't fully understand how to run it in the background. In the example, it works in the background, but if you start the stream and exit the activity, then the application crashes, is there a way to solve this problem?
Is it possible for it to work with orientation as in Generic Stream (Rotation Activity) and at the same time retain functionality in the background, as in BackgroundActivity?

@pedroSG94
Copy link
Owner

Hello,

You have an example using GenericStream in a Service here:
https://github.com/pedroSG94/RootEncoder/blob/master/app/src/main/java/com/pedro/streamer/screen/ScreenService.kt
You only need use the desired video source and audio source and conmunicate the service with the activity

@milazki
Copy link
Author

milazki commented Apr 11, 2024

Yes, thanks, it helped.
A slightly different question appeared... When the screen is rotated, the image is distorted, especially noticeable if hold the device at 45 degrees, is it possible to fix this? Saving only two modes: vertical and horizontal

@pedroSG94
Copy link
Owner

Hello,

Can you share images where I can notice the distortion?
Also, I will need a way to reproduce it. Maybe create a project with a code example

@milazki
Copy link
Author

milazki commented Apr 12, 2024

.Hello, I may have explained the problem incorrectly. I attached a video where the image stretches/distorts during rotation. Used the source code

Screen_recording_20240412.mp4

@pedroSG94
Copy link
Owner

Hello,

I can't see an image distortion.
I only can see a problem. When you rotate the device, image rotate even if your screen don't do it.
But this problem was fixed here: 784c862
This fix is available in version 2.4.4

Did you use this method to handle orientation?
https://github.com/pedroSG94/RootEncoder/blob/master/app/src/main/java/com/pedro/streamer/rotation/CameraFragment.kt#L76

@milazki
Copy link
Author

milazki commented Apr 12, 2024

I completely forgot to update the version, I used 2.4.0, I'm very sorry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants