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"
|
|
|
|
|
2021-02-13 23:21:49 +00:00
|
|
|
import nl.netsoj.chris.Jellyfin 1.0
|
|
|
|
|
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
|
2021-02-14 23:27:36 +00:00
|
|
|
// PlaybackBar will hide itself when it encounters a page with such a property
|
|
|
|
property bool __hidePlaybackBar: true
|
2021-02-13 23:21:49 +00:00
|
|
|
property JellyfinItem itemData
|
2020-09-25 15:14:44 +00:00
|
|
|
property int audioTrack
|
|
|
|
property int subtitleTrack
|
2021-02-13 23:21:49 +00:00
|
|
|
property bool resume: true
|
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
|
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
|
2021-02-13 23:21:49 +00:00
|
|
|
resume: videoPage.resume
|
|
|
|
item: itemData
|
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
|
|
|
|
}
|
2021-02-14 12:29:30 +00:00
|
|
|
|
2020-09-25 12:46:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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:
|
2021-02-14 12:29:30 +00:00
|
|
|
videoPlayer.start()
|
2020-09-25 15:14:44 +00:00
|
|
|
appWindow.itemData = videoPage.itemData
|
|
|
|
break;
|
2020-09-25 12:46:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|