splitter->addWidget(playlistWidget);
videoAreaWidget = new VideoAreaWidget(this);
+ videoAreaWidget->setMinimumSize(320,240);
videoWidget = new Phonon::VideoWidget(this);
- videoWidget->setMinimumSize(320,240);
videoAreaWidget->setVideoWidget(videoWidget);
loadingWidget = new LoadingWidget(this);
- loadingWidget->setMinimumSize(320,240);
videoAreaWidget->setLoadingWidget(loadingWidget);
splitter->addWidget(videoAreaWidget);
layout->addWidget(splitter);
setLayout(layout);
+
}
MediaView::~MediaView() {
}
void MediaView::disappear() {
-
+ timerPlayFlag = true;
}
-void MediaView::stateChanged(Phonon::State newState, Phonon::State /* oldState */)
+void MediaView::stateChanged(Phonon::State newState, Phonon::State oldState)
{
+
+ qDebug() << "Phonon state: " << newState << oldState;
+
switch (newState) {
case Phonon::ErrorState:
// play() has already been called when setting the source
// but Phonon on Linux needs a little more help to start playback
mediaObject->play();
+ if (!timerPlayFlag) {
+ QTimer::singleShot(1000, this, SLOT(timerPlay()));
+ }
break;
case Phonon::PausedState:
}
void MediaView::exitFullscreen() {
- videoAreaWidget->setParent(this);
+ // videoAreaWidget->setParent(this);
splitter->addWidget(videoAreaWidget);
- videoAreaWidget->show();
+ // Just calling show() on the Mac won't work
+ videoAreaWidget->showNormal();
splitter->restoreState(splitterState);
}
// immediately show the loading widget
videoAreaWidget->showLoading(video);
- mediaObject->pause();
+ // mediaObject->pause();
connect(video, SIGNAL(gotStreamUrl(QUrl)), SLOT(gotStreamUrl(QUrl)));
video->loadStreamUrl();
+ // reset the timer flag
+ timerPlayFlag = false;
+
// see you in gotStreamUrl...
}
}
void MediaView::setPlaylistVisible(bool visible) {
- playlistWidget->setVisible(visible);
+ playlistWidget->setVisible(visible);
}
+void MediaView::timerPlay() {
+ qDebug() << mediaObject->currentTime();
+ // Workaround Phonon bug on Mac OSX
+ if (mediaObject->currentTime() <= 0 && mediaObject->state() == Phonon::PlayingState) {
+ mediaObject->pause();
+ mediaObject->play();
+ }
+}