Warning, /plasma-bigscreen/youtube-voice-application/ui/YoutubePlayerBackup.qml is written in an unsupported language. File is not indexed.

0001 import QtMultimedia 5.9
0002 import QtQuick.Layouts 1.4
0003 import QtQuick 2.9
0004 import QtQuick.Controls 2.0 as Controls
0005 import org.kde.kirigami 2.4 as Kirigami
0006 import QtGraphicalEffects 1.0
0007 
0008 import Mycroft 1.0 as Mycroft
0009 
0010 import "." as Local
0011 
0012 Mycroft.Delegate {
0013     id: root
0014 
0015     property var videoSource: sessionData.video
0016     property var videoStatus: sessionData.status
0017 
0018     //graceTime: Infinity
0019 
0020     //The player is always fullscreen
0021     fillWidth: true
0022     background: Rectangle {
0023         color: "black"
0024     }
0025     leftPadding: 0
0026     topPadding: 0
0027     rightPadding: 0
0028     bottomPadding: 0
0029 
0030     onEnabledChanged: syncStatusTimer.restart()
0031     onVideoSourceChanged: syncStatusTimer.restart()
0032     Component.onCompleted: syncStatusTimer.restart()
0033 
0034     // Sometimes can't be restarted reliably immediately, put it in a timer
0035     Timer {
0036         id: syncStatusTimer
0037         interval: 0
0038         onTriggered: {
0039             if (enabled && videoStatus == "play") {
0040                 video.play();
0041             } else if (videoStatus == "stop") {
0042                 video.stop();
0043             } else {
0044                 video.pause();
0045             }
0046         }
0047     }
0048     controlBar: Local.SeekControl {
0049         id: seekControl
0050         anchors {
0051             left: parent.left
0052             right: parent.right
0053             bottom: parent.bottom
0054         }
0055         videoControl: video
0056         duration: video.duration
0057         playPosition: video.position
0058         onSeekPositionChanged: video.seek(seekPosition);
0059         z: 1000
0060     }
0061 
0062     Video {
0063         id: video
0064         anchors.fill: parent
0065         focus: true
0066         autoLoad: true
0067         autoPlay: false
0068         Keys.onSpacePressed: video.playbackState == MediaPlayer.PlayingState ? video.pause() : video.play()
0069         Keys.onLeftPressed: video.seek(video.position - 5000)
0070         Keys.onRightPressed: video.seek(video.position + 5000)
0071         source: videoSource
0072         readonly property string currentStatus: root.enabled ? root.videoStatus : "pause"
0073 
0074         onCurrentStatusChanged: {print("OOO"+currentStatus)
0075             switch(currentStatus){
0076                 case "stop":
0077                     video.stop();
0078                     break;
0079                 case "pause":
0080                     video.pause()
0081                     break;
0082                 case "play":
0083                     video.play()
0084                     break;
0085             }
0086         }
0087 
0088         MouseArea {
0089             anchors.fill: parent
0090             onClicked: controlBarItem.opened = !controlBarItem.opened
0091         }
0092     }
0093 }