# Include <qtgui>
# Include <qwidget>
# Include <qvboxlayout>
# Include <qhboxlayout>
# Include <phonon/mediaobject>
# Include <phonon/videoplayer>
# Include <phonon/backendcapabilities>
# Include <qurl>
Myplayer: myplayer (qwidget * parent ):
Qdialog (parent ),
UI (new UI: myplayer)
{
UI-> setupui (this );
}
// Home/projects/qtmplayer-Build-desktop/../qtmplayer/myplayer. cpp: 4: Error: qphonon: No file or directory
Myplayer ::~ Myplayer ()
{
Delete UI;
}
Void myplayer: on_playstart_clicked ()
{
Qwidget * widget = new qwidget;
Widget-> setwindowtitle ("Media Player ");
Widget-> resize (700,600 );
Phonon: mediaobject * Media = new phonon: mediaobject;
Media-> setcurrentsource (phonon: mediasource ("xmuming. mpg "));
Phonon: videowidget * vwidget = new phonon: videowidget (widget );
Phonon: createpath (Media, vwidget );
Vwidget-> setaspectratio (phonon: videowidget: aspectratioauto );
Phonon: audiooutput * aoutput = new phonon: audiooutput (phonon: videocategory );
Phonon: createpath (Media, aoutput );
Qlabel * label = new qlabel ("volume :");
Phonon: volumeslider * volumeslider = new phonon: volumeslider;
Volumeslider-> setaudiooutput (aoutput );
Volumeslider-> setsizepolicy (qsizepolicy: Maximum, qsizepolicy: Maximum );
Phonon: seekslider * seekslider = new phonon: seekslider;
Seekslider-> setmediaobject (media );
Qhboxlayout * hlayout = new qhboxlayout;
Hlayout-> addwidget (Label );
Hlayout-> addwidget (volumeslider );
Hlayout-> addstretch ();
Qvboxlayout * vlayout = new qvboxlayout;
Vlayout-> addwidget (vwidget );
Vlayout-> addwidget (seekslider );
Vlayout-> addlayout (hlayout );
Widget-> setlayout (vlayout );
Widget-> show ();
Media-> play ();
/*
This-> setwindowtitle ("My test video player ");
Phonon: videoplayer * player = new phonon: videoplayer (phonon: videocategory, UI-> widget );
Player-> load (phonon: mediasource ("/home/Video/xmuming. mpg "));
Player-> play ();
Phonon: mediaobject * mediaobject = new phonon: mediaobject (this );
Phonon: videowidget * videowidget = new phonon: videowidget (this );
Phonon: createpath (mediaobject, videowidget );
Phonon: audiooutput * audiooutput = new phonon: audiooutput (phonon: videocategory, this );
Phonon: createpath (mediaobject, audiooutput );
Mediaobject-> setcurrentsource (phonon: mediasource ("d :\\ 001.wmv "));
Mediaobject-> play ();
Phonon: mediaobject * Music =
Phonon: createplayer (phonon: musiccategory,
Phonon: mediasource ("/home/Video/caiyan. rmvb "));
Music-> play ();
Phonon: mediaobject * mediaobject = new phonon: mediaobject (this );
Mediaobject-> setcurrentsource (phonon: mediasource ("/mymusic/barbiegirl.wav "));
Phonon: audiooutput * audiooutput =
New phonon: audiooutput (phonon: musiccategory, this );
Phonon: Path = phonon: createpath (mediaobject, audiooutput );
// Play the video
Phonon: mediaobject * Music =
Phonon: createplayer (phonon: videocategory,
Phonon: mediasource ("/home/Video/caiyan. rmvb "));
Music-> play ();
*/
// Label = new qlabel (this );
// Label-> setscaledcontents (true );
// Movie = new qmovie ("tp.gif ");
// Label-> setmovie (movie );
// Movie-> Start ();
}
If you still cannot play the video, you need to convert it to the FFMPEG decoding library.
Sudo apt-Get install libxine1-ffmpeg