Playing audio and video.
Media Player demonstrates a simple multimedia player that can play audio and or video files using various codecs.
To run the example from Qt Creator, open the Welcome mode and select the example from Examples. For more information, visit Building and Running an Example.
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 QPlayList object.
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.
connect(controls, SIGNAL(play()), player, SLOT(play())); connect(controls, SIGNAL(pause()), player, SLOT(pause())); connect(controls, SIGNAL(stop()), player, SLOT(stop()));
We can get the volume (and set our user interface representation)
controls->setVolume(player->volume());
and we can make widget 'volume' changes change the volume
connect(controls, SIGNAL(changeVolume(int)), player, SLOT(setVolume(int)));
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.
As part of the free Business evaluation, we offer a free welcome call for companies, to talk about your requirements, and how the Felgo SDK & Services can help you. Just sign up and schedule your call.
Sign up now to start your free Business evaluation: