QtMobility Reference Documentation

QML Audio Element

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

This element was introduced in Mobility 1.0.

Properties

Signal Handlers

Methods

Detailed Description

This element is part of the QtMultimediaKit 1.1 module.

 import Qt 4.7
 import QtMultimediaKit 1.1

 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.

This property group was introduced in Mobility 1.0.


read-onlybufferProgress : real

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

This property group was introduced in Mobility 1.0.


read-onlyduration : 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.

This property group was introduced in Mobility 1.0.


read-onlyerror : enumeration

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

  • NoError - there is no current error.
  • ResourceError - the audio cannot be played due to a problem allocating resources.
  • FormatError - the audio format is not supported.
  • NetworkError - the audio cannot be played due to network issues.
  • AccessDenied - the audio cannot be played due to insufficient permissions.
  • ServiceMissing - the audio cannot be played because the media service could not be instantiated.

This property group was introduced in Mobility 1.0.


read-onlyerrorString : string

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

This property group was introduced in Mobility 1.0.


read-onlymetaData.albumArtist : variant

This property holds the name of the principal artist of the album the media belongs to.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::AlbumArtist.


read-onlymetaData.albumTitle : variant

This property holds the title of the album the media belongs to.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::AlbumTitle.


read-onlymetaData.audioBitRate : variant

This property holds the bit rate of the media's audio stream ni bits per second.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::AudioBitRate.


read-onlymetaData.audioCodec : variant

This property holds the encoding of the media audio stream.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::AudioCodec.


read-onlymetaData.author : variant

This property holds the author of the media.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::Author.


read-onlymetaData.averageLevel : variant

This property holds the average volume level of the media.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::AverageLevel.


read-onlymetaData.category : variant

This property holds the category of the media

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::Category.


read-onlymetaData.channelCount : variant

This property holds the number of channels in the media's audio stream.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::ChannelCount.


read-onlymetaData.chapterNumber : variant

This property holds the chapter number of the media.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::ChapterNumber.


read-onlymetaData.comment : variant

This property holds a user comment about the media.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::Comment.


read-onlymetaData.composer : variant

This property holds the composer of the media.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::Composer.


read-onlymetaData.conductor : variant

This property holds the conductor of the media.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::Conductor.


read-onlymetaData.contributingArtist : variant

This property holds the names of artists contributing to the media.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::ContributingArtist.


read-onlymetaData.copyright : variant

This property holds the media's copyright notice.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::Copyright.


read-onlymetaData.coverArtUrlLarge : variant

This property holds the URL of a large cover art image.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::CoverArtUrlLarge.


read-onlymetaData.coverArtUrlSmall : variant

This property holds the URL of a small cover art image.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::CoverArtUrlSmall.


read-onlymetaData.date : variant

This property holds the date of the media.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::Date.


read-onlymetaData.description : variant

This property holds a description of the media.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::Description.


read-onlymetaData.director : variant

This property holds the director of the media.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::Director.


read-onlymetaData.genre : variant

This property holds the genre of the media.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::Genre.


read-onlymetaData.keywords : variant

This property holds a list of keywords describing the media.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::Keywords.


read-onlymetaData.language : variant

This property holds the language of the media, as an ISO 639-2 code.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::Language.


read-onlymetaData.leadPerformer : variant

This property holds the lead performer in the media.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::LeadPerformer.


read-onlymetaData.lyrics : variant

This property holds the lyrics to the media.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::Lyrics.


read-onlymetaData.mediaType : variant

This property holds the type of the media.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::MediaType.


read-onlymetaData.mood : variant

This property holds the mood of the media.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::Mood.


read-onlymetaData.parentalRating : variant

This property holds the parental rating of the media.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::ParentalRating.


read-onlymetaData.peakValue : variant

This property holds the peak volume of media's audio stream.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::PeakValue.


read-onlymetaData.pixelAspectRatio : variant

This property holds the pixel aspect ratio of an image or video.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::PixelAspectRatio.


