Warning, /maui/clip/src/controllers/YoutubeViewer.qml is written in an unsupported language. File is not indexed.
0001 import QtQuick 2.10
0002 import QtQuick.Controls 2.10
0003 import QtQuick.Layouts 1.3
0004 import "../../view_models"
0005 import QtWebView 1.1
0006
0007 import org.kde.kirigami 2.2 as Kirigami
0008 import org.kde.mauikit 1.0 as Maui
0009
0010 Maui.Page
0011 {
0012 id: videoPlayback
0013 property alias webView: webView
0014 property bool wasPlaying: false
0015 property var currentYt : ({})
0016
0017 title: currentYt ? currentYt.title : "YouTube"
0018
0019 headBar.leftContent: ToolButton
0020 {
0021 icon.name: "go-previous"
0022 onClicked: stackView.pop(youtubeTable)
0023 }
0024
0025 headBar.rightContent: [
0026
0027 ToolButton
0028 {
0029 icon.name : "link"
0030 onClicked: webView.url = currentYt.url.replace("embed/", "watch?v=")
0031 },
0032
0033 ToolButton
0034 {
0035 icon.name : "download"
0036 onClicked: bae.getYoutubeTrack(JSON.stringify(currentYt))
0037 }
0038 ]
0039
0040 WebView
0041 {
0042 id: webView
0043 anchors.fill: parent
0044 visible: true
0045 clip: true
0046 property bool wasPlaying: false
0047
0048 onVisibleChanged: if(!visible) webView.url = "about:blank"
0049
0050 onLoadingChanged:
0051 {
0052 if (loadRequest.errorString)
0053 console.error(loadRequest.errorString);
0054 }
0055
0056 // onRecentlyAudibleChanged:
0057 // {
0058 // console.log("is playing", recentlyAudible)
0059 // if(recentlyAudible && isPlaying)
0060 // Player.pauseTrack()
0061
0062 // if(!recentlyAudible && wasPlaying)
0063 // Player.resumeTrack()
0064 // }
0065 }
0066
0067 }