Can QMediaPlayer play a media through ftp ?

  • Hi all,

    I am trying to play a media

    QString strFileName = "ftp://wpglinux:123456@" +QString().setNum(9954)+ //D:/VideosSongs/";

    can i play?

  • Moderators

    i think so ... QNetworkAccesManager has basic FTP support.
    But beside that, why don't you just try it?? You already posted the code to use?!

    @QUrl::fromLocalFile(strFileName)@ is wrong. Use @QUrl(strFileName)@ or @QUrl::fromUserInput(strfFileName)@

  • Hi.
    i am using
    QString strFileName = "ftp://wpglinux:123456@" +QString().setNum(9954)+ "//D:/VideosSongs/";
    QUrl url(strFileName);
    // url.setUrl(strFileName,QUrl::TolerantMode);
    qDebug()<<"Path : "<< strFileName;

    giving -->

    Unsupported url scheme!

  • Moderators

    then it seems it is not supported (yet) ;)

  • thanks...
    BTW ...Is there any way ?

  • Moderators

    I haven tried it so far but this may be possible:

    use QnetworkAccessManager to download file form your url using it's get() method

    the returned QNetworkReply (subclass of QIODevice) can be set to QMediaPlayer::setMedia(QMediaContent(), reply);

    Note that streaming is only supported on windows and unix so far - with the "shipped multimedia backends":

    Edit: just found "this post":, which doesn't look promising. But still you can try, maybe it was already fixed in the meantime.

    You may also pass QMediaPlayer::StreamPlayback in the flags of QMediaPlayer's constructor

Log in to reply

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