diff --git a/es-app/src/main.cpp b/es-app/src/main.cpp index 7713fedab..4b79bf132 100644 --- a/es-app/src/main.cpp +++ b/es-app/src/main.cpp @@ -508,6 +508,7 @@ void applicationLoop() blockInput = true; inputBlockTime = 0; window->setBlockInput(true); + ViewController::getInstance()->resetViewVideosTimer(); } #endif InputManager::getInstance().parseEvent(event); diff --git a/es-app/src/views/GamelistView.h b/es-app/src/views/GamelistView.h index fc6b14c02..1d580028d 100644 --- a/es-app/src/views/GamelistView.h +++ b/es-app/src/views/GamelistView.h @@ -56,6 +56,13 @@ public: for (auto& video : mStaticVideoComponents) video->muteVideoPlayer(); } + void resetViewVideosTimer() override + { + for (auto& video : mVideoComponents) + video->resetVideoPlayerTimer(); + for (auto& video : mStaticVideoComponents) + video->resetVideoPlayerTimer(); + } void stopGamelistFadeAnimations() override { diff --git a/es-app/src/views/SystemView.h b/es-app/src/views/SystemView.h index 9c044b40f..9b27f5c91 100644 --- a/es-app/src/views/SystemView.h +++ b/es-app/src/views/SystemView.h @@ -94,6 +94,11 @@ public: for (auto& video : mSystemElements[mPrimary->getCursor()].videoComponents) video->muteVideoPlayer(); } + void resetViewVideosTimer() override + { + for (auto& video : mSystemElements[mPrimary->getCursor()].videoComponents) + video->resetVideoPlayerTimer(); + } void onThemeChanged(const std::shared_ptr& theme); diff --git a/es-app/src/views/ViewController.h b/es-app/src/views/ViewController.h index f2a5c7107..68845b9b7 100644 --- a/es-app/src/views/ViewController.h +++ b/es-app/src/views/ViewController.h @@ -85,6 +85,8 @@ public: void stopViewVideos() override { mCurrentView->stopViewVideos(); } void pauseViewVideos() override { mCurrentView->pauseViewVideos(); } void muteViewVideos() override { mCurrentView->muteViewVideos(); } + // Needed on Android to reset the static image delay timer on activity resume. + void resetViewVideosTimer() override { mCurrentView->resetViewVideosTimer(); } void onFileChanged(FileData* file, bool reloadGamelist); void triggerGameLaunch(FileData* game) diff --git a/es-core/src/GuiComponent.h b/es-core/src/GuiComponent.h index 261c25fa4..26638e0f0 100644 --- a/es-core/src/GuiComponent.h +++ b/es-core/src/GuiComponent.h @@ -310,6 +310,8 @@ public: virtual void stopViewVideos() {} virtual void pauseViewVideos() {} virtual void muteViewVideos() {} + // Needed on Android to reset the static image delay timer on activity resume. + virtual void resetViewVideosTimer() {} // Used to reset various components like text scrolling, animations etc. virtual void resetComponent() {} diff --git a/es-core/src/components/VideoComponent.cpp b/es-core/src/components/VideoComponent.cpp index d05e628a6..af20c72e9 100644 --- a/es-core/src/components/VideoComponent.cpp +++ b/es-core/src/components/VideoComponent.cpp @@ -14,8 +14,6 @@ #include "utils/FileSystemUtil.h" #include "utils/StringUtil.h" -#include - #define SCREENSAVER_FADE_IN_TIME 900 #define MEDIA_VIEWER_FADE_IN_TIME 600 diff --git a/es-core/src/components/VideoComponent.h b/es-core/src/components/VideoComponent.h index 6095623bc..a9347c567 100644 --- a/es-core/src/components/VideoComponent.h +++ b/es-core/src/components/VideoComponent.h @@ -15,6 +15,8 @@ #include #include +#include + class MediaViewer; class TextureResource; @@ -84,6 +86,9 @@ public: virtual void stopVideoPlayer(bool muteAudio = true) {} virtual void pauseVideoPlayer() {} + // Needed on Android to reset the static image delay timer on activity resume. + void resetVideoPlayerTimer() { mStartTime = SDL_GetTicks() + mConfig.startDelay; } + // Handle looping of the video. Must be called periodically. virtual void handleLooping() {} // Used to immediately mute audio even if there are still samples to play in the buffer.