Iv built a javascript game, but on iOS with low power mode on the frame rate slows down to half speed giving the player a clear advantage. This Stackoverflow provides a solution that works.
A hidden video is loaded but triggers an error when it tries to autoplay, I then use that error to remove the start buttons and display a message. "please turn off low power mode!"
testVideo
.play()
.then(() => {})
.catch((error) => {
//Do something like adding controls to allow user to manually play
//document.body.style.display = 'none'; <!--example-->
});
});
the problem is my testVideo method only gets triggered on the initial page load. Meaning the player can turn on LPM any time after that and play the game in half speed. I tried removing the video and having it re-load as part of the game reset method but this doesn't work because the error is triggered by browser default not allowing for autoplay which only happens on refresh.
While not a direct solution, an alternative way to handle this would be to warn the player that "the game does not work as intended on LPM" in a little banner that they can choose to turn off.