Phonon minimum needs to play a video

From Qt Wiki
Revision as of 16:17, 14 January 2015 by Maintenance script (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Phonon minimum needs to play a video.

The documentation about Phonon [doc.qt.nokia.com] provided by Qt doesn’t give you an “out of the box” explanation on how to play a video using Phonon in Qt. That’s why I write this down in order to help a little.

Before you start testing, make sure that you have the right programs and or libs installed on your computer. Look here [doc.qt.nokia.com] for the setup you need.

You need only 4 items to get a video to play.

  1. You need to have a Phonon::MediaObject [doc.qt.nokia.com]
  2. You need to have a Phonon::VideoWidget [doc.qt.nokia.com]
  3. You need to have a Phonon::AudioOutput [doc.qt.nokia.com]
  4. add your .pro file with “+= phonon”

Then the code:

That’s all there is.

  • Note: This code only works on local video files. I didn’t have YouTube videos and mms streaming working yet. When I do, I will edit this page.

It’s off course also possible for others to edit a working code.

Categories: