Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Video playback using QML

Video playback using QML

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 601 Views
  • 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.
  • S Offline
    S Offline
    Sharma
    wrote on last edited by Sharma
    #1

    Hi,
    I am completely new to QML as I'm coming from Qt c++ side. I am exploring to design my window using qml and kind of struggling to get a video (.mp4) playback. I got started with MediaPlayer element and VideoOutput to be filled by the mediaplayer. Here is how the ContentVideo.qml looks like:

    Rectangle {
        width: 400
        height: 400
        color:"black"
    
        MediaPlayer {
            id: mediaPlayer
            autoPlay: true
            autoLoad: true
            source:"video.mp4"
        }
    
        VideoOutput {
            id:videoOutput
            source:mediaPlayer
            anchors.fill: parent
        }
    }
    

    My question is, how can I now redirect this VideoOutput to my main window which is in main.qml?

    Window {
        id: root
        visible: true
        width: 640
        height: 480
        title: qsTr("VideoPlayback")
    }
    

    I know there is a qmlvideo example, but its too complex for me to get started with a simple video playback.

    Thanks,

    1 Reply Last reply
    0
    • ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by
      #2

      Hi,
      You all you have to do now is create your component in your window.

      Window {
          id: root
          visible: true
          width: 640
          height: 480
          title: qsTr("VideoPlayback")
      
      ContentVideo{
       width: 640
          height: 480
      }
      
      }
      

      also in the ContentVideo.qml put z property of the background rectangle to -1 or use Item if you don't need background

      1 Reply Last reply
      2
      • S Offline
        S Offline
        Sharma
        wrote on last edited by
        #3

        Awesome .. thanks Lelev. I see the video playback :)

        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