class MediaObject


Module phonon
Namespace Phonon
Class MediaObject
Inherits QObject,Phonon::MediaNode
\class MediaObject mediaobject.h Phonon/MediaObject Interface for media playback of a given URL.

This class is the most important class in %Phonon. Use it to open a media file at an arbitrary location, a CD or DVD or to stream media data from the application to the backend.

This class controls the state (play, pause, stop, seek) and you can use it to get a lot of information about the media data.

Notice that most functions of this class are asynchronous. That means if you call play() the object only starts playing when the stateChanged() signal tells you that the object changed into PlayingState. The states you can expect are documented for those methods.

A common usage example is the following:

media = new MediaObject(this);
connect(media, SIGNAL(finished()), SLOT(slotFinished());
media->setCurrentSource("/home/username/music/filename.ogg");
media->play();

If you want to play more that one media file (one after another) you can either tell MediaObject about all those files

media->setCurrentSource(":/sounds/startsound.ogg");
media->enqueue("/home/username/music/song.mp3");
media->enqueue(":/sounds/endsound.ogg");
or provide the next file just in time:
media->setCurrentSource(":/sounds/startsound.ogg");
connect(media, SIGNAL(aboutToFinish()), SLOT(enqueueNextSource()));
}

void enqueueNextSource() { media->enqueue("/home/username/music/song.mp3"); }

Author Matthias Kretz



methods