Home · All Classes · All Functions ·

QML Audio Element Reference

The Audio element allows you to add audio playback to a scene. More...

Properties

Signals

Methods

Detailed Description

This element is part of the Qt.multimedia 1.0 module.

    import Qt 4.7
    import Qt.multimedia 1.0

    Text {
        text: "Click Me!";
        font.pointSize: 24;
        width: 150; height: 50;

        Audio {
            id: playMusic
            source: "music.wav"
        }
        MouseArea {
            id: playArea
            anchors.fill: parent
            onPressed:  { playMusic.play() }
        }
    }

See also Video.


Property Documentation

autoLoad : url

This property indicates if loading of media should begin immediately.

Defaults to true, if false media will not be loaded until playback is started.


read-onlybufferProgress : real

This property holds how much of the data buffer is currently filled, from 0.0 (empty) to 1.0 (full).


duration : int

This property holds the duration of the media in milliseconds.

If the media doesn't have a fixed duration (a live stream for example) this will be 0.


read-onlyerror : enumeration

This property holds the error state of the audio. It can be one of:


read-onlyerrorString : string

This property holds a string describing the current error condition in more detail.


muted : bool

This property holds whether the audio output is muted.


paused : bool

This property holds whether the media is paused.

Defaults to false, and can be set to true to pause playback.


playbackRate : real

This property holds the rate at which audio is played at as a multiple of the normal rate.


playing : bool

This property holds whether the media is playing.

Defaults to false, and can be set to true to start playback.


position : int

This property holds the current playback position in milliseconds.

If the seekable property is true, this property can be set to seek to a new position.


seekable : bool

This property holds whether position of the audio can be changed.

If true; setting a position value will cause playback to seek to the new position.


source : url

This property holds the source URL of the media.


read-onlystatus : enumeration

This property holds the status of media loading. It can be one of:


volume : real

This property holds the volume of the audio output, from 0.0 (silent) to 1.0 (maximum volume).


Signal Documentation

Audio::onBuffered ()

This handler is called when the media has finished buffering.


Audio::onBuffering ()

This handler is called when the media starts buffering.


Audio::onEndOfMedia ()

This handler is called when playback stops because end of the media has been reached.


Audio::onError ( error, errorString )

This handler is called when an error has occurred. The errorString parameter may contain more detailed information about the error.


Audio::onLoaded ()

This handler is called when the media source has been loaded.


Audio::onPaused ()

This handler is called when playback is paused.


Audio::onResumed ()

This handler is called when playback is resumed from the paused state.


Audio::onStalled ()

This handler is called when playback has stalled while the media buffers.


Audio::onStarted ()

This handler is called when playback is started.


Audio::onStopped ()

This handler is called when playback is stopped.


Method Documentation

Audio::pause ()

Pauses playback of the media.

Sets the playing and paused properties to true.


Audio::play ()

Starts playback of the media.

Sets the playing property to true, and the paused property to false.


Audio::stop ()

Stops playback of the media.

Sets the playing and paused properties to false.



Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies) Trademarks
Qt Mobility Project 1.0.2