How to display camera within a Form/Page? - android

I'm currently working on what you could call a pet project, in which I need to display the camera. I've gotten that to work so far, but the idea behind it requires the view of the camera to not take up the entire screen. How can I "limit" or attach it to some other object/view that I can limit in size so as that I don't take up the entire screen, and thus I can add text/buttons/etc that the user can interact with while at the same time viewing the camera content?

You'll have to use some different native APIs to get a view that can show the camera feed. This is a different approach from using something like the Media Plugin which shows the built-in platform cameras. For example, you would use AVCaptureSession for iOS. Luckily, we have a doc on doing just what you want here. The example code is quite large so I won't paste here. There is a GitHub project you can explore for the full source code here.
The basic idea is to create a renderer for the platform APIs that give you access to camera data that can be embedded in a view.
iOS:
AVCaptureSession, AVCaptureDeviceInput and AVCaptureStillImageOutput
Android:
SurfaceTexture and TextureView help

Related

Problem watching youtube or other videos fullscreen in TWebbrowser under Android using delphi

I'm doing an App for android using delphi FMX and TWebbrowser, the user would select a video from the listview which will then playback the video in a TWebbrowser control, the problem I'm facing is, even if the video is a youtube video as an example, I press on the maximize symbol, the video wont go fullscreen, nothing changes. is the a work around or am I doing something wrong. thanks. I'm using delphi 10.3.3
You're not doing anything wrong - TWebBrowser needs to use a descendant of WebChromeClient (something that must be done in Java) that implements certain methods, as per this article:
https://medium.com/#oliverdamjan2013/fullscreen-youtube-video-in-webview-android-21f1c778cf56
I do something similar in this demo:
https://github.com/DelphiWorlds/Kastri/tree/master/Demos/WebBrowserFileChooser
Which makes use of a descendant of WebChromeClient that implements onShowFileChooser. The folder that has the Java code is here:
https://github.com/DelphiWorlds/Kastri/tree/master/Java/WebChromeClient
The code could be extended to implement the necessary methods (onShowCustomView etc) as per the other article linked to.
EDIT 10-NOV-2020
I've now updated the underlying Java code and updated the demo here:
https://github.com/DelphiWorlds/Kastri/tree/master/Demos/WebBrowserFileChooser
(rather than create a whole new demo)
To support viewing YouTube videos full screen. Please note that the demo relies on files in the Kastri library

Create Custom Camera view using Ionic

I want to create a Photo Capture app using Ionic. I have gone through Cordova Camera Plugin and the examples only shows how to open native camera on button click.
Is there a way to load the Camera view directly in the app (like default camera app, snapchat etc.)?
I want to open camera inside the app because I want to further add options to the camera, open gallery when user slides the camera etc.
Any help is much appreciated.
Thanks
The problem is similar to this question but the response does not solve my problem.
I don't know how to accomplish this with the plugins that currently exist but it might be helpful for you to know what terminology is used when describing this problem. Specifically it sounds like you're wanting to use a custom camera overlay or what is sometimes called a custom camera. You'd likely need to create your own plugin to do what you described but could use something like this as a base: https://github.com/performanceactive/phonegap-custom-camera-plugin
You can use cordova-plugin-camera-preview that allows camera interaction from inside the application.

Is it possible to use Android's native camera controls/graphics in your own app?

I don't want my app to open the existing camera app via an intent such as:
http://developer.android.com/guide/topics/media/camera.html#intents
I basically want to use my own custom Camera object with a SurfaceView (which is simple enough and fully documented) but I want the camera layout to look like the phone's stock graphics for a camera. The take photo button, flash button, etc. though I don't believe I have access the the native android.r.drawables for these specific buttons correct? And I can't simply copy the graphic for a particular button from the sdk folder and put that in my own drawables folder as it has to be dynamic per device to look like that phone's camera app.
Can anyone find official documentation from Android that says this can't be done? I need to know officially this is or is not doable.
Thanks in advance.
You can download the source of the camera app. It contains all of the resources.
See this post https://stackoverflow.com/a/1105311/661079

How can I capture the whole web page in an Android phone while using its browser?

When I visit a web page using Android browser I can capture the visible part of the web page making a screenshot of the whole screen, but I need capture the whole web page, including the part of the web page that is outside the screen, I mean, not just the visible part of the page.
What I want is something like the option "Capture Entire Page" of Awesome Screenshot plugin. Pls, exclude all the programming method for do this, I want a already made tool easy to use for a newbie Android. The idea is allow common users reports layout bugs easily. So, what tool can I use to accomplish that?
A VALID REPLY IS SUCH TOOL NOT EXIST, but pls, put some reference.
You can use the Dolphin browser and Screen Cut add-on to capture full webpages on an Android phone. You do not need root access.
You cannot use any standard android method to get screenshot of entire screen (including non visible portion). But if you have root access, you can read the framebuffer to get the entire contents using this method
https://play.google.com/store/apps/details?id=com.leavjenn.longshot
This does exactly what you want. I have tested it.

Use a HTML page as Live Wallpaper in Android

Can I use a HTML page as a Live Wallpaper?
Or is it possible to capture a web page as an image and set it as a wallpaper?
Any help would be greatly appreciated.
I am the author of the mentioned WebLiveWallpaper. It can use both techniques: Showing a web snapshot from snapr, webthumb, ... but normally it is really a WebView which has disadvantages but also some advantages. A web snapshot/thumb image cannot update animated images fast enough. But it avoids the problems a 'hacked' WebView in a live wallpaper has (like missing images, huge memory footprint).
I think what you want is using one of these:
http://www.websnapr.com/
http://webthumb.bluga.net/home
http://snapr.seekxl.de
They all have more and better documentation on their sites than I can put in here. Mostly it is simply a picture from their url with your key and some settings.
There is an app on the market called WebLiveWallpaper that does this. There is an option in it for how often to refresh the view of the web page, which leads me to believe that it is simply taking a snapsnot of the page and presenting it as an image some how. Unfortunately I wouldn't know how to go about setting that up. But I think you're definitely going to want to go the image route.
Edit Here are some links that may help you out:
Open source Java library to produce webpage thumbnails server-side
http://www.acasystems.com/en/web-thumb-activex/
http://www.fileguru.com/apps/convert_html_to_image_in_java
I have not used any of these components before so I'm not positive about them but they seem like they can do what your looking for .

Categories

Resources