This may be a bit of a late reply, but:
Check the path that you have spelled out in the QString. You may not need the double backslashes(only a single backslash).
Also, be sure that you can play the video file with a different player to make sure you have the right codec loaded.
To get this code to work on a LINUX box, I used Qt Creator to create a new Qt4 Gui Application project (under options I included multimedia and phonon).
Then I copied and pasted your code into the mainwindow.cpp file and changed the path spelled out in the QString to a video file (a .mov file) in my directory structure.
I added the following into the mainwindow.h file:
#include <Phonon>
(above the MainWindow class declaration)
namespace Phonon {
class MediaObject;
class VideoPlayer;
}
(under the private: data members)
Phonon::MediaObject *media;
Phonon::VideoPlayer *videoPlayer;
I compiled, tried it and it worked fine except there were two different windows: a Mainwindow and a window
that played the video file and then disappeared. Other than that, it worked fine. Hope this helps.
Bookmarks