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



  • 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



  • 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



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



  • @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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.