Lags at the beginning of the Qml Video - How to buffer the video before playing it?
-
I have a video component (this is simplified version).
Video { id: video fillMode: VideoOutput.Stretch width: root.width height: root.height notifyInterval: 100 // only for tests purposes onStatusChanged: { if(status == MediaPlayer.Loaded) play(); if(status == MediaPlayer.Buffered) { console.log("status : Buffered, position: ", position/1000); eventer.running = true; } } Timer { id: eventer repeat: true; interval: 4000 onTriggered: { console.log("position: " + video.position/1000); } }
I want to trigger the timer at given times. In this example every 4 seconds. The problem is that the video gots lags at the beginning - first second or half a second is not played smoothly. When the eventer timer reaches 4 seconds the duration states the video is almost a second behind.
qml: status : Buffered, position: 0 qml: position: 2.996 : 4000 qml: position: 6.997 : 8000 qml: position: 10.998 : 12000
I thought it might be because the video is not buffering quickly enough at the beginning, but eventer is started after MediaPlayer.Buffered status signal is received.
Does the MediaPlayer.Buffered status mean that the whole video was buffered or just a part of it?
What could be the cause of lags at the beginning of the video?
If it is because CPU is too slow at the beginning to buffer the video, how can I be sure the video is buffered and then play it?Simply, one question: How to buffer the video before playing it?