2020-09-27 18:38:33 +00:00
|
|
|
/*
|
|
|
|
Sailfin: a Jellyfin client written using Qt
|
|
|
|
Copyright (C) 2020 Chris Josten
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with this library; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
2020-09-25 12:46:39 +00:00
|
|
|
import QtQuick 2.6
|
|
|
|
import Sailfish.Silica 1.0
|
|
|
|
|
|
|
|
import "../components"
|
|
|
|
|
2020-09-25 13:21:08 +00:00
|
|
|
/**
|
|
|
|
* Page only containing a video player.
|
|
|
|
*
|
|
|
|
* On larger devices the video player could potentially be embedded somewhere else.
|
|
|
|
*/
|
|
|
|
|
2020-09-25 12:46:39 +00:00
|
|
|
Page {
|
|
|
|
id: videoPage
|
|
|
|
property string itemId
|
|
|
|
property var itemData
|
2020-09-25 15:14:44 +00:00
|
|
|
property int audioTrack
|
|
|
|
property int subtitleTrack
|
2020-10-09 00:33:08 +00:00
|
|
|
property real startTicks: 0 // Why is this a real? Because an integer only goes to 3:44 when the ticks are converted to doubles
|
2020-09-25 15:14:44 +00:00
|
|
|
|
2020-09-25 12:46:39 +00:00
|
|
|
allowedOrientations: Orientation.All
|
|
|
|
showNavigationIndicator: videoPlayer.hudVisible
|
|
|
|
|
|
|
|
VideoPlayer {
|
|
|
|
id: videoPlayer
|
|
|
|
anchors.fill: parent
|
|
|
|
itemId: videoPage.itemId
|
2020-09-25 13:21:08 +00:00
|
|
|
player: appWindow.mediaPlayer
|
2020-10-09 00:33:08 +00:00
|
|
|
title: itemData.name
|
2020-09-25 15:14:44 +00:00
|
|
|
audioTrack: videoPage.audioTrack
|
|
|
|
subtitleTrack: videoPage.subtitleTrack
|
2020-10-01 19:45:34 +00:00
|
|
|
startTicks: videoPage.startTicks
|
2020-09-25 13:21:08 +00:00
|
|
|
|
2020-09-25 12:46:39 +00:00
|
|
|
onLandscapeChanged: {
|
|
|
|
console.log("Is landscape: " + landscape)
|
|
|
|
//appWindow.orientation = landscape ? Orientation.Landscape : Orientation.Portrait
|
|
|
|
videoPage.allowedOrientations = landscape ? Orientation.LandscapeMask : Orientation.PortraitMask
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
onStatusChanged: {
|
2020-09-25 15:14:44 +00:00
|
|
|
switch(status) {
|
|
|
|
case PageStatus.Inactive:
|
2020-09-25 12:46:39 +00:00
|
|
|
videoPlayer.stop()
|
2020-09-25 15:14:44 +00:00
|
|
|
break;
|
|
|
|
case PageStatus.Active:
|
|
|
|
appWindow.itemData = videoPage.itemData
|
|
|
|
break;
|
2020-09-25 12:46:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|