Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    To display video on qml (Qt-5)

    QML and Qt Quick
    2
    4
    1951
    Loading More Posts
    • 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.
    • B
      bts-007 last edited by

      Hai,
      display video on qml.
      video player (qt) uses videoWidget

      @
      QVideoWidget *videoWidget = new QVideoWidget;
      @

      To display the video we are using layout. Instead of displaying it in layout ,I should pass this data to qml video element and display on qml
      @
      QBoxLayout *layout = new QVBoxLayout;
      layout->addWidget(videoWidget);
      @

      1 Reply Last reply Reply Quote 0
      • B
        bjanuario last edited by

        You are mixing widget with QML ... you should do all on QML

        1 Reply Last reply Reply Quote 0
        • B
          bts-007 last edited by

          bjanuario thank you for the reply. My source of video is in qt side I don't know how to display on qml side.

          1 Reply Last reply Reply Quote 0
          • B
            bjanuario last edited by

            Here some sample of video player on QML:

            @import QtQuick 1.0
            import QtMultimediaKit 1.1 // do not forgot to import this

            Item {
            id: videoPlayerItem
            property bool isVideoPlaying: videoPlayer.hasVideo // property to know if videoPlaying id ongoing or not
            /*
            Functions Which starts Video Playing
            /
            function playVideo(){
            videoPlayer.play()
            }
            /

            Function Which Stops Video Playing
            /
            function stopVideo(){
            videoPlayer.stop()
            }
            /

            Function Which Stops Video Playing
            /
            function pauseVideo(){
            videoPlayer.pause()
            }
            /

            Actual QML based Video Component
            */
            Video{
            id:videoPlayer
            anchors.fill: videoPlayerItem // never forget to mention the size and position
            source: "Video/Bear.wmv"
            focus: true
            }
            }@

            1 Reply Last reply Reply Quote 0
            • First post
              Last post