How to determine which cameras are front and back facing when using HTML5 getUserMedia and enumerateDevices APIs? - html5-video

When accessing the camera using HTML5 getUserMedia APIs, you can either:
Request an unspecified "user" facing camera
Request an unspecified "environment" facing camera (optionally left or right)
Request a list of cameras available
Originally we used the "facing" constraint to choose the camera. If the camera faces the "user" we show it mirror image as is the convention.
We run into problems, however, when a user does not have exactly 1 user-facing and 1 environment-facing camera. They might be missing one of these, or have multiple. This can result in the wrong camera being used, or the camera not being mirrored appropriately.
So we are looking at enumerating the devices. However, I have not found a way to determine whether a video device is "user facing" and should be mirrored.
Is there any API available to determine whether a video input is "user" facing the in these APIs?

When you enumerate devices, devices that are an input may have a method called getCapabilities(). If this method is available you may call it to get a MediaTrackCapabilities object. This object has a field called facingMode which lists the valid facingMode options for that device.
For me this was empty on the PC but on my Android device it populated correctly.
Here's a jsfiddle you can use to check this on your own devices: https://jsfiddle.net/juk61c07/4/
Thanks to the comment from O. Jones for setting me in the right direction.

Related

How can you ask for an alternative video input in Safari?

To get an alternative video input from MediaDevices.getUserMedia, my understanding is that you need to pass in the deviceID as a constraint. But, in Safari, to get access to deviceIDs via enumerateDevices, I need to call getUserMedia and get permission from the browser first (maybe there's another way?). The problem is that this initial getUserMedia call only returns device info for devices I've given permission for, so I still don't have the deviceID of the alternative video input.
How can I get the deviceID for this video input?
In my case, I'm trying to find the deviceID for Snapchat's "Snap Camera". In Chrome, I'm able to find and stream this video input.

Deleting content from Sony a6300 camera

I am developing a python remote control application using the open source pysony library. The program should be able to shoot images in a loop, download them and then delete the artifacts on the camera (We can't manually format the sd card, since the idea is that, of a remote control application).
I'd like to point out, that I have read this post about the correct way of remotely deleting files. I have read the Sony API documentation and have successfully managed to control everything I need to, but the deletion of images. The camera in question is a Sony a6300, updated to the latest firmware as is its API.
The problem in question is the fact that the camera returns a success response ({'result': [], 'id': 1}) after trying to delete a set of image URIs, but the images still remain on the camera. I am using the remote control app and am connected directly to the camera wifi (making this the standard 1:1 connection). When I issue the delete command, the screen of the camera shortly displays a "controlling with smartphone... you cannot directly operate this device" message.
I have searched all around the www an can't seem to find and aswer.
Thank you in advance!

Camera Remote API for DSC-RX1RM2

I am trying to control my Camera DSC-RX1RM2 with Remote SDK.
With the PDF guide [Sony_CameraRemoteAPIbeta_API-Reference_v2.20.pdf],
I think I can use [Continuous shooting mode]API for my Camera,
But the result always return ["error": [12, "No Such Method"]].
I want to ask where is the problem?my camera or the SDK or my source?
Unfortunately, the DSC-RX1RM2 is not supported by the API. Stay tuned to the Sony Camera Remote API page for any updates on supported cameras - https://developer.sony.com/develop/cameras/.
The latest API does support the DSC-RX1RM2, just confirmed it.
Also check that your URLs are like:
http://ip:port/sony/camera
or
http://ip:port/sony/avContent
I didn't append camera or avContent at first and got similar No Such Method errors.

DSC-HX400 RAW image data & Movie Recording

I am currently testing a DSC-HX400. While I am able to do almost everything I need to with the camera there are a couple of items that are not exposed via the API that have frustrated my efforts.
1) The camera does not seem to offer an option, via the API or the camera itself, to capture images in RAW format. It does offer standard & fine JPEG format but both of those are leaving artifacts in the image that become extremely noticeable when you zoom in with an image editor. Is there a way to get the camera to capture RAW images? I do not need the SDK to return the data just to save it out to the card. If getting the RAW data is impossible has anyone found an inventive way to clean up the artifacts?
2) The camera supports both still shoot and movie mode but the API will only expose the mode that I am currently in. It makes it impossible to transition between still to movie mode (to allow recording) from the API but I can do that same transition by pressing a single button on the camera. Once I am recording a movie the API will allow me to transition back to still mode (by cancelling recording). Is there plans to support the ability to trigger a movie recording via the API if you are in a still capture mode (Seeing the firmware already supports this functionality)?
Answers to the questions below:
If the camera cannot capture RAW images, the API will not be able to either. I do not know of a way to capture RAW images but can only comment with regards to the API as I am not an expert on usage of the camera itself.
You can change between still and movie mode by using the "setShootMode" API.

Could UPnP control point display UI on Media Render

i've need to design UPnP control point device to remote control DLNA-certified TV box.
The question is could UPnP control point display UI on Media Render ? What I mean is how I could create simple control point device (like remote controller for TV), that have not any display, for example, someone could imagine UPnP Joystick.
For now, I see the only way is to send HTML (+Javasript) page to TV Box with my menu and then TV by javascript would subsribe to "cursor move" event on my control point device. And when I move my joystick to the left the cursor on TV also move to the left. Is it real scenario ?
Thank you
You should have a look at the device description of the TV box (or STB). This may contain a link to a UI to control the device, which might or might not (more likely) be helpful. If you want to roll your own, you are stuck with using the services exposed by the device.
Of course unless this device exposes other services like e.g. Samsung Smart TVs do, which expose a UPnP service to allow remote control of the TV. This is not part of DLNA though.
In essence, check out the UPnP device and service descriptions for your box and see what it offers you. You could use something like Intel Device Spy to do this. I don't think you will be able to push HTML and JavaScript to your TV though. Instead you should rather implement the event handling for user input (touch, mousemove, whatever) on let's say a mobile device and use the exposed services via SOAP/UPnP.
Depending on what platform you are targeting, you will need to bring your own UPnP library for that. Cling is a Java library that is supposed to work on Android too. It is not yet possible to use only Web technologies to implement a UPnP client (although with NetworkServiceDiscovery it may be in the future).