Merge lp:~phablet-team/unity8/sms-notif-lp1544477 into lp:unity8

Proposed by Alfonso Sanchez-Beato
Status: Merged
Approved by: Albert Astals Cid
Approved revision: 2604
Merged at revision: 2601
Proposed branch: lp:~phablet-team/unity8/sms-notif-lp1544477
Merge into: lp:unity8
Diff against target: 205 lines (+73/-34)
3 files modified
plugins/Dash/DashAudioPlayer.qml (+45/-21)
qml/Components/NotificationAudio.qml (+20/-3)
tests/qmltests/Dash/Previews/tst_PreviewAudioPlayback.qml (+8/-10)
To merge this branch: bzr merge lp:~phablet-team/unity8/sms-notif-lp1544477
Reviewer Review Type Date Requested Status
Albert Astals Cid (community) Approve
Unity8 CI Bot continuous-integration Needs Fixing
Review via email: mp+303791@code.launchpad.net

Commit message

Make sure we emit sounds when taking a screenshot even after media-hub
has restarted (LP: #1544477)

Description of the change

Make sure we emit sounds when taking a screenshot even after media-hub
has restarted (LP: #1544477)

To post a comment you must log in.
2600. By Alfonso Sanchez-Beato

Add reference to QtMultimedia bug

Revision history for this message
Albert Astals Cid (aacid) wrote :

Isn't this something we can fix in qtmultimedia? Or is it just easier to wokraround here?

If so I guess we need a similar fix in ./plugins/Dash/DashAudioPlayer.qml ?

review: Needs Information
Revision history for this message
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote :

It is quite difficult to solve in qtmultimedia in a general way. It is also unclear whether upstream would take those patches or not. Anyway, I have opened bug #1616425 to track this as we might try that in the future.

Yes, probably plugins/Dash/DashAudioPlayer.qml needs the fix too.

2601. By Alfonso Sanchez-Beato

Make sure we can play music from the scopes after media-hub restarts.

Revision history for this message
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote :

Branch refreshed after fixing DashAudioPlayer.qml

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2601
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2032/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/2666
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/1463
    FAILURE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/1463/console
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=yakkety,testname=qmluitests.sh/1463
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/2694
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/2567
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/2567
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/2567
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2561
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2561/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2561
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2561/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2561
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2561/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2561
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2561/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2561
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2561/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2561
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2561/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2561
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2561/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2561
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2561/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2561
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2561/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2032/rebuild

review: Needs Fixing (continuous-integration)
2602. By Alfonso Sanchez-Beato

Adapt unit test to DashAudioPlayer changes

2603. By Alfonso Sanchez-Beato

One more fix for PreviewAudioPlayback test

2604. By Alfonso Sanchez-Beato

Change verify to compare in test

Revision history for this message
Albert Astals Cid (aacid) wrote :

 * Did you perform an exploratory manual test run of the code change and any related functionality?
Yes

 * Did CI run pass? If not, please explain why.
Waiting for it before top-approving, but passes fine locally

review: Approve
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2603
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2041/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/2681
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/1473
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/1473
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=yakkety,testname=qmluitests.sh/1473
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/2709
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/2582
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/2582
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/2582
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2575
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2575/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2575
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2575/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2575
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2575/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2575
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2575/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2575
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2575/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2575
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2575/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2575
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2575/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2575
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2575/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2575
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2575/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2041/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

 * Did you perform an exploratory manual test run of the code change and any related functionality?
Yes

 * Did CI run pass? If not, please explain why.
Almost, known unstable unrelated tests failed

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/Dash/DashAudioPlayer.qml'
--- plugins/Dash/DashAudioPlayer.qml 2015-12-22 09:12:32 +0000
+++ plugins/Dash/DashAudioPlayer.qml 2016-08-26 08:08:57 +0000
@@ -20,16 +20,22 @@
20import Dash 0.120import Dash 0.1
2121
22QtObject {22QtObject {
23 readonly property real progress: audio.position / audio.duration23 id: root
24 readonly property bool playing: audio.playbackState === Audio.PlayingState24 readonly property real progress: priv.audio ? priv.audio.position / priv.audio.duration : 0.0
25 readonly property bool paused: audio.playbackState === Audio.PausedState25 readonly property bool playing: priv.audio ? priv.audio.playbackState === Audio.PlayingState : false
26 readonly property bool stopped: audio.playbackState === Audio.StoppedState26 readonly property bool paused: priv.audio ? priv.audio.playbackState === Audio.PausedState : false
27 readonly property alias position: audio.position27 readonly property bool stopped: priv.audio ? priv.audio.playbackState === Audio.StoppedState : true
28 readonly property url currentSource: audio.playlist.currentItemSource28 readonly property int position: priv.audio ? priv.audio.position : 0
29 readonly property url currentSource: priv.audio ? priv.audio.playlist.currentItemSource : ""
30 readonly property Playlist playlist: priv.audio ? priv.audio.playlist : null
2931
30 function playSource(newSource, newPlaylist) {32 function playSource(newSource, newPlaylist) {
33 if (!priv.audio) {
34 console.info("DashAudioPlayer: creating player");
35 priv.audio = priv.audioComponent.createObject(root);
36 }
31 stop();37 stop();
32 audio.playlist.clear();38 priv.audio.playlist.clear();
33 if (newPlaylist) {39 if (newPlaylist) {
34 // Look for newSource in newPlaylist40 // Look for newSource in newPlaylist
35 var sourceIndex = -1;41 var sourceIndex = -1;
@@ -48,35 +54,53 @@
48 for (var i in newPlaylist) {54 for (var i in newPlaylist) {
49 urls.push(newPlaylist[i]);55 urls.push(newPlaylist[i]);
50 }56 }
51 audio.playlist.addItems(urls);57 priv.audio.playlist.addItems(urls);
52 audio.playlist.currentIndex = sourceIndex;58 priv.audio.playlist.currentIndex = sourceIndex;
53 } else {59 } else {
54 audio.playlist.addItem(newSource);60 priv.audio.playlist.addItem(newSource);
55 audio.playlist.currentIndex = 0;61 priv.audio.playlist.currentIndex = 0;
56 }62 }
57 play();63 play();
58 }64 }
5965
60 function stop() {66 function stop() {
61 audio.stop();67 if (priv.audio) {
68 priv.audio.stop();
69 }
62 }70 }
6371
64 function play() {72 function play() {
65 audio.play();73 if (priv.audio) {
74 priv.audio.play();
75 }
66 }76 }
6777
68 function pause() {78 function pause() {
69 audio.pause();79 if (priv.audio) {
80 priv.audio.pause();
81 }
70 }82 }
7183
72 property QtObject audio: Audio {84 property QtObject priv: QtObject {
73 id: audio85 id: priv
74 objectName: "audio"86 property Audio audio: null
75 playlist: Playlist {87 property Component audioComponent: Component {
76 objectName: "playlist"88 Audio {
89 playlist: Playlist {
90 objectName: "playlist"
91 }
92 /* Remove player in case of error so it gets recreated next time
93 * we need it. Happens if backend media player restarted, for
94 * instance. qtmultimedia should probably handle this
95 * transparently (LP: #1616425).
96 */
97 onError: {
98 console.warn("DashAudioPlayer: error event (" +
99 priv.audio.errorString + "), destroying");
100 priv.audio.destroy();
101 }
102 }
77 }103 }
78
79 onErrorStringChanged: console.warn("Dash Audio player error:", errorString)
80 }104 }
81105
82 function lengthToString(s) {106 function lengthToString(s) {
83107
=== modified file 'qml/Components/NotificationAudio.qml'
--- qml/Components/NotificationAudio.qml 2016-04-29 20:06:54 +0000
+++ qml/Components/NotificationAudio.qml 2016-08-26 08:08:57 +0000
@@ -23,6 +23,10 @@
23 readonly property var playbackState: priv.audio ? priv.audio.playbackState : 023 readonly property var playbackState: priv.audio ? priv.audio.playbackState : 0
2424
25 function play() {25 function play() {
26 if (!priv.audio) {
27 console.info("NotificationAudio: creating player");
28 priv.audio = priv.audioComponent.createObject(root);
29 }
26 if (priv.audio) {30 if (priv.audio) {
27 priv.audio.play();31 priv.audio.play();
28 }32 }
@@ -35,9 +39,22 @@
3539
36 QtObject {40 QtObject {
37 id: priv41 id: priv
38 property var audio: Audio {42 property Audio audio: null
39 source: root.source43 property Component audioComponent: Component {
40 audioRole: MediaPlayer.NotificationRole44 Audio {
45 source: root.source
46 audioRole: MediaPlayer.NotificationRole
47 /* Remove player in case of error so it gets recreated next time
48 * we need it. Happens if backend media player restarted, for
49 * instance. qtmultimedia should probably handle this
50 * transparently (LP: #1616425).
51 */
52 onError: {
53 console.warn("NotificationAudio: error event (" +
54 priv.audio.errorString + "), destroying");
55 priv.audio.destroy();
56 }
57 }
41 }58 }
42 }59 }
43}60}
4461
=== modified file 'tests/qmltests/Dash/Previews/tst_PreviewAudioPlayback.qml'
--- tests/qmltests/Dash/Previews/tst_PreviewAudioPlayback.qml 2016-02-15 15:27:09 +0000
+++ tests/qmltests/Dash/Previews/tst_PreviewAudioPlayback.qml 2016-08-26 08:08:57 +0000
@@ -127,8 +127,6 @@
127 var track1PlayButton = findChild(track1Item, "playButton");127 var track1PlayButton = findChild(track1Item, "playButton");
128 var track2PlayButton = findChild(track2Item, "playButton");128 var track2PlayButton = findChild(track2Item, "playButton");
129129
130 var audio = DashAudioPlayer.audio;
131
132 // All progress bars must be hidden in the beginning130 // All progress bars must be hidden in the beginning
133 compare(track0ProgressBar.visible, false);131 compare(track0ProgressBar.visible, false);
134 compare(track1ProgressBar.visible, false);132 compare(track1ProgressBar.visible, false);
@@ -137,7 +135,7 @@
137 // Playing track 0 should make progress bar 0 visible135 // Playing track 0 should make progress bar 0 visible
138 mouseClick(track0PlayButton);136 mouseClick(track0PlayButton);
139137
140 tryCompare(audio, "playbackState", Audio.PlayingState);138 compare(DashAudioPlayer.playing, true);
141 checkPlayerSource(0);139 checkPlayerSource(0);
142140
143 tryCompare(track0ProgressBar, "visible", true);141 tryCompare(track0ProgressBar, "visible", true);
@@ -146,25 +144,25 @@
146144
147 // Clicking the button again should pause it. The progress bar should stay visible145 // Clicking the button again should pause it. The progress bar should stay visible
148 mouseClick(track0PlayButton);146 mouseClick(track0PlayButton);
149 tryCompare(audio, "playbackState", Audio.PausedState);147 compare(DashAudioPlayer.paused, true);
150 checkPlayerSource(0);148 checkPlayerSource(0);
151 tryCompare(track0ProgressBar, "visible", true);149 tryCompare(track0ProgressBar, "visible", true);
152150
153 // Continue playback151 // Continue playback
154 mouseClick(track0PlayButton);152 mouseClick(track0PlayButton);
155 tryCompare(audio, "playbackState", Audio.PlayingState);153 compare(DashAudioPlayer.playing, true);
156 checkPlayerSource(0);154 checkPlayerSource(0);
157155
158 // Playing track 1 should make progress bar 1 visible and hide progress bar 0 again156 // Playing track 1 should make progress bar 1 visible and hide progress bar 0 again
159 mouseClick(track1PlayButton);157 mouseClick(track1PlayButton);
160158
161 tryCompare(audio, "playbackState", Audio.PlayingState);159 compare(DashAudioPlayer.playing, true);
162 checkPlayerSource(1);160 checkPlayerSource(1);
163161
164 // Check the playlist is song 0, 1, 2162 // Check the playlist is song 0, 1, 2
165 checkPlayerUrls(tracksModel2["tracks"][0].source, audio.playlist.itemSource(0));163 checkPlayerUrls(tracksModel2["tracks"][0].source, DashAudioPlayer.playlist.itemSource(0));
166 checkPlayerUrls(tracksModel2["tracks"][1].source, audio.playlist.itemSource(1));164 checkPlayerUrls(tracksModel2["tracks"][1].source, DashAudioPlayer.playlist.itemSource(1));
167 checkPlayerUrls(tracksModel2["tracks"][2].source, audio.playlist.itemSource(2));165 checkPlayerUrls(tracksModel2["tracks"][2].source, DashAudioPlayer.playlist.itemSource(2));
168166
169 tryCompare(track0ProgressBar, "visible", false);167 tryCompare(track0ProgressBar, "visible", false);
170 tryCompare(track1ProgressBar, "visible", true);168 tryCompare(track1ProgressBar, "visible", true);
@@ -173,7 +171,7 @@
173 // Playing track 2 should make progress bar 1 visible and hide progress bar 0 again171 // Playing track 2 should make progress bar 1 visible and hide progress bar 0 again
174 mouseClick(track2PlayButton);172 mouseClick(track2PlayButton);
175173
176 tryCompare(audio, "playbackState", Audio.PlayingState);174 compare(DashAudioPlayer.playing, true);
177 checkPlayerSource(2);175 checkPlayerSource(2);
178176
179 tryCompare(track0ProgressBar, "visible", false);177 tryCompare(track0ProgressBar, "visible", false);

Subscribers

People subscribed via source and target branches