Home > other >  QT5 access network video streaming to consult
QT5 access network video streaming to consult

Time:11-12

Do I want from http://192.168.1.1:8080/? Action=get on stream video streaming, how to use QNetworkAccessManager implementation? I am now writing: webCam=new QNetworkAccessManager (this); Connect (webCam, SIGNAL (finished (QNetworkReply *)), and this, SLOT (replySteamFinish (QNetworkReply *))); QString CAM="HTTP://http://192.168.1.1:8080/? Action=stream "; QNetworkRequest the req. The req. SetUrl (CAM); WebCam - & gt; Get (the req); Void MainWindow: : replySteamFinish (QNetworkReply * reply) {if (reply - & gt; Error ()==QNetworkReply: : NoError) {QByteArray data=https://bbs.csdn.net/topics/reply-> readAll (); QDebug () error (); }} but no output qDebug!

CodePudding user response:

Is it because the http://192.168.1.1:8080/? Action=stream this address in video stream, so the QNetworkAccessManager has been waiting for him to produce finished () signal, but the video transmission has not terminated, so did not trigger the finished signal?

CodePudding user response:

Well solved finally oneself use QTcpSocket # include "mainwindow. H" # include "ui_mainwindow. H" mainwindow: : mainwindow (QWidget * parent) : QMainWindow (parent), UI (new UI: : mainwindow) {UI - & gt; SetupUi (this); TcpSocket=new QTcpSocket (this); TcpSocket - & gt; ConnectToHost (" 192.168.1.1 ", 8080); The connect (tcpSocket, SIGNAL (readyRead ()), and this, SLOT (tcpDataReceive ())); {} MainWindow: : ~ MainWindow () the delete UI; {} void MainWindow: : tcpDataReceive () QByteArray data=https://bbs.csdn.net/topics/QByteArray::fromHex (tcpSocket -> readAll ()); QDebug () write (" GET/? Action=stream \ r \ n \ r \ n "); }

CodePudding user response:

You should use the readyRead (), rather than the finished ()

CodePudding user response:

Qt novice for code
  • Related