MZ Disabling Auto-Pause / Screen-Freeze when the window is not selected

Sorry about my ignorance, but I need to disable the feature of auto-pause / auto-freeze on RPG Maker MZ.

You know when the game is running on MZ and you click outside the window, the game stops running, right?

There are two reasons for that, after some trials, It seems that this is the main problem for black screen when converting HTML5 into android / APK.

The second reason is that in one of my projects I need the sounds to be followed regardless the selected window.
I have an event that a character starts speaking, but if you click outside the window by accident, the dialogue is no longer synced...

So, if anyone can help me out on that, I'd very much appreciate it.

I'm new at the forum, but not that as an RPG Maker user...

Thanks in advance.
Moved to: Plugin Requests

as this will need a plugin to achieve.
Sorry. But it is there a plugin to "fix" it or is there an option on RMVZ (native) to do so?
unlikely (yet) for the first question and no for the second.

what you propose is not as simple as you think it is, and someone will have to spent some time to write a plugin that does the changes.
I found this line in more than one place on rmmz_core.js:
Code:
window.addEventListener("blur", this._onLostFocus.bind(this));

The next tests I did were using Game.exe and the Firefox browser.

I checked using window.onblur from the console (F12), it returned null.

I made a basic Plugin just that this event didn't happen, it didn't work, I tried to remove it manually, it didn't work either.

I also tried to remove with Javascript:
Code:
window.removeEventListener
Unsuccessfully...

Finally, I created a new "index.html" with pure code written from scratch, where it showed just one random number being changed every second.
I put a function to stop the execution for the "blur" event and removed the event by command line and it worked.

It concludes that the event that freezes the game cannot really be this, but it's also nothing in the DLLs.

My suggestion, it is better to find a plugin that pauses all types of sound in the game.
Leaving the game screen while it is running on Android can cause several problems depending on the version of this operating system, because each one had its own version of WebView and not everyone received an update.
I thank you very much for the kindness and dedicated time. I wish I could enjoy MZ at full, but MV is more and more becoming a more viable option... it is kind of a frustration, though...

I tested a conversion to APK by using a simple software. MV files work just fine, but for MZ it returns a black screen with sound only...

If only there was an easier way to convert MZ to Android it would help a lot. The music part I will figure something out by adding more and more events to the chats...
I created a Plugin that pauses BGM and BGS when leaving the screen and when it focuses back on the game screen, both continue where they left off (Memorizing through the POS of the WebAudio API).
The problem is that I am still finishing so that this also works correctly with ME and SE.

I have no deadline to complete, as I am working all week and the weekend too.
I also cannot guarantee that I will succeed.

In fact, the sound of the MV is very similar to that of the MZ.

A game made by the MV on Android may be that the audio plays even though it leaves the screen, which will make it very strange, I even created a Plugin that does the same effect as the MZ if it leaves the window, to make the audio plugin compatible.

Perhaps there is already a PLUGIN that does this process in MZ.
I think the attached plugin should do it~
Spoiler: Full plugin code
JavaScript:
/*:
 * @target MZ
 * @plugindesc The game will remain active even if it loses focus.
 * @author Caethyril
 * @help Free to use and modify!
 */

// Override! Always return true (default: false if game doc is not in focus).
SceneManager.isGameActive = function() { return true; };
(Credit is appreciated but not necessary: this is a very simple plugin.)
Did yo
I created a Plugin that pauses BGM and BGS when leaving the screen and when it focuses back on the game screen, both continue where they left off (Memorizing through the POS of the WebAudio API).
The problem is that I am still finishing so that this also works correctly with ME and SE.

I have no deadline to complete, as I am working all week and the weekend too.
I also cannot guarantee that I will succeed.

In fact, the sound of the MV is very similar to that of the MZ.

A game made by the MV on Android may be that the audio plays even though it leaves the screen, which will make it very strange, I even created a Plugin that does the same effect as the MZ if it leaves the window, to make the audio plugin compatible.

Perhaps there is already a PLUGIN that does this process in MZ.
u ever make that script that pauses BGM and BGS?

Original thread: https://forums.rpgmakerweb.com/threads/disabling-auto-pause-screen-freeze-when-the-window-is-not-selected.135949/