/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page qml-multimedia.html

    \title Qt Multimedia QML API

    \brief A QML API for the Qt Multimedia module.


    \section1 Overview

    The Qt Multimedia module gives developers a simplified way to use audio and video playback, and access camera functionality. The Multimedia QML API provides a QML friendly interface to these features.

    \section1 Types

    \section2 Audio

    \l Audio is an easy way to add audio playback to a Qt Quick
    scene. Qt Multimedia provides properties for control, methods (functions) and signals.

    The code extract below shows the creation and use of an Audio instance.

    \qml

    Item {
        width: 640
        height: 360

        Audio {
            id: playMusic
            source: "music.wav"
        }

        MouseArea {
            id: playArea
            anchors.fill: parent
            onPressed:  { playMusic.play() }
        }
    }

    \endqml

    The snippet above shows how the inclusion of \e playMusic enables audio features on the type that contains it. So that when the parent's MouseArea is clicked the \l {Audio::play()}{play()} method of Audio is run. Other typical audio control methods are available such as \l {Audio::pause}{pause()} and \l {Audio::stop()}{stop()}.

    Much of the getting / setting of \l Audio parameters is done through properties. These include
    \table 70%
        \header
            \li Property
            \li Description
        \row
            \li \l {Audio::source}{source}
            \li The source URL of the media.
        \row
            \li \l {Audio::autoLoad}{autoLoad}
            \li Indicates if loading of media should begin immediately.
        \row
            \li \l{Audio::playing}{playing}
            \li Indicates that the media is playing.
        \row
            \li \l {Audio::paused}{paused}
            \li The media is paused.
        \row
            \li \l{Audio::status}{status}
            \li The status of media loading.
        \row
            \li \l{Audio::duration}{duration}
            \li Amount of time in milliseconds the media will play.
        \row
            \li \l{Audio::position}{position}
            \li Current position in the media in milliseconds of play.
        \row
            \li \l{Audio::volume}{volume}
            \li Audio output volume: from 0.0 (silent) to 1.0 (maximum)
        \row
            \li \l{Audio::muted}{muted}
            \li Indicates audio is muted.
        \row
            \li \l{Audio::bufferProgress}{bufferProgress}
            \li Indicates how full the data buffer is: 0.0 (empty) to 1.0 (full).
        \row
            \li \l{Audio::seekable}{seekable}
            \li Indicates whether the audio position can be changed.
        \row
            \li \l{Audio::playbackRate}{playbackRate}
            \li The rate at which audio is played at as a multiple of the normal rate.
        \row
            \li \l{Audio::error}{error}
            \li An error code for the error state including NoError
        \row
            \li \l{Audio::errorString}{errorString}
            \li A description of the current error condition.
    \endtable

    The set of signals available allow the developer to create custom behavior when the following events occur,

    \table 70%
        \header
            \li Signal
            \li Description
        \row
            \li \l{Audio::playing}{playing}
            \li Called when playback is started, or when resumed from paused state.
        \row
            \li \l{Audio::paused}{paused}
            \li Called when playback is paused.
        \row
            \li \l{Audio::stopped}{stopped}
            \li Called when playback is stopped.
        \row
            \li \l{Audio::error}{error}
            \li Called when the specified error occurs.
    \endtable

    \section2 Camera

    \l Camera enables still image and video capture using
    QML. It has a number of properties that help setting it up.

    The details of using a \l Camera are described in further depth
    in the \l {Camera Overview} and in the corresponding reference documentation.

    \section2 Video

    Adding video playback, with sound, to a Qt Quick scene is also easy. The process is very similar to that of Audio above, in fact \l {Video} shares many of the property names, methods and signals. Here is the equivalent sample code to implement video playback in a scene

    \qml

    Video {
        id: video
        width : 800
        height : 600
        source: "video.avi"

        MouseArea {
            anchors.fill: parent
            onClicked: {
                video.play()
            }
        }

        focus: true
        Keys.onSpacePressed: video.paused = !video.paused
        Keys.onLeftPressed: video.position -= 5000
        Keys.onRightPressed: video.position += 5000
    }

    \endqml

    There are similar features like \l {Video::play()}{play()} with new
    features specific to video.

    In the above sample when the parent of MouseArea is clicked, an area of 800x600 pixels with an id of 'video', the source "video.avi" will play in that area. Notice also that signals for the \l Keys have been defined so that a spacebar will toggle the pause button; the left arrow will move the current position in the video to 5 seconds previously; and the right arrow will advance the current position in the video by 5 seconds.

    Most of the differences will obviously be about video control and information. There are many properties associated with \l {Video}, most of them deal with meta-data, control of the video media and aspects of presentation.

    \section2 SoundEffect

    \l SoundEffect provides a way to play short sound effects, like in video games. Multiple sound effect instances can be played simultaneously.
    You should use \l Audio for music playback.

    \qml

    Item {
        width: 640
        height: 360

        SoundEffect {
            id: effect
            source: "test.wav"
        }
        MouseArea {
            id: playArea
            anchors.fill: parent
            onPressed:  { effect.play() }
        }
    }

    \endqml


    In the above sample the sound effect will be played when the MouseArea is clicked.

    For a complete description of this type, see \l SoundEffect

    \section1 Multimedia QML Types

    \annotatedlist multimedia_qml
*/


