1

I'm working on an application, that receives a broadcast from a VLC server. I've got a solution, but I need an other one, as this one doesn't fit my needs.

My question is that is there any way of receiving the video with QTcpSocket as a QByteArray and play it with the QMediaPlayer. I found the below article, but it never really worked out for me.

Play Video In Qt from BYTE* Stream?

Here is what I've been trying to do. I start a stream with VLC with HTTP, setting port to "8080", and what I tested is that the connection happens, but it seems that I never get any data from VLC, as the readReady() signal of QTcpSocket never emits. Although I can read data from it with read/readAll.

tcpSocket = new QTcpSocket();
tcpSocket->connectToHost("157.181.196.59", 8080);

QByteArray data = tcpSocket->readAll();
QBuffer buffer(&data);
player->setMedia(QMediaContent(), &buffer);
player->play();    

I know it's not how it works, but as I imagined with this code I should be able to see some result on the videoWidget.

Can you please help me how to do it right?

Community
  • 1
  • 1
Pajti
  • 21
  • 2

0 Answers0