Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Video seek does not function
Forum Updated to NodeBB v4.3 + New Features

Video seek does not function

Scheduled Pinned Locked Moved Unsolved General and Desktop
videoqmlseekable
2 Posts 2 Posters 956 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • eirihamE Offline
    eirihamE Offline
    eiriham
    wrote on last edited by eiriham
    #1

    Hey!

    I am trying to play video and to rewind and fast forward.
    I have followed the documentation of the Video object, but it does not seem to work.
    For example, when I press the fast forward button, the video jumps to the beginning.

    What to do?

    Code:

    import QtQuick 2.7
    import QtQuick.Controls 2.0
    import QtQuick.Layouts 1.0
    import QtMultimedia 5.5
    
    //Video player component
    Item {
        id: videoItem
        anchors.fill: parent
    
        Video{
            id: video
            anchors.fill: parent
            source: xxx
    
        }
    
    
    
        //Control buttons
        RowLayout{
    
            anchors.bottom: parent.bottom
            anchors.margins: 20
            anchors.horizontalCenter: parent.horizontalCenter
    
            //Rewind to start
            RectangularButton{
                id: rewindStartButton
                text: "Rewind Start"
                onClicked: {
                    video.seek(0)
                }
            }
    
            //Rewind a few seconds
            RectangularButton{
                id: slowRewindButton
                text: "Slow rewind"
                onClicked: {
                    video.pause()
                    video.seek(video.position - 1000)
                    video.play()
                }
            }
    
            //Stop button
            RectangularButton{
                id: stopButton
                text: "Stop"
                onClicked: video.stop()
            }
    
            //Play/pause button
            RectangularButton{
                id: playButton
                text: "Play/Pause"
                onClicked: {
                    video.playbackState == MediaPlayer.PlayingState ? video.pause() : video.play()
                }
            }
    
            //Slow forward
            RectangularButton{
                id: slowForwardButton
                text: "Slow forward"
                onClicked: {
                    video.pause()
                    video.seek(video.position + 1000)
                    video.play()
                }
            }
    
            //Forward to end
            RectangularButton{
                id: forwardEndButton;
                text: "Forward end"
                onClicked: {
                    video.seek(video.duration)
                }
            }
    
        }
    
    
    }
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi

      Which platform are you running your application on ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved