mirror of
https://github.com/HenkKalkwater/harbour-sailfin.git
synced 2024-11-22 09:15:18 +00:00
Added video playback error screen
This commit is contained in:
parent
25760bfab9
commit
fa1118a7f3
|
@ -48,6 +48,7 @@ DISTFILES += \
|
||||||
qml/components/itemdetails/SeriesDetails.qml \
|
qml/components/itemdetails/SeriesDetails.qml \
|
||||||
qml/components/itemdetails/UnsupportedDetails.qml \
|
qml/components/itemdetails/UnsupportedDetails.qml \
|
||||||
qml/components/itemdetails/VideoTrackSelector.qml \
|
qml/components/itemdetails/VideoTrackSelector.qml \
|
||||||
|
qml/components/videoplayer/VideoError.qml \
|
||||||
qml/components/videoplayer/VideoHud.qml \
|
qml/components/videoplayer/VideoHud.qml \
|
||||||
qml/cover/CoverPage.qml \
|
qml/cover/CoverPage.qml \
|
||||||
qml/cover/PosterCover.qml \
|
qml/cover/PosterCover.qml \
|
||||||
|
|
|
@ -17,7 +17,7 @@ SilicaItem {
|
||||||
property int progress
|
property int progress
|
||||||
readonly property bool landscape: videoOutput.contentRect.width > videoOutput.contentRect.height
|
readonly property bool landscape: videoOutput.contentRect.width > videoOutput.contentRect.height
|
||||||
property MediaPlayer player
|
property MediaPlayer player
|
||||||
readonly property bool hudVisible: !hud.hidden
|
readonly property bool hudVisible: !hud.hidden || player.error !== MediaPlayer.NoError
|
||||||
property alias audioTrack: mediaSource.audioIndex
|
property alias audioTrack: mediaSource.audioIndex
|
||||||
property alias subtitleTrack: mediaSource.subtitleIndex
|
property alias subtitleTrack: mediaSource.subtitleIndex
|
||||||
|
|
||||||
|
@ -74,6 +74,11 @@ SilicaItem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VideoError {
|
||||||
|
anchors.fill: videoOutput
|
||||||
|
player: playerRoot.player
|
||||||
|
}
|
||||||
|
|
||||||
function stop() {
|
function stop() {
|
||||||
player.stop()
|
player.stop()
|
||||||
player.source = ""
|
player.source = ""
|
||||||
|
|
69
qml/components/videoplayer/VideoError.qml
Normal file
69
qml/components/videoplayer/VideoError.qml
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
import QtQuick 2.6
|
||||||
|
import Sailfish.Silica 1.0
|
||||||
|
import QtMultimedia 5.6
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: videoError
|
||||||
|
property MediaPlayer player
|
||||||
|
color: pal.palette.overlayBackgroundColor
|
||||||
|
opacity: player.error === MediaPlayer.NoError ? 0.0 : 1.0
|
||||||
|
Behavior on opacity { FadeAnimator {} }
|
||||||
|
|
||||||
|
SilicaItem {
|
||||||
|
id: pal
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
anchors.margins: Theme.horizontalPageMargin
|
||||||
|
|
||||||
|
Label {
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
font.pixelSize: Theme.fontSizeExtraLarge
|
||||||
|
color: Theme.errorColor
|
||||||
|
text: {
|
||||||
|
switch(player.error) {
|
||||||
|
case MediaPlayer.ResourceError:
|
||||||
|
//: Video playback error: out of resources
|
||||||
|
qsTr("Resource allocation error")
|
||||||
|
break;
|
||||||
|
case MediaPlayer.FormatError:
|
||||||
|
//: Video playback error: unsupported format/codec
|
||||||
|
qsTr("Video format unsupported")
|
||||||
|
break;
|
||||||
|
case MediaPlayer.NetworkError:
|
||||||
|
//: Video playback error: network error
|
||||||
|
qsTr("Network error")
|
||||||
|
break;
|
||||||
|
case MediaPlayer.AccessDenied:
|
||||||
|
//: Video playback error: access denied
|
||||||
|
qsTr("Access denied")
|
||||||
|
break;
|
||||||
|
case MediaPlayer.ServiceMissing:
|
||||||
|
//: Video playback error: the media cannot be played because the media service could not be instantiated.
|
||||||
|
qsTr("Media service missing")
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
text: player.errorString
|
||||||
|
color: Theme.errorColor
|
||||||
|
width: videoError.width - Theme.horizontalPageMargin * 2
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Item { width: 1; height: Theme.paddingLarge; }
|
||||||
|
|
||||||
|
ButtonLayout {
|
||||||
|
Button {
|
||||||
|
//: Button to retry loading a video after a failure
|
||||||
|
text: qsTr("Retry")
|
||||||
|
onClicked: player.play()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -267,6 +267,34 @@
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>VideoError</name>
|
||||||
|
<message>
|
||||||
|
<source>Resource allocation error</source>
|
||||||
|
<extracomment>Video playback error: out of resources</extracomment>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Video format unsupported</source>
|
||||||
|
<extracomment>Video playback error: unsupported format/codec</extracomment>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Network error</source>
|
||||||
|
<extracomment>Video playback error: network error</extracomment>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Access denied</source>
|
||||||
|
<extracomment>Video playback error: access denied</extracomment>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Media service missing</source>
|
||||||
|
<extracomment>Video playback error: the media cannot be played because the media service could not be instantiated.</extracomment>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>VideoTrackSelector</name>
|
<name>VideoTrackSelector</name>
|
||||||
<message>
|
<message>
|
||||||
|
|
Loading…
Reference in a new issue