The video player is now stopped before attempting to remove media files.

This commit is contained in:
Leon Styhre 2021-01-31 20:51:24 +01:00
parent 4305c211eb
commit 4556a0c71a
5 changed files with 17 additions and 0 deletions

View file

@ -234,6 +234,9 @@ void BasicGameListView::removeMedia(FileData* game)
std::string mediaType;
std::string path;
// Stop the video player, especially important on Windows as the file would otherwise be locked.
onStopVideo();
// If there are no media files left in the directory after the deletion, then remove
// the directory too. Remove any empty parent directories as well.
auto removeEmptyDirFunc = []

View file

@ -543,6 +543,12 @@ void GuiComponent::onHide()
getChild(i)->onHide();
}
void GuiComponent::onStopVideo()
{
for (unsigned int i = 0; i < getChildCount(); i++)
getChild(i)->onStopVideo();
}
void GuiComponent::onPauseVideo()
{
for (unsigned int i = 0; i < getChildCount(); i++)

View file

@ -178,6 +178,7 @@ public:
virtual void onShow();
virtual void onHide();
virtual void onStopVideo();
virtual void onPauseVideo();
virtual void onUnpauseVideo();
virtual bool isVideoPaused() { return false; };

View file

@ -116,6 +116,12 @@ void VideoComponent::onHide()
manageState();
}
void VideoComponent::onStopVideo()
{
stopVideo();
manageState();
}
void VideoComponent::onPauseVideo()
{
mBlockPlayer = true;

View file

@ -43,6 +43,7 @@ public:
virtual void onShow() override;
virtual void onHide() override;
virtual void onStopVideo() override;
virtual void onPauseVideo() override;
virtual void onUnpauseVideo() override;
virtual bool isVideoPaused() override { return mPause; }