diff --git a/es-app/src/views/GamelistView.cpp b/es-app/src/views/GamelistView.cpp index 8ec066523..76a3f0582 100644 --- a/es-app/src/views/GamelistView.cpp +++ b/es-app/src/views/GamelistView.cpp @@ -21,11 +21,9 @@ GamelistView::GamelistView(FileData* root) , mRenderer {Renderer::getInstance()} , mViewStyle {ViewController::BASIC} , mLegacyMode {false} + , mStaticVideoAudio {false} { mViewStyle = ViewController::getInstance()->getState().viewstyle; - - if (mLegacyMode) - return; } GamelistView::~GamelistView() @@ -108,6 +106,7 @@ void GamelistView::onThemeChanged(const std::shared_ptr& theme) return; } + mStaticVideoAudio = false; const bool isStartupSystem {Settings::getInstance()->getString("StartupSystem") == mRoot->getSystem()->getName()}; @@ -199,6 +198,8 @@ void GamelistView::onThemeChanged(const std::shared_ptr& theme) if (mStaticVideoComponents.back()->getMetadataElement()) mStaticVideoComponents.back()->setScrollHide(true); mStaticVideoComponents.back()->setGeneralFade(true); + if (element.second.has("audio")) + mStaticVideoAudio = element.second.get("audio"); } else { mVideoComponents.push_back(std::make_unique()); @@ -552,7 +553,7 @@ void GamelistView::updateView(const CursorState& state) if (file == nullptr) { if (mVideoPlaying) { for (auto& video : mVideoComponents) { - video->stopVideoPlayer(); + video->stopVideoPlayer(!mStaticVideoAudio); video->setVideo(""); if (!video->hasStartDelay()) video->setImage(""); @@ -576,7 +577,7 @@ void GamelistView::updateView(const CursorState& state) for (auto& video : mVideoComponents) { setGameImage(mRandomGame, video.get()); - video->stopVideoPlayer(); + video->stopVideoPlayer(!mStaticVideoAudio); if (video->hasStaticVideo()) video->setStaticVideo(); @@ -593,7 +594,7 @@ void GamelistView::updateView(const CursorState& state) } for (auto& video : mVideoComponents) { - video->stopVideoPlayer(); + video->stopVideoPlayer(!mStaticVideoAudio); video->setImage(""); video->setVideo(""); if (video->hasStaticVideo()) { @@ -612,7 +613,7 @@ void GamelistView::updateView(const CursorState& state) for (auto& video : mVideoComponents) { setGameImage(file, video.get()); - video->stopVideoPlayer(); + video->stopVideoPlayer(!mStaticVideoAudio); if (video->hasStaticVideo()) video->setStaticVideo(); diff --git a/es-app/src/views/GamelistView.h b/es-app/src/views/GamelistView.h index 0da692e55..4723d2d16 100644 --- a/es-app/src/views/GamelistView.h +++ b/es-app/src/views/GamelistView.h @@ -127,6 +127,7 @@ private: HelpStyle mHelpStyle; ViewController::GamelistViewStyle mViewStyle; bool mLegacyMode; + bool mStaticVideoAudio; std::shared_ptr mTheme; std::vector mThemeExtras; diff --git a/es-core/src/components/VideoComponent.h b/es-core/src/components/VideoComponent.h index 3d3ce6bc0..d5dddf14d 100644 --- a/es-core/src/components/VideoComponent.h +++ b/es-core/src/components/VideoComponent.h @@ -90,7 +90,7 @@ public: // Basic video controls. void startVideoPlayer(); - virtual void stopVideoPlayer() {} + virtual void stopVideoPlayer(bool muteAudio = true) {} virtual void pauseVideoPlayer() {} // Handle looping of the video. Must be called periodically. diff --git a/es-core/src/components/VideoFFmpegComponent.cpp b/es-core/src/components/VideoFFmpegComponent.cpp index bbd199de4..c1dc4db1f 100644 --- a/es-core/src/components/VideoFFmpegComponent.cpp +++ b/es-core/src/components/VideoFFmpegComponent.cpp @@ -1441,9 +1441,10 @@ void VideoFFmpegComponent::startVideoStream() } } -void VideoFFmpegComponent::stopVideoPlayer() +void VideoFFmpegComponent::stopVideoPlayer(bool muteAudio) { - muteVideoPlayer(); + if (muteAudio) + muteVideoPlayer(); mIsPlaying = false; mIsActuallyPlaying = false; diff --git a/es-core/src/components/VideoFFmpegComponent.h b/es-core/src/components/VideoFFmpegComponent.h index ee4226fcb..4430ee406 100644 --- a/es-core/src/components/VideoFFmpegComponent.h +++ b/es-core/src/components/VideoFFmpegComponent.h @@ -47,7 +47,7 @@ public: // Never breaks the aspect ratio. setMaxSize() and setResize() are mutually exclusive. void setMaxSize(float width, float height) override; // Basic video controls. - void stopVideoPlayer() override; + void stopVideoPlayer(bool muteAudio = true) override; void pauseVideoPlayer() override; // Handle looping of the video. Must be called periodically. void handleLooping() override;