Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

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).


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.


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.

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.


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.


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:

  • 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.

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.


Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 80
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. 2017 : un quinquennat pour une nouvelle version du C++ ? Possible, selon Herb Sutter 6
Page suivante

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt qtmobility-1.0
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web