← Back to team overview

ubuntu-phone team mailing list archive

Re: WebContext.default[Audio | Video]CaptureDeviceId howto

 

Hi Olivier,

On Thu, Nov 3, 2016 at 5:56 AM, Olivier Tilloy <olivier.tilloy@xxxxxxxxxxxxx
> wrote:

> On Thu, Nov 3, 2016 at 3:15 AM, Felipe De La Puente
> <fdelapuente@xxxxxxxxx> wrote:
> > Hi Olivier,
> >
> > I added the mediaAccessPermissionRequested signal handler and now my
> > Audio/Video is working without having to deal with the properties
> directly.
> >
> > Now I'm getting the Audio output on the loudspeaker (Rear Speaker) of the
> > phone (mako) but I would like to change it to the earspeaker (front).
> >
> > Any hints on how to change that behavior?  (note: When I used the
> > web-container approach I observed the same behavior)
>
> I’m afraid I don’t know of a way to programatically change the audio
> output device. There’s certainly nothing webview-specific there.
>
>
I found the following link which is a proof of concept of the ability of
WebRTC code to allow the user of a webapp change the audio/video input
devices as well as the audio output devices in real time.

https://webrtc.github.io/samples/src/content/devices/input-output/

In my desktop PC running ubuntu 16.04 firefox only detects my audio input
devices but Chromium is supporting the page correctly.
In my Ubuntu Phone (mako) I observed the following:

1. The microphone is detected correctly ("default" and "Droid Primary
Source" behave equal)
2. There's a "Front Camera" and "Rear Camera". "Rear Camera" was selected
by default but it was actually the "Front Camera", then I switched to
"Front Camera" and it was still the front camera, then I switched to "Rear
Camera" again and it switched to the real rear camera.
3. For Audio output devices I had: "default", "Primary Speaker" and "Droid
Primary Sink"., all of them feeding my Rear speaker. There was no way to
change to the Ear Speaker (which is what I'm looking for).

It looks to me like this could be a bug in the Chromium/Blink code used by
Oxide in Ubuntu Touch.

Any feedback is welcome. I think I should probably open a new thread and
file a bug...

Best Regards,
Felipe.


>
>
> On Wed, Nov 2, 2016 at 3:29 PM, Felipe De La Puente <fdelapuente@xxxxxxxxx
> >
> > wrote:
> >>
> >> Hi Olivier,
> >>
> >> Thanks a lot for the help!  I wasn't aware of these documentation
> pages, I
> >> was checking the webbrowser-app code to findout the properties that
> might be
> >> of help for my purpose...
> >>
> >> I definitely did nothing related to permissions so that's probably the
> >> root cause and my next step.
> >>
> >> I thought it was similar to C++ apps where I just used the location
> >> service and at the first attempt to use it the permissions popup
> appeared...
> >>
> >> I'll give it a try and come back with more details if it doesn't work.
> >>
> >> Best Regards,
> >> Felipe.
> >>
> >> On Wed, Nov 2, 2016 at 3:21 PM, Olivier Tilloy
> >> <olivier.tilloy@xxxxxxxxxxxxx> wrote:
> >>>
> >>> On Tue, Nov 1, 2016 at 9:20 PM, Felipe De La Puente
> >>> <fdelapuente@xxxxxxxxx> wrote:
> >>> > Hi,
> >>> >
> >>> > I have been trying to create a minimal web-app by creating a Qml
> >>> > WebView
> >>> > using the default shared context plus some customization.
> >>> >
> >>> > My problem is that I can't make the Microphone nor Camera work.
> >>> >
> >>> > I have observed the following:
> >>> >
> >>> > 1. The defaultAudioCaptureDeviceId is empty by default
> >>> > 2. The defaultVideoCaptureDeviceId is empty by default
> >>> > 3. Independent of the Ids I set, I always get a Warning saying audio
> is
> >>> > not
> >>> > implemented (see below)
> >>> > 4. The web-container is able to use the microphone and camera without
> >>> > issues, so there is a way to make it work, I just don't know how.
> >>> > 5. There are apparmor violations which could be related to the issue
> >>> > 6. I'm using the following policies: networking, audio, camera,
> >>> > microphone,
> >>> > push-notification-client, video.
> >>> >
> >>> > So, the question is:  What would be the recommended way to make it
> >>> > work?
> >>> >
> >>> >
> >>> > Thannks a lot for your help!
> >>> >
> >>> > Best Regards,
> >>> > Felipe.
> >>> >
> >>> > PS:
> >>> > The following is the debug output:
> >>> >
> >>> > Loading module: 'libubuntu_application_api_touch_mirclient.so.3.0.0'
> >>> >
> >>> > shm_open() failed: Permission denied
> >>> >
> >>> > qml: Loaded 11 UA override(s) from
> >>> >
> >>> > file:///usr/lib/arm-linux-gnueabihf/qt5/qml/Ubuntu/Web/
> ua-overrides-mobile.js
> >>> >
> >>> > qml: Completed wv1
> >>> >
> >>> > qml: context.userAgent: Mozilla/5.0 (X11; Linux x86_64)
> >>> > AppleWebKit/537.36
> >>> > (KHTML, like Gecko) Ubuntu Chromium/52.0.2743.116
> Chrome/52.0.2743.116
> >>> > Safari/537.36
> >>> >
> >>> > qml: context.dataPath:
> >>> > file:///home/phablet/.local/share/wire-qmlweb.fdelapuente
> >>> >
> >>> > qml: context.cachePath:
> >>> > file:///home/phablet/.cache/wire-qmlweb.fdelapuente
> >>> >
> >>> > qml: context.defaultAudioCaptureDeviceId:
> >>> >
> >>> > qml: context.defaultVideoCaptureDeviceId:
> >>> >
> >>> > OxideQQuickWebContext: Cannot set hostMappingRules once the context
> is
> >>> > in
> >>> > use
> >>> >
> >>> > OxideQQuickWebContext: devtoolsBindIp was set to an invalid value. It
> >>> > must
> >>> > be set to a valid IPv4 or IPv6 address
> >>> >
> >>> > OxideQQuickWebContext: devtoolsPort was set to an invalid value. It
> >>> > must be
> >>> > set between 1024 and 65535
> >>> >
> >>> > OxideQQuickUserScript: url is a construct-only parameter
> >>> >
> >>> > OxideQQuickUserScript: url is a construct-only parameter
> >>> >
> >>> > OxideQQuickUserScript: url is a construct-only parameter
> >>> >
> >>> > OxideQQuickUserScript: url is a construct-only parameter
> >>> >
> >>> > OxideQQuickWebContext::Cannot set sessionCookieMode once the context
> is
> >>> > in
> >>> > use
> >>> >
> >>> > OxideQQuickWebContext: Cannot set maxCacheSizeHint once the context
> is
> >>> > in
> >>> > use
> >>> >
> >>> > OxideQQuickWebContext:: Cannot set cachePath once the context is in
> use
> >>> >
> >>> > OxideQQuickWebContext: Cannot set dataPath once the context is in use
> >>> >
> >>> > [1101/170239:ERROR:layer_tree_host_impl.cc(2233)] Forcing zero-copy
> >>> > tile
> >>> > initialization as worker context is missing
> >>> >
> >>> > Sdk-Launcher> There has been a AppArmor denial for your application.
> >>> >
> >>> > Sdk-Launcher> Most likely it is missing a policy in the AppArmor
> file.
> >>> >
> >>> > Syslog> Nov 1 17:02:39 ubuntu-phablet kernel: [28682.928291]
> type=1400
> >>> > audit(1478030559.561:439): apparmor="DENIED" operation="open"
> >>> > profile="wire-qmlweb.fdelapuente_Wire-qmlweb_0.1"
> >>> > name="/sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/reset_count"
> >>> > pid=17581
> >>> > comm="Chrome_InProcGp" requested_mask="r" denied_mask="r" fsuid=32011
> >>> > ouid=0
> >>> >
> >>> > Sdk-Launcher> There has been a AppArmor denial for your application.
> >>> >
> >>> > Sdk-Launcher> Most likely it is missing a policy in the AppArmor
> file.
> >>> >
> >>> > Syslog> Nov 1 17:02:39 ubuntu-phablet kernel: [28682.930489]
> type=1400
> >>> > audit(1478030559.561:440): apparmor="DENIED" operation="open"
> >>> > profile="wire-qmlweb.fdelapuente_Wire-qmlweb_0.1"
> >>> > name="/sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/reset_count"
> >>> > pid=17581
> >>> > comm="Chrome_InProcGp" requested_mask="r" denied_mask="r" fsuid=32011
> >>> > ouid=0
> >>> >
> >>> > Sdk-Launcher> There has been a AppArmor denial for your application.
> >>> >
> >>> > Sdk-Launcher> Most likely it is missing a policy in the AppArmor
> file.
> >>> >
> >>> > Syslog> Nov 1 17:02:39 ubuntu-phablet kernel: [28683.065572]
> type=1400
> >>> > audit(1478030559.701:441): apparmor="DENIED" operation="open"
> >>> > profile="wire-qmlweb.fdelapuente_Wire-qmlweb_0.1"
> >>> > name="/sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/reset_count"
> >>> > pid=17581
> >>> > comm="Chrome_InProcGp" requested_mask="r" denied_mask="r" fsuid=32011
> >>> > ouid=0
> >>> >
> >>> > Sdk-Launcher> There has been a AppArmor denial for your application.
> >>> >
> >>> > Sdk-Launcher> Most likely it is missing a policy in the AppArmor
> file.
> >>> >
> >>> > Syslog> Nov 1 17:02:39 ubuntu-phablet kernel: [28683.068410]
> type=1400
> >>> > audit(1478030559.701:442): apparmor="DENIED" operation="open"
> >>> > profile="wire-qmlweb.fdelapuente_Wire-qmlweb_0.1"
> >>> > name="/sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/reset_count"
> >>> > pid=17581
> >>> > comm="Chrome_InProcGp" requested_mask="r" denied_mask="r" fsuid=32011
> >>> > ouid=0
> >>> >
> >>> > Sdk-Launcher> There has been a AppArmor denial for your application.
> >>> >
> >>> > Sdk-Launcher> Most likely it is missing a policy in the AppArmor
> file.
> >>> >
> >>> > Syslog> Nov 1 17:02:39 ubuntu-phablet kernel: [28683.081168]
> type=1400
> >>> > audit(1478030559.711:443): apparmor="DENIED" operation="open"
> >>> > profile="wire-qmlweb.fdelapuente_Wire-qmlweb_0.1"
> >>> > name="/sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/reset_count"
> >>> > pid=17581
> >>> > comm="Chrome_InProcGp" requested_mask="r" denied_mask="r" fsuid=32011
> >>> > ouid=0
> >>> >
> >>> > Sdk-Launcher> There has been a AppArmor denial for your application.
> >>> >
> >>> > Sdk-Launcher> Most likely it is missing a policy in the AppArmor
> file.
> >>> >
> >>> > Syslog> Nov 1 17:02:39 ubuntu-phablet kernel: [28683.081381]
> type=1400
> >>> > audit(1478030559.711:444): apparmor="DENIED" operation="open"
> >>> > profile="wire-qmlweb.fdelapuente_Wire-qmlweb_0.1"
> >>> > name="/sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/reset_count"
> >>> > pid=17581
> >>> > comm="Chrome_InProcGp" requested_mask="r" denied_mask="r" fsuid=32011
> >>> > ouid=0
> >>> >
> >>> > ubuntumirclient: Attempted to deliver an event to a non-existent
> >>> > window,
> >>> > ignoring.
> >>> >
> >>> > Sdk-Launcher> Stopping Application
> >>>
> >>> Hi Felipe,
> >>>
> >>> It would be useful if we could see your code.
> >>>
> >>> You might want to check the documentation for the
> >>> 'defaultAudioCaptureDeviceId' property at
> >>>
> >>> http://people.canonical.com/~chrisccoulson/oxide-
> documentation/qml-com-canonical-oxide-webcontext.html#
> defaultAudioCaptureDeviceId-prop.
> >>>
> >>> In theory there is no need to set the default capture device.
> >>>
> >>> Could it be that you didn’t wire up the mediaAccessPermissionRequested
> >>> signal on your webview? This is required to allow camera/microphone
> >>> capture in the first place. See
> >>>
> >>> http://people.canonical.com/~chrisccoulson/oxide-
> documentation/qml-com-canonical-oxide-webview.html#
> mediaAccessPermissionRequested-signal
> >>> for documentation.
> >>>
> >>> HTH,
> >>>
> >>>  Olivier
> >>
> >>
> >
>

References