Merge lp:~abreu-alexandre/webbrowser-app/front-camera-as-default-capture into lp:webbrowser-app

Proposed by Alexandre Abreu
Status: Merged
Approved by: Olivier Tilloy
Approved revision: 1484
Merged at revision: 1489
Proposed branch: lp:~abreu-alexandre/webbrowser-app/front-camera-as-default-capture
Merge into: lp:webbrowser-app
Diff against target: 217 lines (+119/-0)
6 files modified
src/app/BrowserView.qml (+90/-0)
src/app/webbrowser/Browser.qml (+10/-0)
src/app/webcontainer/WebApp.qml (+2/-0)
src/app/webcontainer/webapp-container.cpp (+12/-0)
src/app/webcontainer/webapp-container.h (+1/-0)
src/app/webcontainer/webapp-container.qml (+4/-0)
To merge this branch: bzr merge lp:~abreu-alexandre/webbrowser-app/front-camera-as-default-capture
Reviewer Review Type Date Requested Status
Olivier Tilloy functional Approve
system-apps-ci-bot continuous-integration Needs Fixing
Review via email: mp+291527@code.launchpad.net

Commit message

Set the front camera as the default for video media requests

Description of the change

Set the front camera as the default for video media requests

To post a comment you must log in.
Revision history for this message
Olivier Tilloy (osomon) wrote :

Can you please revert the changes to webbrowser-app.pot ?

Revision history for this message
Alexandre Abreu (abreu-alexandre) wrote :

> Can you please revert the changes to webbrowser-app.pot ?

yes, a missed bit,
done

Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

FAILED: Continuous integration, rev:1401
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/514/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build/516
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/516
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/509
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial/509
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/504
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/504/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/504
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/504/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/504
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/504/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/504
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/504/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/504
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/504/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/504
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/504/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/514/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

FAILED: Continuous integration, rev:1474
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/516/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/system-apps/job/build/518/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/518
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/511
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial/511
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/506/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/506/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/506
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/506/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/506
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/506/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/506
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/506/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/506
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/506/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/516/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

FAILED: Continuous integration, rev:1475
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/517/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build/519
    FAILURE: https://jenkins.canonical.com/system-apps/job/test-0-autopkgtest/label=phone-armhf,release=vivid+overlay,testname=default/48/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/519
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/512
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial/512
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/507
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/507/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/507
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/507/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/507
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/507/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/507
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/507/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/507
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/507/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/507
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/507/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/517/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

FAILED: Continuous integration, rev:1478
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/522/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build/544
    UNSTABLE: https://jenkins.canonical.com/system-apps/job/test-0-autopkgtest/label=phone-armhf,release=vivid+overlay,testname=default/57
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/544
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/532
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial/532
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/528
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/528/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/528
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/528/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/528
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/528/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/528
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/528/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/528
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/528/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/528
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/528/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/522/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Olivier Tilloy (osomon) wrote :

I’m probably missing something: why can’t this hack reside solely in the apps’ code? At app startup, check whether a specific default camera has been requested (via command-line flag), if not default to front, then enumerate all video capture devices, and set the default one accordingly if any matches.

See also a couple of inline comments.

1479. By Alexandre Abreu

tweak camera names in comments

Revision history for this message
Alexandre Abreu (abreu-alexandre) wrote :

> I’m probably missing something: why can’t this hack reside solely in the apps’
> code? At app startup, check whether a specific default camera has been
> requested (via command-line flag), if not default to front, then enumerate all
> video capture devices, and set the default one accordingly if any matches.
>
> See also a couple of inline comments.

It was a conscious decision not to go for that, and to make it something that works
across all apps out-of-the-box,

Revision history for this message
Alexandre Abreu (abreu-alexandre) :
Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

FAILED: Continuous integration, rev:1479
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/529/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build/581
    FAILURE: https://jenkins.canonical.com/system-apps/job/test-0-autopkgtest/label=phone-armhf,release=vivid+overlay,testname=default/69/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/581
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/561
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial/561
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/555
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/555/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/555
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/555/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/555
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/555/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/555
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/555/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/555
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/555/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/555
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/555/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/529/rebuild

