Live stream with Qt5



  • Hi... I'm trying to show a live streaming using Qt5 and this is my code:

    @
    #include "MainWindow.h"
    #include <QApplication>
    #include <QMediaPlayer>
    #include <QUrl>
    #include <QVideoWidget>

    int main(int argc, char argv[])
    {
    QApplication a(argc, argv);
    QMediaPlayer
    mPlayer = new QMediaPlayer;
    mPlayer->setMedia(QUrl("http://www.youtube.com/watch?feature=player_detailpage&v=U2CKDRQBUsI"));
    QVideoWidget* videoWidget = new QVideoWidget;
    mPlayer->setVideoOutput(videoWidget);
    videoWidget->show();
    mPlayer->play();
    return a.exec();
    }
    @

    the error that I have is this one:

    @
    Warning: "No decoder available for type 'text/html'."
    Error: "Your GStreamer installation is missing a plug-in."
    @

    some help please

    best regards

    Freddy



  • Your Youtube URL is pointing to an HTML page, not to an actual video stream this explains the text/html content type in the HTTP reply.
    It used to be possible to get an http link to the video stream on YouTube but it's now very complicated as Google is trying to protect the content from stealing.



  • so... it's mean that if I have a real live streaming url, I can show it with the code before ???

    well, for example, I will lke to get the stream from my webcam, send it to one port of my computer, and read it from the network with one code like the last one... how can I do dat using just Qt5 ?

    because I need generate live stream and read it to....

    some help please.....


  • Moderators

    [quote author="freddy311082" date="1383520350"]so... it's mean that if I have a real live streaming url, I can show it with the code before ???[/quote]
    should be... if gstreamer supports the type of the stream.

    Alternatively you can look at "this":http://derekmolloy.ie/custom-video-streaming-player-using-libvlc-and-qt/.



  • bus as I can see, Qt5Multimedia library is implemented with gstreamer, and, I don't know if I there is some way to do this


Log in to reply
 

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