on xenial help sign in
Make sure we emit sounds when taking a screenshot even after media-hub

has restarted (LP: #1544477)

commita6b8386f77bc96e54954dab3cf7a92c93cb7819d authorAlfonso Sanchez-Beato <alfonso.sanchez-beato@canonical.com> dateWed 24 Aug 2016, 12:35 (10 years ago) parent4a6748f
1 file changed+15−3
qml/Components/NotificationAudio.qml+15−3
qml/Components/NotificationAudio.qml+15−3
@@ -23,6 +23,15 @@ Item {
2323 readonly property var playbackState: priv.audio ? priv.audio.playbackState : 0
2424
2525 function play() {
26+ /* We can be in error state if backend media player restarted, for instance */
27+ if (priv.audio && priv.audio.error) {
28+ console.warn("NotificationAudio: player in error state (" +
29+ priv.audio.errorString + "), recreating");
30+ priv.audio = null;
31+ }
32+ if (!priv.audio) {
33+ priv.audio = priv.audioComponent.createObject(root);
34+ }
2635 if (priv.audio) {
2736 priv.audio.play();
2837 }
@@ -35,9 +44,12 @@ Item {
3544
3645 QtObject {
3746 id: priv
38− property var audio: Audio {
39− source: root.source
40− audioRole: MediaPlayer.NotificationRole
47+ property Audio audio: null
48+ property Component audioComponent: Component {
49+ Audio {
50+ source: root.source
51+ audioRole: MediaPlayer.NotificationRole
52+ }
4153 }
4254 }
4355}