Revision control
++ // Copyright (C) 2021 The Qt Company Ltd.
++ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
++
++ /*!
++ \example player
++ \title Media Player Example
++ \ingroup multimedia_examples
++ \ingroup video_examples
++ \examplecategory {Multimedia}
++ \brief Playing audio and video using Qt Widgets.
++ \meta {tag} {widgets}
++
++ \image mediaplayerex.jpg
++ {Media player showing video playback and control panel}
++
++ \e{Media Player} demonstrates a simple multimedia player that can play
++ audio and video files using various codecs.
++
++ \include examples-run.qdocinc
++
++ The example uses a QMediaPlayer object passed into a QVideoWidget to
++ control the video output. To give the application playlist capability
++ we also use a QMediaPlaylist object. QMediaPlaylist was removed from
++ our API in Qt 6, but its implementation is included in this example.
++
++ An audio level meter shows peak and RMS levels during playback.
++ This is implemented by setting a QAudioBufferOutput to QMediaPlayer,
++ processing each QAudioBuffer it emits on a separate thread and
++ visualising the values through QWidget::paintEvent.
++
++ To activate the various functions such as play and stop on the dialog,
++ the button clicked events emit the play() and stop() signals, which
++ are connected to the play() and stop() slots of QMediaPlayer.
++
++ \code
++ connect(controls, SIGNAL(play()), player, SLOT(play()));
++ connect(controls, SIGNAL(pause()), player, SLOT(pause()));
++ connect(controls, SIGNAL(stop()), player, SLOT(stop()));
++ \endcode
++
++ We can get the volume (and set our user interface representation)
++
++ \code
++ controls->setVolume(player->volume());
++ \endcode
++
++ and we can make widget 'volume' changes change the volume
++
++ \code
++ connect(controls, SIGNAL(changeVolume(int)), player, SLOT(setVolume(int)));
++ \endcode
++
++ The example also allows us to change video properties by means
++ of the QVideoWidget object. We can go to Full Screen mode with a single
++ button click, and back again.
++ */