Exemplo n.º 1
0
Window::Window()
{
    {
//![0]
    Phonon::MediaObject *music =
        Phonon::createPlayer(Phonon::MusicCategory,
                             Phonon::MediaSource("/path/mysong.wav"));
    music->play();
//![0]
    }

    {
    QWidget *parentWidget = new QWidget;
    QUrl url("Myfancymusic");
//![1]
    Phonon::VideoPlayer *player =
        new Phonon::VideoPlayer(Phonon::VideoCategory, parentWidget);
    player->play(url);
//![1]
    }

    {
//![2]
    Phonon::MediaObject *mediaObject = new Phonon::MediaObject(this);
    mediaObject->setCurrentSource(Phonon::MediaSource("/mymusic/barbiegirl.wav"));
    Phonon::AudioOutput *audioOutput =
        new Phonon::AudioOutput(Phonon::MusicCategory, this);
    Phonon::Path path = Phonon::createPath(mediaObject, audioOutput);
//![2]
    
//![3]
    Phonon::Effect *effect =
        new Phonon::Effect(
            Phonon::BackendCapabilities::availableAudioEffects()[0], this);
    path.insertEffect(effect);
//![3]    
    }

    {
//![4]
    Phonon::MediaObject *mediaObject = new Phonon::MediaObject(this);

    Phonon::VideoWidget *videoWidget = new Phonon::VideoWidget(this);
    Phonon::createPath(mediaObject, videoWidget);

    Phonon::AudioOutput *audioOutput =
        new Phonon::AudioOutput(Phonon::VideoCategory, this);
    Phonon::createPath(mediaObject, audioOutput);
//![4]
//![5]
    mediaObject->play();
//![5]
    }
}
Exemplo n.º 2
0
int main(int argc, char *argv[]) {
    QApplication a(argc, argv);


//    Phonon::MediaObject object;

//    Phonon::AudioOutput output;

//    object.setCurrentSource(Phonon::MediaSource("D:\\Music\\ne_budite_spyashih_-_budu_molodm_pogibat.mp3"));

//    Phonon::createPath(&object, &output);

//    object.play();

    a.setApplicationName("test");

    QLabel  l;
    l.setGeometry(100,100,200,200);
    Phonon::VideoPlayer* player = new Phonon::VideoPlayer(Phonon::VideoCategory, &l);
    player->play(QUrl::fromLocalFile("D:\\Video\\Pritvoris.moey.jenoy.f-s.Mgt.DVDRip.avi"));
    l.show();

    return a.exec();
}