I am developing an application that sends specific commands to a DJI Phantom 3 Advanced. I am trying to have Google Maps on the main screen and have a small square of the camera view on the bottom left of the screen. However, I can't manage to see the camera on this square. Any help ?
The way I created the same thing is to have the map and the video stream implemented in separate Fragments. The map fragment is match_parent and the video fragment is a percentage of the screen and anchored in lower-right.
Hope this helps; it should be fairly straight forward once you have the fragment working.
Related
I want to add mirror effect in live camera preview screen.im using open camera library.can anyone help me to achieve this I'm stuck last couple of days.
I have been trying to use the ML Kit Vision Quickstart Sample App to develop a blink detection app.
For this, I have been using the Face Detector module with the CameraX library.
On installing the sample app on my Android phone, I found that rotating the device with Screen Rotation locked makes the app unable to detect faces, as expected.
I want to know how I should modify the code to override the Screen Rotation lock on the device, so that the app automatically rotates its orientation to detect faces.
To override the screen lock you may add the next tag to your target activity in the manifest:
android:screenOrientation="sensor"
Although this will only allow to rotate the activity regardless the screen lock. You still need to handle the orientation changes for the camera code. What I mean is that your camera lens is a fixed device and it doesn't rotate, therefore you need to handle image rotation by code.
I am trying to implement an in-app camera to my application, which will allow me to take either a still photo or a video, with the result being stored in a variable.
So basically the top tabs (HOME, GALLERY, CAMERA, EFFECTS) are all Fragments. Assuming we are currently on the "CAMERA" tab, inside this view you will have two further tabs at the bottom one for taking still shots and the other for video, the rest of the screen should be taken up by a camera interface showing the cameras view.
The Android developer documentation mainly talks about using androids built in camera and then saving the result in one of my own variables, which I dont want to do.
Resouces I have taken a look at
Android developer documentation
Random Google tutorials & stackoverflow
Android arsenal and 3rd party created libraries.
Material Camera looks good but as soon as I try and add its dependancy to my app, the build gradle throws an error, so that one doesn't work.
CWAC-Cam2 looks really complicated, I don't understand how to implement it.
This is the resource you couldn't find: Using Camera inside app
Basically for taking photo you'll need to access the camera resource through:
Camera.open()
Then create a class for showing the preview like the following:
public class CameraPreview extends SurfaceView implements SurfaceHolder.Callback
For capturing you'll need a PictureCallback.
For video recording checkt the first source at the Capturing videos section; there you'll need a MediaRecorder.
I am wondering if it is possible to show the output of the camera running on your device immediately on the screen. Just like the native camera app does.
I have to show the picture, that comes into the camera lens, and additionally add some graphics overlays. That's why I guess, starting an Intent to open the camera activity is not suitable.
I've found some SO Threads, Tutorials and documentation about using the Android Camera API, but they are all able to just take a picture and display it afterwards.
Is it possible at all?
Refer to this link Camera Tutorial for Android (using surfaceview)!
Use the SurfaceView to preview the camera output, then, you can add your graphics overlays as you wish.
Hope this helps :)
I'm building an app for Android using the YouTube API. The video is in a scroll widget, and when I scroll and the video goes up or down the screen, it stops. I want the video to continue even though isn't in the screen. How can I do that?
i went through the same problem, i open this question:
Android YouTube API video pause when rotate screen or hide player
see the comments to understand better. For the tests I did, the Youtube API knows when the player is not showing on the screen and just pause the video. As a workaround I changed my layout so that the player be fixed on the screen, just as is the official app from youtube.
I use this question as reference:
Scrolling Text Above Buttons, Buttons Fixed At Bottom