[Solved]Can QWebEngineView load and play local multimedia files?



  • Hi.
    i know about security but it is no problem for me.
    i was tried with varius ways but no success.
    eg.
    From html:
    <video crossorigin='blah' src='foo.mp4'/>
    From js:

    var filepicker = document.getElementById("file").files[0]
    var player = document.getElementById("player")
    player.src = URL.createObjectURL(filepicker)
    

    From cpp:

    QtWebEngine::initialize();
    QWebEngineView* web = new QWebEngineView();
    web->page()->settings()->setAttribute(QWebEngineSettings::LocalContentCanAccessRemoteUrls,true);
    web->page()->setFeaturePermission(QUrl("file:///home/me/test.html"),QWebEnginePage::MediaAudioVideoCapture,QWebEnginePage::PermissionGrantedByUser);
    

    When page loaded i can see video element. But it seems like disabled as no 'src'.
    But everythings fine with youtube.
    Are there a way for this?

    Thanks.



  • Well. 'ogg' audios and 'webm' videos are playable but 'mp3' and 'mp4' formats not playable.

    Are 'mp3' and 'mp4' formats banned by Qt devs? If so; is because legal/third-party issues?

    Similar q already asked there.

    https://forum.qt.io/topic/52487/mp4-playback-disabled-by-default-ubuntu-windows/2

    Thanks a lot.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Here you have the explanation



  • @SGaist: that's exact answer i am looking for. Thank you.


Log in to reply
 

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