import QtQuick 1.0 import QtMultimediaKit 1.1 // do not forgot to import this import Qt 4.7 import "../Shared" Rectangle { id: videoPlayer width: 640 //parent.width height: 360//parent.height color: "#000000" property bool durationShowed: false property int startPosstrollTime: 0 property string current_video_source: "" property int seekPosition: 0 property int currentPosition: 0 property int percent_to_mark: 0 property bool movie_watched: false onCurrent_video_sourceChanged: playContent() MouseArea { anchors.fill: parent onClicked: { // videoControls.opacity = 1 } } Video{ id: video width: parent.width height: parent.height anchors.fill: parent //autoLoad: true //focus: true //fillMode: Stretch //volume: slide.value fillMode: Video.Stretch onStarted: { volume =0.0 if(duration!=-1){ position = duration - 8000 } } onStopped: { } onStatusChanged: { if(video.status == Video.EndOfMedia) { timerStop() startThePreroll() } if(video.status == Video.Buffering ) console.log("Video is Buffering") if(video.status == Video.NoMedia ){ errorState() console.log("Video is NoMedia") } if(video.status == Video.Loading ) console.log("Video is Loading") if(video.status == Video.Loaded ) console.log("Video is Loaded ") if(video.status == Video.Stalled ) { console.log("Video is Stalled") errorState() } if(video.status == Video.InvalidMedia ) { console.log("Video is InvalidMedia") errorState() } if(video.status == Video.Buffered ) console.log("Video is Buffered") if(video.status == Video.EndOfMedia ) console.log("Video is EndOfMedia") if(video.status == Video.UnknownStatus ) console.log("Video is UnknownStatus") } } Rectangle{ id: backGroundColor anchors.fill: parent color: "black" opacity: 1 } Spinner{ id: videoSpinner anchors.fill: parent show: false } Rectangle{ id: mask anchors.fill: parent color: "black" opacity: 0 } MessageBox{ id: errorBox anchors.centerIn: parent width: 320 height: 230 titleBox: "Сообщение" message: "При попытке воспроизведения видео возникла ошибка. Приносим извинения за неудобства" textButton: "ОК" opacity: 0 onClicked: { timerStop() setOrientation('portrait') if(hiddenLoader.source == pageModel.get(pageModel.count-1).page) currentLoader.source = "../MovieCard/MovieCard.qml" else hiddenLoader.source = "../MovieCard/MovieCard.qml" } } function playContent() { video.source = current_video_source console.log("Prepreroll from: "+video.source) showVideoSpinner() video.play() timerStart() } function showVideoSpinner(){ videoSpinner.show = true } function hideVideoSpinner(){ videoSpinner.show = false } function errorState(){ video.stop() mask.opacity = 1 videoSpinner.show = false errorBox.opacity = 1 } }