← Back to team overview

ubuntu-phone team mailing list archive

Re: Adjusting camera settings in a Web app

 

On Thu, Mar 3, 2016 at 4:26 PM, Peter Bittner <peter.bittner@xxxxxxx> wrote:
> Dear Canonical,
> Dear Appear.in,

Hi Peter,

Thanks for documenting your attempt at making a webapp for appear.in,
this is very valuable both for other app developers and for people
working on the platform itself as it highlights a number of
shortcomings.
Let me try to answer some of your questions below:


> I'm trying to turn Appear.in into a Web app for Ubuntu Touch, for true
> video conversations "with up to 8 people for free." It works in Ubuntu
> Touch's default browser, but for a Web app there are a few things I
> need to be able to control:
>
> 1.) [Canonical] By default the browser uses the rear camera. This can
> be changed in the browser menu via Settings -> Privacy & permissions
> -> Camera & Microphone. You have to reload the web page afterwards,
> the browser does not switch the camera on an open "connection" as it
> seems. A bit clumsy, but it's possible. The browser seems to remember
> this setting for a while (when closing the browser window in the
> meantime), albeit not forever.

The setting should be remembered (not just for a while). If it isn’t,
it’s a bug. Would you mind filing a bug report at
https://bugs.launchpad.net/ubuntu/+source/webbrowser-app/+filebug with
detailed steps to reproduce?


>    Unfortunately, the menu in the right upper corner next to the
> address bar is not available in a Web app (due to the address bar
> missing completely, which is on purpose to use all of the available
> screen real estate). Is there a way specify which camera should be
> used when starting up the web app container, e.g. by a command line
> switch or so? If not, I probably have to write a Qt application and
> use the API function the web browser application is using, right? Can
> you point me to the API documentation?

The webapp container doesn’t have any option to let you select the
default camera, so you’re right that you’d have to write a QML app
embedding a WebView and set the default camera from there. There is
unfortunately no API documentation for oxide yet, but something along
those lines should work: you can enumerate the list of available
cameras with Oxide.availableVideoCaptureDevices.
This returns a list of variants with details for each camera. Each
entry in the list has the following properties: 'id' (string),
'displayName' (string), 'position' (string, one of "frontface",
"backface", "unspecified").
Once you have identified which camera you want to use, you can set it
as default by doing:

  webView.context.defaultVideoCaptureDeviceId = device.id


> 2.) [Appear.in] The text box on the login screen is somewhat squeezed
> on the Welcome screen (https://appear.in/) as soon as you start typing
> a room name. This is probably because there is so much text on top of
> the screen ("About FAQ Blog Premium") that pushes the input box
> downwards while at the same time the screen real estate is reduced
> even more by the keyboard pushing upwards. A small CSS issue.
>
> 3.) [Appear.in] Appear.in opens a room with the chat box open on the
> mobile device browser screen. This is kind of okay, because there is
> still half of the screen available for the actual video, but it would
> be nice if the chat box could be closed (by default). Is there a query
> parameter in the URL that I could use to address this issue, or do you
> guys have to work on it?
>
>    [Canonical] Otherwise I'd have to trigger a touch event on the
> "minimize chat box" button using JavaScript (or so) is there a way to
> do this? Kind of Selenium powered thingy, or via Qt something?

No. However if you go for a QML app embedding a WebView, you could
inject a userScript that does that. See how it’s done here:
https://bazaar.launchpad.net/~phablet-team/webbrowser-app/trunk/view/head:/src/Ubuntu/Web/UbuntuWebContext.qml#L45.


> 4.) [Appear.in] In case I have to write Qt code I'd love to assist
> users in logging in with native input controls. Is there a reliable
> way / API to perform the login and query the logged-in state, or do I
> have to sniff the HTML and send a usual POST request mimicking the
> input form? Same goes for the rooms locked with the user profile, can
> they be retrieved via an API function?
>
>    I've read in the FAQs [1] that it's only possible to log in using
> the native apps (Android, iOS). Looks like I can't do this either
> using the API [2]. Is there any other (official, yet undocumented)
> way?
>
>    [1] https://appear.in/information/faq/
>    [2] https://developer.appear.in/
>
> 5.) [Canonical] Will I be able to use the NPM-driven appearin-sdk in a
> (Qt) app? I'll probably have to pack and install this with the app.
> The docs in [2] say, "Note that the NPM version requires a
> pre-compilation step using something like browserify or webpack to
> work."

I don’t see why this wouldn’t work. You could basically write an
HTML/JS shell for appearIn, and load it in a QML WebView.

HTH,

 Olivier


References