save music after played from url to local
hi
i use this code to play music from Internet
Code:
Phonon::MediaObject *mediaObject = new Phonon::MediaObject(this);
Phonon::AudioOutput *audioOutput = new Phonon::AudioOutput(Phonon::VideoCategory, this);
Phonon::createPath(mediaObject, audioOutput);
Phonon::MediaSource source("http://mysite.com/001001.mp3");
mediaObject->setCurrentSource(source);
mediaObject->play();
how can i save 001001.mp3 in local after played..?
Re: save music after played from url to local
find out a way to know the end of music playing, and then call download() as below, or just call download() after play()
I am not sure of this but, can try
Code:
download()
{
QNetworkReply * reply = QNetworkAccessManager::get ("http://mysite.com/001001.mp3");
connect(reply, SIGNAL(readyRead()), this, SLOT(saveToFile());
}
saveToFile()
{
QFile file("001001.mp3");
return;
file.write(data);
file.close();
reply->deleteLater();
}