3

I'm trying to do a video player in Qt and I'm using for that a MediaPlayer QML type. My problem is that the backend server providing the video requires additional custom http headers for handshaking. I'm testing with a very simple example:

import QtQuick 2.0
import QtMultimedia 5.0

Item {
    MediaPlayer {
        id: mediaplayer
        source: "http://myserver.com/myvideo.mp4"
    }

    VideoOutput {
        anchors.fill: parent
        source: mediaplayer
    }

    MouseArea {
        id: playArea
        anchors.fill: parent
        onPressed: mediaplayer.play();
    }
}

To manage requests in my QML app, I'm using a custom NetworkAccessManagerFactory that creates a custom NetworkAccessManager which handles the requests, appending the corresponding HTTP headers:

MyCustomNetworkAccessManagerFactory* namf= new MyCustomNetworkAccessManagerFactory();
engine.setNetworkAccessManagerFactory(namf);

This works fine for loading images from the backend, but both audio and video seem to be bypassing the custom NetworkAccessManager and using something different, so my question:

  • is there a way of appending custom HTTP headers in the requests sent from a MediaPlayer QML type?
Marco A.
  • 43,032
  • 26
  • 132
  • 246
mortadelo
  • 145
  • 1
  • 11

0 Answers0