Merge lp:~renatofilho/mediaplayer-app/fix-1365497 into lp:mediaplayer-app

Proposed by Renato Araujo Oliveira Filho
Status: Merged
Approved by: Bill Filler
Approved revision: 273
Merged at revision: 277
Proposed branch: lp:~renatofilho/mediaplayer-app/fix-1365497
Merge into: lp:mediaplayer-app
Diff against target: 85 lines (+51/-1)
2 files modified
src/qml/player/AbstractPlayer.qml (+4/-1)
src/qml/player/VideoPlayer.qml (+47/-0)
To merge this branch: bzr merge lp:~renatofilho/mediaplayer-app/fix-1365497
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Ubuntu Phablet Team Pending
Review via email: mp+234750@code.launchpad.net

Commit message

Show a proper message if the video format is not supported.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/qml/player/AbstractPlayer.qml'
2--- src/qml/player/AbstractPlayer.qml 2014-04-09 16:50:50 +0000
3+++ src/qml/player/AbstractPlayer.qml 2014-09-15 21:45:08 +0000
4@@ -40,6 +40,8 @@
5 property int backwardSeekStep: Math.min(30000, mediaPlayer.duration * 0.025)
6
7
8+ signal error(int errorCode, string errorString)
9+
10 objectName: "videoPlayer"
11 state: "stopped"
12 color: "black"
13@@ -131,7 +133,8 @@
14 property int heightMargin: aspectRatio != -1 ? (aspectRatio < parent.aspectRatio ? 0 : (height - realHeight) / 2) : -1
15
16 onError: {
17- console.log("AbstractPlayer: " + errorString)
18+ console.error("AbstractPlayer: " + error + ":" + errorString)
19+ player.error(error, errorString)
20 }
21 }
22
23
24=== modified file 'src/qml/player/VideoPlayer.qml'
25--- src/qml/player/VideoPlayer.qml 2014-02-13 18:26:52 +0000
26+++ src/qml/player/VideoPlayer.qml 2014-09-15 21:45:08 +0000
27@@ -37,6 +37,7 @@
28 property alias controlsActive: _controls.active
29 property bool componentLoaded: false
30 readonly property int seekStep: 1000
31+ property var errorDialog: null
32
33 signal timeClicked
34
35@@ -198,4 +199,50 @@
36 break;
37 }
38 }
39+
40+ Component {
41+ id: dialogPlayerError
42+
43+ Popups.Dialog {
44+ id: dialogue
45+ objectName: "playError"
46+
47+ property string errorString: ""
48+
49+ title: i18n.tr("Error playing video")
50+ text: errorString
51+
52+ Button {
53+ text: i18n.tr("Close")
54+ onClicked: PopupUtils.close(dialogue)
55+ }
56+
57+ Component.onDestruction: player.errorDialog = null
58+ }
59+ }
60+
61+ onError: {
62+ if (player.errorDialog !== null)
63+
64+ return
65+
66+ player.errorDialog = PopupUtils.open(dialogPlayerError, null)
67+ switch(errorCode) {
68+ case 1:
69+ player.errorDialog.errorString = i18n.tr("Fail to open the source video.")
70+ break;
71+ case 2:
72+ player.errorDialog.errorString = i18n.tr("Video format not supported.")
73+ break;
74+ case 3:
75+ player.errorDialog.errorString = i18n.tr("A network error occurred.")
76+ break;
77+ case 4:
78+ player.errorDialog.errorString = i18n.tr("There are not the appropriate permissions to play a media resource.")
79+ break;
80+ case 5:
81+ player.errorDialog.errorString = i18n.tr("Fail to connect with playback backend.")
82+ break;
83+ }
84+ }
85 }

Subscribers

People subscribed via source and target branches