read-onlymetaData.posterUrl : variant

This property holds the URL of a poster image.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::PosterUrl.


read-onlymetaData.publisher : variant

This property holds the publisher of the media.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::Publisher.


read-onlymetaData.ratingOrganisation : variant

This property holds the name of the rating organisation responsible for the parental rating of the media.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::RatingOrganisation.


read-onlymetaData.resolution : variant

This property holds the dimension of an image or video.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::Resolution.


read-onlymetaData.sampleRate : variant

This property holds the sample rate of the media's audio stream in hertz.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::SampleRate.


read-onlymetaData.size : variant

This property property holds the size of the media in bytes.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::Size.


read-onlymetaData.subTitle : variant

This property holds the sub-title of the media.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::SubTitle.


read-onlymetaData.title : variant

This property holds the tile of the media.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::Title.


read-onlymetaData.trackCount : variant

This property holds the number of track on the album containing the media.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::TrackNumber.


read-onlymetaData.trackNumber : variant

This property holds the track number of the media.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::TrackNumber.


read-onlymetaData.userRating : variant

This property holds a user rating of the media in the range of 0 to 100.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::UserRating.


read-onlymetaData.videoBitRate : variant

This property holds the bit rate of the media's video stream in bits per second.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::VideoBitRate.


read-onlymetaData.videoCodec : variant

This property holds the encoding of the media's video stream.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::VideoCodec.


read-onlymetaData.videoFrameRate : variant

This property holds the frame rate of the media's video stream.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::VideoFrameRate.


read-onlymetaData.writer : variant

This property holds the writer of the media.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::Writer.


read-onlymetaData.year : variant

This property holds the year of release of the media.

This property group was introduced in Mobility 1.1.

See also QtMultimediaKit::Year.


muted : bool

This property holds whether the audio output is muted.

This property group was introduced in Mobility 1.0.


paused : bool

This property holds whether the media is paused.

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

This property group was introduced in Mobility 1.0.


playbackRate : real

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

This property group was introduced in Mobility 1.0.


playing : bool

This property holds whether the media is playing.

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

This property group was introduced in Mobility 1.0.


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.

This property group was introduced in Mobility 1.0.


read-onlyseekable : 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.

This property group was introduced in Mobility 1.0.


source : url

This property holds the source URL of the media.

This property group was introduced in Mobility 1.0.


read-onlystatus : enumeration

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

  • NoMedia - no media has been set.
  • Loading - the media is currently being loaded.
  • Loaded - the media has been loaded.
  • Buffering - the media is buffering data.
  • Stalled - playback has been interrupted while the media is buffering data.
  • Buffered - the media has buffered data.
  • EndOfMedia - the media has played to the end.
  • InvalidMedia - the media cannot be played.
  • UnknownStatus - the status of the media is unknown.

This property group was introduced in Mobility 1.0.


volume : real

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

This property group was introduced in Mobility 1.0.


Signal Handler Documentation

Audio::onError ( error, errorString )

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

This documentation was introduced in Mobility 1.0.


Audio::onPaused ()

This handler is called when playback is paused.

This documentation was introduced in Mobility 1.0.


Audio::onResumed ()

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

This documentation was introduced in Mobility 1.0.


Audio::onStarted ()

This handler is called when playback is started.

This documentation was introduced in Mobility 1.0.


Audio::onStopped ()

This handler is called when playback is stopped.

This documentation was introduced in Mobility 1.0.


Method Documentation

Audio::pause ()

Pauses playback of the media.

Sets the playing and paused properties to true.

This documentation was introduced in Mobility 1.0.


Audio::play ()

Starts playback of the media.

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

This documentation was introduced in Mobility 1.0.


Audio::stop ()

Stops playback of the media.

Sets the playing and paused properties to false.

This documentation was introduced in Mobility 1.0.


X

Thank you for giving your feedback.

Make sure it is related to this specific page. For more general bugs and requests, please use the Qt Bug Tracker.