Can QMediaPlayer play a media through ftp ?



  • Hi all,

    I am trying to play a media

    @
    QString strFileName = "ftp://wpglinux:123456@192.168.100.61:" +QString().setNum(9954)+ //D:/VideosSongs/ims.mov";
    pvMediaPlayer->setMedia(QUrl::fromLocalFile(strFileName));
    @

    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?!

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



  • Hi.
    i am using
    @
    QString strFileName = "ftp://wpglinux:123456@192.168.100.61:" +QString().setNum(9954)+ "//D:/VideosSongs/ims.mov";
    QUrl url(strFileName);
    url.setScheme("ftp");
    // url.setUrl(strFileName,QUrl::TolerantMode);
    qDebug()<<"Path : "<< strFileName;
    //pvMediaPlayer->setMedia(QUrl::fromLocalFile(strFileName));
    pvMediaPlayer->setMedia(QUrl::fromUserInput(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":http://qt-project.org/wiki/Qt_Multimedia_Backends.

    Edit: just found "this post":http://qt-project.org/forums/viewthread/34146, 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.