diff --git a/src/MpvPlayerBackend.cpp b/src/MpvPlayerBackend.cpp index 09ac318..b3234b8 100644 --- a/src/MpvPlayerBackend.cpp +++ b/src/MpvPlayerBackend.cpp @@ -269,6 +269,12 @@ MpvPlayerBackend::addVolume(const QVariant& volume) << "volume" << volume); } +void +MpvPlayerBackend::seekAbsolute(const QVariant& seekTime) +{ + command(QVariantList() << "seek" << seekTime << "absolute"); +} + void MpvPlayerBackend::seek(const QVariant& seekTime) { @@ -393,6 +399,7 @@ MpvPlayerBackend::handle_mpv_event(mpv_event* event) } else if (strcmp(prop->name, "duration") == 0) { if (prop->format == MPV_FORMAT_DOUBLE) { double time = *(double*)prop->data; + updateDurationStringText(); findChild("progressBar")->setProperty("to", time); } } else if (strcmp(prop->name, "volume") == 0) { @@ -424,6 +431,7 @@ MpvPlayerBackend::handle_mpv_event(mpv_event* event) updatePrev(QVariant(pos)); } } else if (strcmp(prop->name, "pause") == 0) { + qDebug() << prop->data; updatePlayPause(getProperty("pause")); } else if (strcmp(prop->name, "tracks-menu") == 0) { QMetaObject::invokeMethod(this, "tracksUpdate"); diff --git a/src/MpvPlayerBackend.h b/src/MpvPlayerBackend.h index 41aa7da..6a0a1db 100644 --- a/src/MpvPlayerBackend.h +++ b/src/MpvPlayerBackend.h @@ -49,6 +49,7 @@ public slots: void addVolume(const QVariant& volume); void loadFile(const QVariant& filename); void seek(const QVariant& seekTime); + void seekAbsolute(const QVariant& seekTime); void command(const QVariant& params); void setProperty(const QString& name, const QVariant& value); void setOption(const QString& name, const QVariant& value); diff --git a/src/qml/main.qml b/src/qml/main.qml index 649757b..35f4c31 100644 --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -173,7 +173,7 @@ ApplicationWindow { if (val != 0) { skipto = Math.floor(progressBar.to / 9 * val) } - player.command(["seek", skipto, "absolute"]) + player.seekAbsolute(skipto) } function isAnyMenuOpen() { @@ -945,7 +945,7 @@ ApplicationWindow { bottomPadding: 0 onMoved: { - player.command(["seek", progressBar.value, "absolute"]) + player.seekAbsolute(progressBar.value) } function getProgressBarHeight(nyan, isMouse) { @@ -999,7 +999,7 @@ ApplicationWindow { z: 10 radius: height anchors.left: progressLength.right - anchors.leftMargin: progressBar.handle.width - 2 + anchors.leftMargin: 2 //anchors.left: progressBar.handle.horizontalCenter anchors.bottom: progressBar.background.bottom anchors.top: progressBar.background.top