(Android) Added a reset of the video element delay timer on activity resume

This commit is contained in:
Leon Styhre 2024-02-10 10:49:02 +01:00
parent 2a2400fc73
commit 7e64c15388
7 changed files with 22 additions and 2 deletions

View file

@ -508,6 +508,7 @@ void applicationLoop()
blockInput = true;
inputBlockTime = 0;
window->setBlockInput(true);
ViewController::getInstance()->resetViewVideosTimer();
}
#endif
InputManager::getInstance().parseEvent(event);

View file

@ -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
{

View file

@ -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<ThemeData>& theme);

View file

@ -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)

View file

@ -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() {}

View file

@ -14,8 +14,6 @@
#include "utils/FileSystemUtil.h"
#include "utils/StringUtil.h"
#include <SDL2/SDL_timer.h>
#define SCREENSAVER_FADE_IN_TIME 900
#define MEDIA_VIEWER_FADE_IN_TIME 600

View file

@ -15,6 +15,8 @@
#include <atomic>
#include <string>
#include <SDL2/SDL_timer.h>
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.