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. Problems with the source of Video Output /Video/Media Player in QML
Forum Updated to NodeBB v4.3 + New Features

Problems with the source of Video Output /Video/Media Player in QML

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 4 Posters 2.8k 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.
  • M Offline
    M Offline
    mshefiti
    wrote on last edited by
    #1

    Does the source have to be an absolute path?

    main.qml and myVideo.mp4 are in the same folder, and I have also added the video manually in the qrc file in QtCreator.

    I tried relative path, but it doesnt work (error 2: failed to load media):

    @
    MediaPlayer {
    id: mediaplayer
    source: "myVideo.mp4"
    autoPlay: true
    }@

    It only works with absolute path.
    @ MediaPlayer {
    id: mediaplayer
    source: "file:///Users/mshefiti/Developer/Qt/QtWorkspace/Workflow_Sensitive_UI/myVideo.mp4"
    autoPlay: true
    }@

    Also, how can I stream a video from the internet (lets say youtube)? I tried to put the youtube link, but it also doesnt work:
    @
    MediaPlayer {
    id: mediaplayer
    source: "https://www.youtube.com/watch?v=m2qJMbzwA3w"
    autoPlay: true
    }@

    Any suggestions anyone? Thanks

    A S 2 Replies Last reply
    1
    • GianlucaG Offline
      GianlucaG Offline
      Gianluca
      wrote on last edited by
      #2

      I already saw other open topics with the same problem, and no one has an answer yet.
      So, it seems a bug. Please, report to the https://bugreports.qt-project.org

      1 Reply Last reply
      0
      • M mshefiti

        Does the source have to be an absolute path?

        main.qml and myVideo.mp4 are in the same folder, and I have also added the video manually in the qrc file in QtCreator.

        I tried relative path, but it doesnt work (error 2: failed to load media):

        @
        MediaPlayer {
        id: mediaplayer
        source: "myVideo.mp4"
        autoPlay: true
        }@

        It only works with absolute path.
        @ MediaPlayer {
        id: mediaplayer
        source: "file:///Users/mshefiti/Developer/Qt/QtWorkspace/Workflow_Sensitive_UI/myVideo.mp4"
        autoPlay: true
        }@

        Also, how can I stream a video from the internet (lets say youtube)? I tried to put the youtube link, but it also doesnt work:
        @
        MediaPlayer {
        id: mediaplayer
        source: "https://www.youtube.com/watch?v=m2qJMbzwA3w"
        autoPlay: true
        }@

        Any suggestions anyone? Thanks

        A Offline
        A Offline
        Alan A
        wrote on last edited by
        #3

        @mshefiti try "qrc:///folder/myVideo.mp4" where folde/myVideo.mp4
        is the path in the qrc file

        1 Reply Last reply
        0
        • M mshefiti

          Does the source have to be an absolute path?

          main.qml and myVideo.mp4 are in the same folder, and I have also added the video manually in the qrc file in QtCreator.

          I tried relative path, but it doesnt work (error 2: failed to load media):

          @
          MediaPlayer {
          id: mediaplayer
          source: "myVideo.mp4"
          autoPlay: true
          }@

          It only works with absolute path.
          @ MediaPlayer {
          id: mediaplayer
          source: "file:///Users/mshefiti/Developer/Qt/QtWorkspace/Workflow_Sensitive_UI/myVideo.mp4"
          autoPlay: true
          }@

          Also, how can I stream a video from the internet (lets say youtube)? I tried to put the youtube link, but it also doesnt work:
          @
          MediaPlayer {
          id: mediaplayer
          source: "https://www.youtube.com/watch?v=m2qJMbzwA3w"
          autoPlay: true
          }@

          Any suggestions anyone? Thanks

          S Offline
          S Offline
          seyed
          wrote on last edited by
          #4

          @mshefiti I have same question.
          But for as an alternate answer, you can use ffmpeg or related plugin named QtAV for this purpose.
          If anybody has a solution or answer, please share with we all.

          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