This is the code used to create Video player in the Constructor of the video class

Qt Code:
  1. videoplayer=new Phonon::VideoPlayer(Phonon::VideoCategory,this);
  2. videoplayer->setGeometry(QRect(190, 85, 549, 366));
  3. volumeSlider = new Phonon::VolumeSlider(this);
  4. volumeSlider->setObjectName(QString::fromUtf8("volumeSlider"));
  5. volumeSlider->setGeometry(QRect(614, 465, 100, 22));
  6. volumeSlider->setAudioOutput(videoplayer->audioOutput());
  7. volumeSlider->setMuteVisible(true);
  8. volumeSlider->setStyleSheet(" background:none; border:none;");
  9. volumeSlider->setCursor(Qt::PointingHandCursor);
  10.  
  11. seeksilder = new Phonon::SeekSlider(this);
  12. seeksilder->setGeometry(QRect(390, 465, 210, 22));
  13. seeksilder->setMediaObject(videoplayer->mediaObject());
  14. seeksilder->setStyleSheet(" background:none; border:none;");
  15. seeksilder->setCursor(Qt::PointingHandCursor);
  16. videoplayer->load(Phonon::MediaSource ("video.wmv"));
  17. videoplayer->play(Phonon::MediaSource("video.wmv"));
To copy to clipboard, switch view to plain text mode 





When navigated to other window this code is used in button click
Qt Code:
  1. videoplayer->stop();
  2. startWindow *start=new startWindow;
  3. start->show();
  4. this->close();
To copy to clipboard, switch view to plain text mode 





When returned to the video class , this code is used

Qt Code:
  1. videoclass *m=new videoclass;
  2. m->show();
  3. this->hide();
To copy to clipboard, switch view to plain text mode 









The Problem is that when navigated four or five times, there is no problem for the videoplayer in the video class . But after 6 times, videoplayer gets stuck and no video is displayed but we can hear the audio , and the control the seek slider and volume slider is gone .

Since I am Beginner in qt , I need the help and advise of experienced qt programmers , please help me