splitter->addWidget(playlistWidget);
videoAreaWidget = new VideoAreaWidget(this);
- videoAreaWidget->setMinimumSize(320,240);
+ // videoAreaWidget->setMinimumSize(320,240);
-#ifdef APP_MAC_NO
+#ifdef APP_MAC
// mouse autohide does not work on the Mac (no mouseMoveEvent)
videoWidget = new Phonon::VideoWidget(this);
#else
connect(mediaObject, SIGNAL(currentSourceChanged(Phonon::MediaSource)),
this, SLOT(currentSourceChanged(Phonon::MediaSource)));
// connect(mediaObject, SIGNAL(bufferStatus(int)), loadingWidget, SLOT(bufferStatus(int)));
+ connect(mediaObject, SIGNAL(aboutToFinish()), SLOT(aboutToFinish()));
}
void MediaView::search(SearchParams *searchParams) {
void MediaView::handleError(QString /* message */) {
- QTimer::singleShot(100, this, SLOT(startPlaying()));
+ QTimer::singleShot(500, this, SLOT(startPlaying()));
/*
videoAreaWidget->showError(message);
*/
}
-void MediaView::stateChanged(Phonon::State newState, Phonon::State /*oldState*/)
-{
-
- // qDebug() << "Phonon state: " << newState << oldState;
+void MediaView::stateChanged(Phonon::State newState, Phonon::State /*oldState*/) {
+ // qDebug() << "Phonon state: " << newState;
// slider->setEnabled(newState == Phonon::PlayingState);
switch (newState) {
case Finished:
// qDebug() << "Finished" << mediaObject->state();
// if (mediaObject->state() == Phonon::StoppedState) startPlaying();
+#ifdef Q_WS_X11
+ seekSlider->setEnabled(mediaObject->isSeekable());
+#endif
break;
case Failed:
// qDebug() << "Failed";
qDebug() << "Playing" << source;
mediaObject->setCurrentSource(source);
mediaObject->play();
+#ifdef Q_WS_X11
+ seekSlider->setEnabled(false);
+#endif
// ensure we always have 10 videos ahead
listModel->searchNeeded();
listModel->setActiveRow(prevRow);
}
+void MediaView::aboutToFinish() {
+ qint64 currentTime = mediaObject->currentTime();
+ qDebug() << __PRETTY_FUNCTION__ << currentTime;
+ if (currentTime + 10000 < mediaObject->totalTime()) {
+ // mediaObject->seek(mediaObject->currentTime());
+ // QTimer::singleShot(500, this, SLOT(playbackResume()));
+ mediaObject->seek(currentTime);
+ mediaObject->play();
+ }
+}
+
void MediaView::playbackFinished() {
+ qDebug() << __PRETTY_FUNCTION__ << mediaObject->currentTime();
// qDebug() << "finished" << mediaObject->currentTime() << mediaObject->totalTime();
// add 10 secs for imprecise Phonon backends (VLC, Xine)
if (mediaObject->currentTime() + 10000 < mediaObject->totalTime()) {
}
void MediaView::playbackResume() {
+ qDebug() << __PRETTY_FUNCTION__ << mediaObject->currentTime();
mediaObject->seek(mediaObject->currentTime());
mediaObject->play();
}
#include <QtNetwork>
#include <phonon/mediaobject.h>
#include <phonon/videowidget.h>
+#include <phonon/seekslider.h>
#include "View.h"
#include "ListModel.h"
#include "segmentedcontrol.h"
}
void setMediaObject(Phonon::MediaObject *mediaObject);
- void setSlider(QSlider *slider);
+ void setSlider(Phonon::SeekSlider *slider) { this->seekSlider = slider; }
public slots:
void search(SearchParams *searchParams);
void stateChanged(Phonon::State newState, Phonon::State oldState);
void currentSourceChanged(const Phonon::MediaSource source);
void showVideoContextMenu(QPoint point);
+ void aboutToFinish();
// bar
void searchMostRelevant();
void searchMostRecent();
// phonon
Phonon::MediaObject *mediaObject;
Phonon::VideoWidget *videoWidget;
+ Phonon::SeekSlider *seekSlider;
// loadingWidget
VideoAreaWidget *videoAreaWidget;