MediaPlayer QML Type
Provides an interface to control a media player. More...
Import Statement: | import QtIvi.Media 1.0 |
Instantiates: | QIviMediaPlayer |
Inherits: |
Properties
- currentTrack : object
- discoveryMode : enumeration
- discoveryResult : enumeration
- duration : int
- isInitialized : bool
- isValid : bool
- muted : bool
- playMode : enumeration
- playQueue : PlayQueue
- playState : enumeration
- position : int
- serviceObject : ServiceObject
- volume : int
Methods
Detailed Description
The MediaPlayer provides methods to control a media player. This media player can be local or even a remote device you are connected to e.g. over bluetooth.
By default the autoDiscovery is turned to Automatic for this feature and most likely will connect to a local media player instance.
Property Documentation
Holds the current track represented as QVariant.
Note: This will be replaced by soon.
discoveryMode : enumeration |
Holds the mode that is used for the autoDiscovery
Available values are:
Constant | Description |
---|---|
NoAutoDiscovery | No auto discovery is done and the ServiceObject needs to be set manually. |
AutoDiscovery | Tries to find a production backend with a matching interface and falls back to a simulation backend if not found. |
LoadOnlyProductionBackends | Only tries to load a production backend with a matching interface. |
LoadOnlySimulationBackends | Only tries to load a simulation backend with a matching interface. |
If needed the auto discovery will be started once the Feature creation is completed.
Note: If you change this property after the Feature is instantiated you need to call startAutoDiscovery() to search for a new Service Object
discoveryResult : enumeration |
The result of the last autoDiscovery
Available values are:
Constant | Description |
---|---|
NoResult | Indicates that no auto discovery was started because the feature has already assigned a valid ServiceObject. |
ErrorWhileLoading | An error has happened while searching for a backend with a matching interface. |
ProductionBackendLoaded | As a result of the auto discovery a production backend was loaded. |
SimulationBackendLoaded | As a result of the auto discovery a simulation backend was loaded. |
duration : int |
Holds the total duration of the current song in seconds.
isInitialized : bool |
Indicates whether the feature has been initialized with all the values from the backend.
The property is true
once the backend sends the QIviFeatureInterface::initializationDone signal to indicate that all values have now been initialized with values from the backend.
See also isValid and QIviFeatureInterface::initializationDone.
isValid : bool |
Indicates whether the feature is ready for use.
The property is true
if the feature is ready to be used, otherwise false
. Not being ready usually indicates that no suitable service object could be found, or that automatic discovery has not been triggered.
The backend still might not have sent all properties yet and is not fully initialized. Use isInitialized instead to know when the feature holds all correct values.
See also QIviServiceObject, discoveryMode, and isInitialized.
playMode : enumeration |
Holds the current playback mode of the media player. Available values are:
Constant | Description |
---|---|
Normal | Each item in the queue is played in sequential order. Usually the playback stops when the end of the queue is reached. |
RepeatTrack | Always repeat the current item. It should still be possible to change the current item using next() and previous(), but this depends on the implementation of the backend. |
RepeatAll | When the end of the queue is reached, the first item starts to play. |
Shuffle | The item in the queue are played in an random order. |
playState : enumeration |
Holds the current playback state of the media player. Available values are:
Constant | Description |
---|---|
Playing | The media player is currently playing an item. |
Paused | The playback is paused and can be continued at the same position. |
Stopped | The playback hasn't been started yet. Starting it, will always start from the beginning. |
position : int |
Holds the position of the current song of the media player in seconds.
Sets the service object for the feature.
As features only expose the front API facing the developer, a service object implementing the actual function is required. This is usually retrieved through the auto discovery mechanism.
The setter for this property returns false if the Service Object is already set to exactly this instance or the Service Object doesn't get accepted by the feature.
See also discoveryMode.
Method Documentation
Seeks into the current track using offset.
The offset can be positive or negative to either seek forward or backward. A successful seek will result in a change of the position property.
enumeration startAutoDiscovery() |
Performs an automatic discovery attempt.
The feature will try to locate a single service object implementing the required interface.
If no service object is found, the feature will stay invalid. If more than one service object is found, the first instance is used.
Either the type of the backend which was loaded or an error is returned.
If the discoveryMode is set to QIviAbstractFeature::NoAutoDiscovery this function will do nothing and return QIviAbstractFeature::NoResult.
Return values are:
Constant | Description |
---|---|
NoResult | Indicates that no auto discovery was started because the feature has already assigned a valid ServiceObject. |
ErrorWhileLoading | An error has happened while searching for a backend with a matching interface. |
ProductionBackendLoaded | As a result of the auto discovery a production backend was loaded. |
SimulationBackendLoaded | As a result of the auto discovery a simulation backend was loaded. |
See also Dynamic Backend System and QIviServiceManager.
© 2020 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.