import QtQuick 2.0 import Sailfish.Silica 1.0 import fi.mikkosoft.xinema 0.1 Page { id: page Column { width: parent.width spacing: Theme.paddingLarge PageHeader { title: qsTr("Playback") } Label { text: streamControl.title anchors { left: parent.left right: parent.right margins: Theme.horizontalPageMargin } horizontalAlignment: Text.AlignHCenter wrapMode: Text.WordWrap } Slider { id: slider width: parent.width minimumValue: 0.0 maximumValue: Math.max(streamControl.duration, 1.0) valueText: { var secs = Math.round(value); var mins = Math.floor(secs/60); secs %= 60; var hours = Math.floor(mins/60); mins %= 60; var str = ""; if(hours>0) { str = hours+":"; if(mins<10) str += "0"; } str += mins+":"; if(secs<10) str += "0"; return str+secs; } onDownChanged: { if(!down) streamControl.position = value; } } IconButton { id: playPauseButton anchors.horizontalCenter: parent.horizontalCenter property string action: (streamControl.playbackState==StreamControl.Playing ? "pause" : "play") icon.source: "image://theme/icon-l-"+action onPressed: { if(action=="play") streamControl.playbackState = StreamControl.Playing; else if(action=="pause") streamControl.playbackState = StreamControl.Paused; } } ChannelSelect { id: audioSelect label: "Audio" channels: streamControl.audioChannels onCurrentChannelChanged: streamControl.currentAudioChannel = currentChannel } ChannelSelect { id: spuSelect label: "Subtitles" channels: streamControl.spuChannels onCurrentChannelChanged: streamControl.currentSpuChannel = currentChannel } } StreamControl { id: streamControl control: xinemaControl onPositionChanged: { if(!slider.down) slider.value = position; } onCurrentAudioChannelChanged: audioSelect.currentChannel = streamControl.currentAudioChannel; onCurrentSpuChannelChanged: spuSelect.currentChannel = streamControl.currentSpuChannel; } }