Question

I'm trying to make a simple videoplayer using qt. However, I can't get the videowidget example that comes with qt to work, instead I get an error: "The QMediaPlayer object does not have a valid service". I'm using windows vista. Can I get the videos to play normally, even if that example isn't working? Is there any other simple way to test playing videos? Or is this a problem with qt?

Was it helpful?

Solution 2

This is expected on your Vista, unfortunately. See the relevant post from the maintainer:

On Windows XP, Qt Multimedia uses DirectShow (and WMF for Windows Vista and later). The DirectShow plugin binary is not included in the Qt 5.0 package (only the WMF plugin is). You need to compile QtMultimedia yourself, or just the DirectShow plugin in qtmultimedia/src/plugins/directshow

... in the following report on the Qt issue tracker:

Qt 5.0 and QMediaPlayer failure on Windows XP

The steps to build it on your would be:

  • grab the tarball
  • unpack it
  • move into the qtmultimedia folder
  • run qmake -r
  • (n)make
  • (n)make install

Please make sure qmake is properly in your PATH before doing this.

OTHER TIPS

Check this VideoWidget I created: https://github.com/MaximAlien/VideoWidget. The main thing here is that the video should be in web and QMediaPlayer handles everything for you. Example works with Qt 5 and higher.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top