Playing MP4 and FLV with QMediaPlayer
-
Good day everyone!
background info
All machines mentioned below are Win 7 Pro
Using Qt 5.0.2I am trying to do as the title says, I am using the QMediaPlayer and QVideoWidget to try and play video.
Here is the code:
@
//should be noted that mp4 are encoded with h264
QUrl filename = QUrl::fromLocalFile("sampleFile.mp4");
QMediaPlayer *mMediaPlayer = new QMediaPlayer();
QVideoWidget *mVideoWidget = new QVideoWidget(this);this->setCentralWidget(mVideoWidget); //where this is the mainwindow
mMediaPlayer->setMedia(filename);
qDebug() << "Player error state -> " << mMediaPlayer->error(); //this says no error
qDebug() << "Media supported state -> " << QMediaPlayer::hasSupport("video/mp4"); // this gives a "1"this->show();
mMediaPlayer->play();
@The trick is this, I can put this on several different machines -- all are Windows 7 Pro:
1.) machine 1 -- development box, can play some mp4s but not others (all h264)
2.) machine 2 -- personal household box, will play the sampleFile mp4 sometimes
3.) machine 3 -- COMPLETELY clean windows 7 pro install, aside from the code above, has nothing installed on it, NEVER plays the mp4.All 3 machines can play the sampleFile.mp4 in Windows Media Player.
As a final note, none of these will play FLV either.
Pointers anyone? What am I missing here?