I solved adding in the .pro file the row:
QT += core gui phonon
QT += core gui phonon
To copy to clipboard, switch view to plain text mode
now that it works,
i added the remaining part of the code in file mainWindow.cpp:
#include <phonon/AudioOutput>
#include <phonon/MediaObject>
#include <phonon/MediaSource>
#include <phonon/AudioOutput>
#include <phonon/MediaObject>
#include <phonon/MediaSource>
To copy to clipboard, switch view to plain text mode
and in sub on_pushButton_clicked() i added:
Phonon::AudioOutput* pAudioOutput;
pAudioOutput = new Phonon::AudioOutput( Phonon::MusicCategory, this);
Phonon::MediaObject* pMediaObject ;
pMediaObject = new Phonon::MediaObject(this);
Phonon::createPath(pMediaObject, pAudioOutput);
Phonon::MediaSource mediaSource = Phonon::MediaSource(url);
pMediaObject ->setCurrentSource( mediaSource);
pMediaObject->play();
Phonon::AudioOutput* pAudioOutput;
pAudioOutput = new Phonon::AudioOutput( Phonon::MusicCategory, this);
Phonon::MediaObject* pMediaObject ;
pMediaObject = new Phonon::MediaObject(this);
Phonon::createPath(pMediaObject, pAudioOutput);
QString url= QString("e:\\Scream.wav");
Phonon::MediaSource mediaSource = Phonon::MediaSource(url);
pMediaObject ->setCurrentSource( mediaSource);
pMediaObject->play();
To copy to clipboard, switch view to plain text mode
then i copied the file Scream.wav in the external memory (e: )
I verified that i can listen to this file on the default player of the phone.
And when i run the code, and press the button, the phone plays the wav.
Very good.
Now: How can i change the output device, choosing from available outputs? (for example in case i have 2 bluetooth headphone connected, and i want to stream a file only to one of these headphone).
I’ll study on this question.
Bookmarks