View Full Version : About load source with phonon!
dleviathan
18th January 2012, 03:58
I had played media from file with phonon. But now, i want play media from byte buffer to inc speed of my program. But i can't find any document show about that. Plz show me how i can play media from byte buffer with phonon.
Thanks all your help!
ChrisW67
18th January 2012, 04:39
Seems like this would be the basic process:
Load data into a QByteArray if you don't already have the data in a char buffer.
Create a QBuffer, which is a QIODevice, from the QByteArray or char buffer
Create a MediaSource from the QBuffer
dleviathan
18th January 2012, 04:49
Thanks Chirs!
I will try your way!
dleviathan
19th January 2012, 09:08
i had write code as:
QFile fileInfo(urlPath);
fileInfo.open(QFile::ReadOnly);
QByteArray baDuLieu = fileInfo.readAll();
qDebug() << baDuLieu.count();
bufDuLieu.setData(baDuLieu);
qDebug() << bufDuLieu.size();
// bufDuLieu.open(QIODevice::ReadOnly);
Phonon::MediaSource msDL(&bufDuLieu);
_mediaObject = Phonon::createPlayer(Phonon::MusicCategory, msDL);
but my music can't play :(
It warning:
MediaSource::Stream not yet handled
plz help !
ChrisW67
20th January 2012, 01:12
From the MediaSource::MediaSource() docs:
Warning: On Windows, we only support QIODevices containing the avi, mp3, or mpg formats. Use the constructor that takes a file name to open files (the Qt backend does not use a QFile internally).
dleviathan
20th January 2012, 03:23
I had urlPath is one file .mp3. And I program on Symbian not Windows
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.