I connot play an mp3 file on my Nokia 5800 phone. The Qt example works fine but my code does not.
I get this error:
[Qt Message] "Loading clip failed: Not supported"
What am i doing wrong?
void GooglePlayer
:: mediaFilePlaySlot( QByteArray audioData
) {
m_mediaFile
= new QFile( "e:\response.mp3");
m_mediaFile->write( audioData );
m_mediaFile->close();
m_mediaObject->setCurrentSource(Phonon::MediaSource("e:\response.mp3"));
connect(m_mediaObject, SIGNAL(stateChanged(Phonon::State,Phonon::State)),
this, SLOT(stateChangedSlot(Phonon::State,Phonon::State)));
}
void GooglePlayer:: mediaFilePlaySlot( QByteArray audioData )
{
m_mediaFile = new QFile( "e:\response.mp3");
m_mediaFile->open( QIODevice::ReadOnly );
m_mediaFile->write( audioData );
m_mediaFile->close();
m_mediaObject->setCurrentSource(Phonon::MediaSource("e:\response.mp3"));
connect(m_mediaObject, SIGNAL(stateChanged(Phonon::State,Phonon::State)),
this, SLOT(stateChangedSlot(Phonon::State,Phonon::State)));
}
To copy to clipboard, switch view to plain text mode
void GooglePlayer::stateChangedSlot(Phonon::State newstate,Phonon::State oldState )
{
qDebug()<< newstate;
if ( newstate == Phonon::StoppedState )
m_mediaObject->play();
if( newstate == Phonon::ErrorState )
{
qWarning()<< m_mediaObject->errorString();
}
}
void GooglePlayer::stateChangedSlot(Phonon::State newstate,Phonon::State oldState )
{
qDebug()<< newstate;
if ( newstate == Phonon::StoppedState )
m_mediaObject->play();
if( newstate == Phonon::ErrorState )
{
qWarning()<< m_mediaObject->errorString();
}
}
To copy to clipboard, switch view to plain text mode
Pro file config:
# Allow network access on Symbian
symbian:TARGET.CAPABILITY += NetworkServices
symbian:TARGET.CAPABILITY += ReadUserData
symbian:TARGET.CAPABILITY += WriteUserData
symbian:TARGET.CAPABILITY += UserEnvironment
QT += multimedia
QT += network
QT += webkit
QT += phonon
MOBILITY += bearer
MOBILITY += multimedia
Added after 1 8 minutes:
Maybe this is my problem ...
m_mediaFile->open( QIODevice::ReadOnly );
Sorry I am very tired
Bookmarks