review: Needs Fixing (continuous-integration)
1480. By Alexandre Abreu

Move the changes back to the app code instead of webview context

Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

FAILED: Continuous integration, rev:1480
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/532/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/system-apps/job/build/606/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/606
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/576
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial/576
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/569
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/569/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/569
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/569/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/569/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/569
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/569/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/569
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/569/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/569
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/569/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/532/rebuild

review: Needs Fixing (continuous-integration)
1481. By Alexandre Abreu

tweak default

Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

FAILED: Continuous integration, rev:1481
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/533/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/system-apps/job/build/608/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/608
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/578
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial/578
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/571/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/571
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/571/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/571/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/571
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/571/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/571/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/571
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/571/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/533/rebuild

review: Needs Fixing (continuous-integration)
1482. By Alexandre Abreu

Make sure that the settings are properly up to date if a default front camera is set

Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

FAILED: Continuous integration, rev:1482
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/535/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/system-apps/job/build/621/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/621
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/591
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial/591
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/584
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/584/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/584/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/584/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/584/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/584
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/584/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/584/console

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/535/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Olivier Tilloy (osomon) wrote :

In src/app/BrowserView.qml, you want i18n.dtr("oxide-qt", "Front") to pick up the translated string from oxide.

Is there really a need for a currentWebviewContext property? Can’t you simply refer to SharedWebContext.sharedContext everywhere instead? What’s the point of having a null currentWebviewContext in WebApp.qml if there is no webview yet? The context being a singleton, its lifetime should be independent from that of the webviews using it, no?

In BrowserView.qml, __internal doesn’t need to be a property, it can simply be a child of the FocusScope.

Can 'cameraIdVideoCaptureDefault' be renamed 'defaultVideoCaptureDeviceId'?
Can 'cameraPositionVideoCaptureDefault' be renamed 'defaultVideoCaptureDevicePosition'?

In BrowserView.qml, instead of connecting to 'changed' signals in an imperative manner, could you do it in a declarative way (using a Connections element)?

review: Needs Fixing
Revision history for this message
Alexandre Abreu (abreu-alexandre) wrote :

> In src/app/BrowserView.qml, you want i18n.dtr("oxide-qt", "Front") to pick up
> the translated string from oxide.

right, done,

> Is there really a need for a currentWebviewContext property? Can’t you simply
> refer to SharedWebContext.sharedContext everywhere instead? What’s the point
> of having a null currentWebviewContext in WebApp.qml if there is no webview
> yet? The context being a singleton, its lifetime should be independent from
> that of the webviews using it, no?

no, the container does not use the shared context, and the webview is delay loaded,

> In BrowserView.qml, __internal doesn’t need to be a property, it can simply be
> a child of the FocusScope.

right, done,

> Can 'cameraIdVideoCaptureDefault' be renamed 'defaultVideoCaptureDeviceId'?
> Can 'cameraPositionVideoCaptureDefault' be renamed
> 'defaultVideoCaptureDevicePosition'?

yes, done

> In BrowserView.qml, instead of connecting to 'changed' signals in an
> imperative manner, could you do it in a declarative way (using a Connections
> element)?

thank you yes, it makes things cleaner,

1483. By Alexandre Abreu

Tweaks: renaming, use Connections, use domain based translations

Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

FAILED: Continuous integration, rev:1483
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/540/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/system-apps/job/build/631/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/631
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/600
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial/600
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/593
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/593/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/593/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/593/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/593/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/593
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/593/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/593/console

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/540/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Olivier Tilloy (osomon) wrote :

