Hi All !
I have a code ...
QNetworkAccessManager *manager=new QNetworkAccessManager(this);
QNetworkRequest request(url); // url ="http://dev1.rainconcert.in/sax.mp3"
QNetworkReply *currentDownload = manager->get(request);
Phonon
::MediaObject *music
= Phonon
::createPlayer(Phonon
::MusicCategory, Phonon
::MediaSource((QIODevice*)currentDownload
));
music->play();
QNetworkAccessManager *manager=new QNetworkAccessManager(this);
QNetworkRequest request(url); // url ="http://dev1.rainconcert.in/sax.mp3"
QNetworkReply *currentDownload = manager->get(request);
Phonon::MediaObject *music = Phonon::createPlayer(Phonon::MusicCategory, Phonon::MediaSource((QIODevice*)currentDownload));
music->play();
To copy to clipboard, switch view to plain text mode
But the audio doesn't play and in Application Output "MediaSource::Stream not yet handled" is shown.
I have another code
QNetworkAccessManager *manager=new QNetworkAccessManager(this);
QNetworkRequest request(url); // url ="http://dev1.rainconcert.in/sax.mp3"
QNetworkReply *currentDownload = manager->get(request);
connect(currentDownload, SIGNAL(downloadProgress(qint64,qint64)), SLOT(downloadProgress(qint64,qint64)));
QNetworkAccessManager *manager=new QNetworkAccessManager(this);
QNetworkRequest request(url); // url ="http://dev1.rainconcert.in/sax.mp3"
QNetworkReply *currentDownload = manager->get(request);
connect(currentDownload, SIGNAL(downloadProgress(qint64,qint64)), SLOT(downloadProgress(qint64,qint64)));
To copy to clipboard, switch view to plain text mode
and slot 'downloadProgress' code
void MainWindow::downloadProgress(qint64 bytesReceived, qint64 bytesTotal)
{
ui->progressBar->setMaximum(bytesTotal);
ui->progressBar->setValue(bytesReceived);
if(!loaded && bytesReceived>1024){ // loaded is initially set to false
qDebug() << "Play Loading...";
Phonon
::MediaObject *music
= Phonon
::createPlayer(Phonon
::MusicCategory, Phonon
::MediaSource((QIODevice*)sender
()));
music->play();
loaded = true;
}
}
void MainWindow::downloadProgress(qint64 bytesReceived, qint64 bytesTotal)
{
ui->progressBar->setMaximum(bytesTotal);
ui->progressBar->setValue(bytesReceived);
if(!loaded && bytesReceived>1024){ // loaded is initially set to false
qDebug() << "Play Loading...";
Phonon::MediaObject *music = Phonon::createPlayer(Phonon::MusicCategory, Phonon::MediaSource((QIODevice*)sender()));
music->play();
loaded = true;
}
}
To copy to clipboard, switch view to plain text mode
BUT I get the same result told above.
Now I need suggestion how to handle MediaSource Sreaming in QT.
please help me.
Bookmarks