diff --git a/src/UI/DocumentViews/MpvContainer.cc b/src/UI/DocumentViews/MpvContainer.cc
index e7457ed853dbdfa173b1947ad354c77ce110ec5c..e722e5b623a3cd24127c1afdf81dcbaa9de7d516 100644
--- a/src/UI/DocumentViews/MpvContainer.cc
+++ b/src/UI/DocumentViews/MpvContainer.cc
@@ -77,7 +77,7 @@ MpvContainer::closeMpv() noexcept
 MpvContainer::~MpvContainer() noexcept { closeMpv(); }
 
 void
-MpvContainer::handleMpvEvent(mpv_event *event) noexcept
+MpvContainer::handleMpvEvent(const mpv_event *const event) noexcept
 {
     // Declare here variables that can be used in the switch-case statements
     qint64 w, h;
@@ -88,8 +88,8 @@ MpvContainer::handleMpvEvent(mpv_event *event) noexcept
         mpv_event_property *prop;
     };
 
-    auto checkProp = [](mpv_event_property *prop_, const std::string &str,
-                        int format) noexcept -> bool {
+    auto checkProp = [](const mpv_event_property *const prop_, const std::string_view str,
+                        const int format) noexcept -> bool {
         return (prop_->name == str) && (prop_->format == format);
     };
 
@@ -114,17 +114,17 @@ MpvContainer::handleMpvEvent(mpv_event *event) noexcept
 
     case MPV_EVENT_PROPERTY_CHANGE:
         prop = reinterpret_cast<mpv_event_property *>(event->data);
-        if (checkProp(prop, "time-pos"s, MPV_FORMAT_DOUBLE) && mpvTimeCallback) {
+        if (checkProp(prop, "time-pos", MPV_FORMAT_DOUBLE) && mpvTimeCallback) {
             time = *reinterpret_cast<double *>(prop->data);
             mpvTimeCallback(time);
         }
 
-        else if (checkProp(prop, "duration"s, MPV_FORMAT_DOUBLE) && mpvDurationCallback) {
+        else if (checkProp(prop, "duration", MPV_FORMAT_DOUBLE) && mpvDurationCallback) {
             time = *reinterpret_cast<double *>(prop->data);
             mpvDurationCallback(time);
         }
 
-        else if (checkProp(prop, "pause"s, MPV_FORMAT_FLAG)) {
+        else if (checkProp(prop, "pause", MPV_FORMAT_FLAG)) {
             isPlaybackPaused = *reinterpret_cast<bool *>(prop->data);
             emit mpvPlaybackToggled(!isPlaybackPaused);
             qDebug() << "MPV -> set to" << (isPlaybackPaused ? "pause" : "play");
@@ -220,7 +220,7 @@ void
 MpvContainer::onMpvEvent() noexcept
 {
     while (mpv) {
-        mpv_event *event = mpv_wait_event(mpv, 0);
+        const mpv_event *const event = mpv_wait_event(mpv, 0);
         if (event == nullptr || event->event_id == MPV_EVENT_NONE)
             break;
         handleMpvEvent(event);
@@ -234,7 +234,8 @@ MpvContainer::onMpvEvent() noexcept
 void
 MpvContainer::loadFile(const QString &filename) noexcept
 {
-    if (filename.isEmpty())
+    qDebug() << "Loading file" << filename;
+    if (filename.size() == 0)
         return;
 
     const QByteArray cFileName = filename.toUtf8();
diff --git a/src/UI/DocumentViews/MpvContainer.hh b/src/UI/DocumentViews/MpvContainer.hh
index 8296cac69656bfd2b8d14b3eb2bac70722744884..05a3dc6b9f62e3e71d450ca37c29ff001cc5b77a 100644
--- a/src/UI/DocumentViews/MpvContainer.hh
+++ b/src/UI/DocumentViews/MpvContainer.hh
@@ -8,6 +8,7 @@
 
 #include <functional>
 #include <initializer_list>
+#include <QThread>
 
 extern "C" {
 struct mpv_handle;
@@ -27,12 +28,12 @@ class MpvContainer final : public QWidget {
         ReloadAss,
         UnloadAss,
         SeekTime,
-        TogglePlayback,
+        TogglePlayback
     };
 
 private:
     bool isPlaybackPaused{ true };
-    mpv_handle *mpv{ nullptr };
+    mpv_handle *volatile mpv{ nullptr };
     qint64 sid{ -1 };
     std::function<void(double)> mpvTimeCallback{ nullptr };
     std::function<void(double)> mpvDurationCallback{ nullptr };
@@ -53,7 +54,7 @@ public:
     void registerMpvDurationCallback(std::function<void(double)>) noexcept;
 
 private:
-    void handleMpvEvent(mpv_event *) noexcept;
+    void handleMpvEvent(const mpv_event *const) noexcept;
     void closeMpv() noexcept;
     void printMpvError(int) const noexcept;
     void asyncCommand(const AsyncCmdType, std::initializer_list<const char *>) noexcept;