Search code examples
qtqmlmultimedia

Show video preview / thumbnail of video using QML


Since Qt5.15 there is a flushMode property in Video. If set to VideoOutput.FirstFrame video shows first frame if playback has reached end of video. How can I show first video frame without starting it. Like a thumbnail or preview regularly seen in OS icon view. I would like to avoid storing additional images next to the videos for that.


Solution

  • As suggested in a Qt bug report you could do it as follows:

        Video {
            autoPlay: true
    
            onStatusChanged: {
                if (status == MediaPlayer.Buffered)
                {
                    pause()
                }
            }
        }