Phonon deployment problem - Won't play buffered mp3's



  • Hi

    I have a Phonon problem, I hope somebody can help me with.

    I'm developing an application that uses phonon to play small mp3-files. The mp3's are saved in a sqlite database, and are loaded when required into an QByteArray that are played using the media object in Phonon.

    It works fine on my development machine, but when i deploy it doesnt play anything.

    Here are some details:

    • Using qt and phonon build from source (using VC9).
    • I'm deploying the phonon.dll and phonon_backend/phonon_ds9.dll
    • If the QByteArray with the mp3 data are saved to a file, and the filename is passed to the mediaobject instead of the QByteArray directly, it works fine.
    • I have used ProcessMonitor and Dependency Walker to see if any DLL's are missing, but it doesn't seem so.
    • It only appears to be when loading the mediaobject from a buffer it fails to play, it plays mp3's directly from files correctly, also when deployed.

    This code plays the QByteArray:
    @QByteArray resourceData = resource.getData();
    m_audioBuffer = new QBuffer();
    m_audioBuffer->setData(resourceData);
    m_mediaObject->stop();
    m_mediaObject->clearQueue();
    m_mediaObject->setCurrentSource(Phonon::MediaSource(m_audioBuffer));
    m_mediaObject->play();@

    It works when I'm developing, byt when installing on the same machine it doesn't work.
    If the QByteArray is saved to a file and played using:

    @m_mediaObject->stop();
    m_mediaObject->clearQueue();
    m_mediaObject->setCurrentSource(Phonon::MediaSource(filename));
    m_mediaObject->play();@

    Any ideas why it won't play from the QBuffer?



  • Try to save audio buffer to file and compare the file content with the original one. Maybe it will help to localize the problem.



  • Ok, I'll try that. But when I save the stream to a file, it works ok, so it seems to be valid data.

    And just another detail:

    • When i try to play from the buffer, the media object changes state from loading to playing, but never changes state again, not even to the error state, and the errorString() function dosn't return any error.


  • Strange. Cannot advice anything clever than to use workaround saving to temporary file.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.