Thank you for your reply,
it seems that it goes better now only it gives me a QThread::wait: Thread tried to wait on itself.
My code :
"Query: SELECT id_music, data FROM user_getBlob WHERE (id_music=35)"
core class
blobString.append("SELECT id_music, data FROM user_getBlob WHERE (id_music="+newMusicModel->musicList.at(charts->rowNewSongIndex()).getID_Music()+")");
QSqlQuery blob
= dataBase
->getQuery
(blobString
);
blob.next();
QByteArray soundByte
= blob.
value(1).
toByteArray();
blob.clear();
soundBuffer
= new QBuffer(&soundByte
);
mediaPlayer->inputUrl(soundBuffer);
blobString.append("SELECT id_music, data FROM user_getBlob WHERE (id_music="+newMusicModel->musicList.at(charts->rowNewSongIndex()).getID_Music()+")");
QSqlQuery blob = dataBase->getQuery(blobString);
blob.next();
QByteArray soundByte = blob.value(1).toByteArray();
QCoreApplication::processEvents();
blob.clear();
soundBuffer = new QBuffer(&soundByte);
QCoreApplication::processEvents();
mediaPlayer->inputUrl(soundBuffer);
To copy to clipboard, switch view to plain text mode
MediaPlayer class
void MediaPlayer
::inputUrl(QBuffer *buffer
) {
Phonon::MediaSource source(buffer);
mediaObject->stop();
mediaObject->clearQueue();
mediaObject->setCurrentSource(source);
audioOutput->setVolume(0.0);
mediaObject->play();
connect(playTimer, SIGNAL(timeout()), this, SLOT(stopped()));
playTimer->start(20000);
emit output("MediaPlayer::inputUrl >> ", "Loaded mp3");
}
void MediaPlayer::inputUrl(QBuffer *buffer)
{
buffer->open(QIODevice::ReadOnly);
Phonon::MediaSource source(buffer);
mediaObject->stop();
mediaObject->clearQueue();
mediaObject->setCurrentSource(source);
audioOutput->setVolume(0.0);
mediaObject->play();
playTimer = new QTimer(this);
connect(playTimer, SIGNAL(timeout()), this, SLOT(stopped()));
playTimer->start(20000);
emit output("MediaPlayer::inputUrl >> ", "Loaded mp3");
}
To copy to clipboard, switch view to plain text mode
anyone know what this can mean...
the QTimer is not the problem, i use it only to play just 20s of the son....
thanx in advance
p.s. how do you prevent it from not getting out of scope?
Bookmarks