I just realized that i18n.dtr("oxide-qt", "Front") as a prefix won’t work (because gettext matches only exact strings, not prefixes), you need the exact i18n’d string exposed by oxide: "Front camera" (see https://git.launchpad.net/oxide/tree/shared/browser/media/oxide_video_capture_device_factory_linux.cc#n53). A comment to specify that this should remain in sync with oxide’s source code would be useful I think.

review: Needs Fixing
Revision history for this message
Olivier Tilloy (osomon) wrote :

As a consequence of the above remark, the "Prefix" part of 'cameraNamePrefixVideoCaptureDefault' should be removed, seeing that it’s not a prefix any longer.

For consistency with the rest of the codebase, can you please rename "__internal" to "internal" (without the leading underscores) ?

Can 'currentWebviewContext' be renamed 'currentWebcontext'?

Is the 'defaultVideoCaptureMediaIdUpdated' signal really needed? Can we not connect to currentWebviewContext.onDefaultVideoCaptureDeviceIdChanged instead?

The added 'browserView' id seems to be unused. Can it be removed?

1484. By Alexandre Abreu

Update some var names; fix translation string

Revision history for this message
Alexandre Abreu (abreu-alexandre) wrote :

all comments addressed,

Revision history for this message
Alexandre Abreu (abreu-alexandre) wrote :

> Is the 'defaultVideoCaptureMediaIdUpdated' signal really needed? Can we not
> connect to currentWebviewContext.onDefaultVideoCaptureDeviceIdChanged instead?

no, the intent is to update the *initial* settings when none have been set so that it
properly reflects the current device id.
This should not be done for every video capture device changed since this part
is handled by the settings page itself,

Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

FAILED: Continuous integration, rev:1484
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/542/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/system-apps/job/build/634/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/634
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/603
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial+overlay/603
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=yakkety/603
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/596/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/596
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/596/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/596
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/596/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/596
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/596/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/596
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/596/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/596
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/596/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/596/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/596/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/596
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/596/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/542/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Olivier Tilloy (osomon) wrote :

Code changes look ok. I haven’t tested the actual functionality on a touch device though, this should be carefully tested from a silo.

review: Approve (code)
Revision history for this message
Olivier Tilloy (osomon) wrote :

Tested from silo 19 on arale (with webbrowser-app and appear.in webapp), this seems to work as intended.

review: Approve (functional)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/app/BrowserView.qml'
2--- src/app/BrowserView.qml 2016-02-09 17:04:23 +0000
3+++ src/app/BrowserView.qml 2016-06-16 18:22:11 +0000
4@@ -19,6 +19,7 @@
5 import QtQuick 2.4
6 import Ubuntu.Components 1.3
7 import Ubuntu.Unity.Action 1.1 as UnityActions
8+import com.canonical.Oxide 1.15 as Oxide
9
10 FocusScope {
11 property bool developerExtrasEnabled: false
12@@ -54,4 +55,93 @@
13 id: _osk
14 }
15 }
16+
17+ signal defaultVideoCaptureMediaIdUpdated(string defaultVideoCaptureDeviceId)
18+
19+ /**
20+ * The goal of this chunk of code is to allow one to setup
21+ * a default selection for the camera based on its position.
22+ * As requested by:
23+ * https://launchpad.net/bugs/1563398
24+ *
25+ * At the moment though, there is an Oxide bug that prevents
26+ * camera positions to be properly reported.
27+ *
28+ * https://launchpad.net/bugs/1568145
29+ *
30+ * In order to workaround this for now, we use a hack based on the fact
31+ * that in hybris backed systems, the various video capture devices' names
32+ * are reported as "Front camera" & "Back camera", the string being translated.
33+ * We used this dirty heuristic instead of the position as a fallback for now.
34+ */
35+
36+ property var currentWebcontext
37+ property string defaultVideoCaptureDeviceId
38+ property string defaultVideoCaptureDevicePosition: "frontface"
39+
40+ QtObject {
41+ id: internal
42+
43+ // "Front camera" is the user facing string returned by oxide
44+ // https://git.launchpad.net/oxide/tree/shared/browser/media/oxide_video_capture_device_factory_linux.cc#n49
45+ // It should be kept in sync.
46+ readonly property string defaultVideoCaptureDeviceUserName:
47+ (defaultVideoCaptureDevicePosition === "frontface") ?
48+ i18n.dtr("oxide-qt", "Front camera") : ""
49+
50+ readonly property string cameraPositionUnspecified: "unspecified"
51+
52+ function setupDefaultVideoCaptureDevice() {
53+ if ( ! currentWebcontext) {
54+ return
55+ }
56+
57+ var devices = Oxide.Oxide.availableVideoCaptureDevices
58+
59+ if (! currentWebcontext.defaultVideoCaptureDeviceId
60+ && devices
61+ && devices.length > 0) {
62+
63+ for (var i = 0; i < devices.length; ++i) {
64+ /**
65+ * defaultVideoCaptureDeviceId has precedence
66+ */
67+
68+ if (defaultVideoCaptureDeviceId
69+ && devices[i].id === defaultVideoCaptureDeviceId) {
70+ currentWebcontext.defaultVideoCaptureDeviceId = devices[i].id
71+ defaultVideoCaptureMediaIdUpdated(devices[i].id)
72+ break
73+ }
74+
75+ if (defaultVideoCaptureDevicePosition) {
76+ if (devices[i].position === defaultVideoCaptureDevicePosition) {
77+ currentWebcontext.defaultVideoCaptureDeviceId = devices[i].id
78+ defaultVideoCaptureMediaIdUpdated(devices[i].id)
79+ break
80+ }
81+
82+ /**
83+ * This is only there to act as a fallback with a reasonnable
84+ * heuristic that tracks the case described above.
85+ */
86+ var displayName = devices[i].displayName
87+ if (internal.defaultVideoCaptureDeviceUserName
88+ && internal.cameraPositionUnspecified === devices[i].position
89+ && displayName.indexOf(
90+ internal.defaultVideoCaptureDeviceUserName) === 0) {
91+ currentWebcontext.defaultVideoCaptureDeviceId = devices[i].id
92+ defaultVideoCaptureMediaIdUpdated(devices[i].id)
93+ break
94+ }
95+ }
96+ }
97+ }
98+ }
99+ }
100+
101+ Connections {
102+ target: Oxide.Oxide
103+ onAvailableVideoCaptureDevicesChanged: internal.setupDefaultVideoCaptureDevice()
104+ }
105 }
106
107=== modified file 'src/app/webbrowser/Browser.qml'
108--- src/app/webbrowser/Browser.qml 2016-05-23 15:49:49 +0000
109+++ src/app/webbrowser/Browser.qml 2016-06-16 18:22:11 +0000
110@@ -19,6 +19,7 @@
111 import QtQuick 2.4
112 import QtQuick.Window 2.2
113 import Qt.labs.settings 1.0
114+import Ubuntu.Web 0.2
115 import com.canonical.Oxide 1.15 as Oxide
116 import Ubuntu.Components 1.3
117 import Ubuntu.Components.Popups 1.3
118@@ -81,6 +82,15 @@
119 onMediaAccessPermissionRequested: PopupUtils.open(mediaAccessDialogComponent, null, { request: request })
120 }
121
122+ currentWebcontext: SharedWebContext.sharedContext
123+ defaultVideoCaptureDeviceId: settings.defaultVideoDevice ? settings.defaultVideoDevice : ""
124+
125+ onDefaultVideoCaptureMediaIdUpdated: {
126+ if (!settings.defaultVideoDevice) {
127+ settings.defaultVideoDevice = defaultVideoCaptureDeviceId
128+ }
129+ }
130+
131 InputDeviceModel {
132 id: miceModel
133 deviceFilter: InputInfo.Mouse
134
135=== modified file 'src/app/webcontainer/WebApp.qml'
136--- src/app/webcontainer/WebApp.qml 2016-04-29 20:19:23 +0000
137+++ src/app/webcontainer/WebApp.qml 2016-06-16 18:22:11 +0000
138@@ -62,6 +62,8 @@
139 // not possible https://bugs.launchpad.net/autopilot-qt/+bug/1273956
140 property alias generatedUrlPatterns: urlPatternSettings.generatedUrlPatterns
141
142+ currentWebcontext: currentWebview ? currentWebview.context : null
143+
144 actions: [
145 Actions.Back {
146 enabled: webapp.backForwardButtonsVisible && containerWebView.currentWebview && containerWebView.currentWebview.canGoBack
147
148=== modified file 'src/app/webcontainer/webapp-container.cpp'
149--- src/app/webcontainer/webapp-container.cpp 2016-05-09 22:51:50 +0000
150+++ src/app/webcontainer/webapp-container.cpp 2016-06-16 18:22:11 +0000
151@@ -154,6 +154,7 @@
152 m_window->setProperty("accountProvider", m_accountProvider);
153 m_window->setProperty("accountSwitcher", m_accountSwitcher);
154 m_window->setProperty("openExternalUrlInOverlay", m_openExternalUrlInOverlay);
155+ m_window->setProperty("defaultVideoCaptureCameraPosition", m_defaultVideoCaptureCameraPosition);
156
157 m_window->setProperty("webappUrlPatterns", m_webappUrlPatterns);
158 QQmlContext* context = m_engine->rootContext();
159@@ -324,6 +325,15 @@
160 out << " --enable-media-hub-audio enable media-hub for audio playback" << endl;
161 out << " --user-agent-string=USER_AGENT overrides the default User Agent with the provided one." << endl;
162 out << " --open-external-url-in-overlay if url patterns are defined, all external urls are opened in overlay instead of browser" << endl;
163+
164+ // The options should be kept in sync with:
165+ // http://bazaar.launchpad.net/~oxide-developers/oxide/oxide.trunk/view/head:/qt/quick/api/oxideqquickglobal.cc#L43
166+ out << " --camera-capture-default=position set a default for the camera capture device in W3C Media API, 'position' should be"
167+ " 'frontface', 'backface' or 'none'. If 'none' is selected the default"
168+ " selection mechanism applied in Oxide is used. If this command line option"
169+ " is not used, the default is set to 'frontface'. If the position is not found"
170+ " the behavior is the same as if the option was not set."<< endl;
171+
172 out << "Chrome options (if none specified, no chrome is shown by default):" << endl;
173 out << " --enable-back-forward enable the display of the back and forward buttons (implies --enable-addressbar)" << endl;
174 out << " --enable-addressbar enable the display of a minimal chrome (favicon and title)" << endl;
175@@ -381,6 +391,8 @@
176 m_userAgentOverride = argument.split("--user-agent-string=")[1];
177 } else if (argument == "--open-external-url-in-overlay") {
178 m_openExternalUrlInOverlay = true;
179+ } else if (argument.startsWith("--camera-capture-default=")) {
180+ m_defaultVideoCaptureCameraPosition = argument.split("--camera-capture-default=")[1];
181 }
182 }
183 }
184
185=== modified file 'src/app/webcontainer/webapp-container.h'
186--- src/app/webcontainer/webapp-container.h 2016-05-05 15:20:35 +0000
187+++ src/app/webcontainer/webapp-container.h 2016-06-16 18:22:11 +0000
188@@ -73,6 +73,7 @@
189 QString m_userAgentOverride;
190 QScopedPointer<WebappContainerHelper> m_webappContainerHelper;
191 QScopedPointer<SchemeFilter> m_schemeFilter;
192+ QString m_defaultVideoCaptureCameraPosition;
193
194 static const QString URL_PATTERN_SEPARATOR;
195 static const QString LOCAL_SCHEME_FILTER_FILENAME;
196
197=== modified file 'src/app/webcontainer/webapp-container.qml'
198--- src/app/webcontainer/webapp-container.qml 2016-04-22 13:52:07 +0000
199+++ src/app/webcontainer/webapp-container.qml 2016-06-16 18:22:11 +0000
200@@ -46,6 +46,7 @@
201 property string localUserAgentOverride: ""
202 property bool blockOpenExternalUrls: false
203 property bool openExternalUrlInOverlay: false
204+ property string defaultVideoCaptureCameraPosition: ""
205 property bool popupBlockerEnabled: true
206
207 currentWebview: webappViewLoader.item ? webappViewLoader.item.currentWebview : null
208@@ -90,6 +91,9 @@
209 webappUrlPatterns: root.webappUrlPatterns
210 blockOpenExternalUrls: root.blockOpenExternalUrls
211 openExternalUrlInOverlay: root.openExternalUrlInOverlay
212+ defaultVideoCaptureDevicePosition: root.defaultVideoCaptureCameraPosition ?
213+ root.defaultVideoCaptureCameraPosition
214+ : browser.defaultVideoCaptureDevicePosition
215 popupBlockerEnabled: root.popupBlockerEnabled
216
217 popupRedirectionUrlPrefixPattern: root.popupRedirectionUrlPrefixPattern

Subscribers

People subscribed via source and target branches

to status/vote changes: