DragonPlayer QML Type
Audio playback controller for QML. More...
| Import Statement: | import org.kde.dragonmediabackend |
| In C++: | DragonPlayer |
Properties
- audioOutput : DragonAudioOutput
- bufferProgress : real
- duration : dragonDuration
- error : enumeration
- errorString : string
- nextSource : url
- playbackState : enumeration
- position : dragonDuration
- prefinishMark : dragonDuration
- seekable : bool
- source : url
- status : enumeration
Signals
- void aboutToFinish()
- void currentPlayingForRadiosChanged(dragonIcyMetadata metadata)
- void stateChanged(enumeration newState, enumeration oldState)
- void trackChanged()
Methods
Detailed Description
DragonPlayer plays audio from local files and network streams, and supports gapless transitions between sequential tracks: when aboutToFinish is emitted, set nextSource to play the next track immediately after the current one.
DragonPlayer { id: player source: "file:///home/user/music/song.flac" prefinishMark.milliseconds: 2000 onAboutToFinish: player.nextSource = playlist.next() }
See also DragonAudioOutput.
Property Documentation
audioOutput : DragonAudioOutput [read-only]
The DragonAudioOutput controlling volume and mute for this player. Created and owned by the player.
bufferProgress : real [read-only]
How much of a network stream has been buffered, from 0.0 to 1.0. Always 1.0 for fully buffered local files.
duration : dragonDuration [read-only]
The duration of the current source, invalid for streams of unknown duration.
error : enumeration [read-only]
The error state of the player, DragonPlayer.NoError when there is no error.
errorString : string [read-only]
A human-readable description of the current error, if any.
nextSource : url
The source played when the current track finishes, used for gapless transitions. Set it in response to aboutToFinish.
playbackState : enumeration [read-only]
The current playback state: DragonPlayer.StoppedState, DragonPlayer.PlayingState, or DragonPlayer.PausedState.
position : dragonDuration
The playback position. Assigning to it seeks playback.
prefinishMark : dragonDuration
How long before the end of the source aboutToFinish is emitted. The default is 2 seconds.
seekable : bool [read-only]
Whether the playback position of the current source can be changed. Radio streams are typically not seekable.
source : url
The media being played. Setting a new source while playing stops playback, resets the position, and starts loading the new media.
status : enumeration [read-only]
The status of the loaded media: DragonPlayer.NoMedia, DragonPlayer.LoadingMedia, DragonPlayer.LoadedMedia, DragonPlayer.BufferingMedia, DragonPlayer.StalledMedia, DragonPlayer.BufferedMedia, DragonPlayer.EndOfMedia, or DragonPlayer.InvalidMedia.
Signal Documentation
void aboutToFinish()
Emitted prefinishMark milliseconds before the current source finishes. Set nextSource in response to queue the next track for a gapless transition.
The corresponding handler is onAboutToFinish.
Note: The corresponding handler is onAboutToFinish.
void currentPlayingForRadiosChanged(dragonIcyMetadata metadata)
Emitted when the ICY metadata of a radio stream changes, with the new metadata. Typically reports the track currently playing.
The corresponding handler is onCurrentPlayingForRadiosChanged.
Note: The corresponding handler is onCurrentPlayingForRadiosChanged.
void stateChanged(enumeration newState, enumeration oldState)
Emitted when the playback state changes to newState, with the previous state in oldState.
The corresponding handler is onStateChanged.
Note: The corresponding handler is onStateChanged.
void trackChanged()
Emitted when the playing track changes, for example on a gapless transition or a source change.
The corresponding handler is onTrackChanged.
Note: The corresponding handler is onTrackChanged.
Method Documentation
void pause()
Pauses playback. Call play() to resume from the same position.
void play()
Starts or resumes playback of the current source.
void stop()
Stops playback and resets the position. The source remains loaded.