KASM-2034 Unlock mobile audio playing on first mobile touch event

This commit is contained in:
Mariusz Marciniak 2021-11-02 21:46:51 +01:00
parent 66cf8fd53e
commit 66c5812b4e
1 changed files with 9 additions and 0 deletions

View File

@ -960,6 +960,15 @@ export default class RFB extends EventTargetMixin {
}
_focusCanvas(event) {
// Hack:
// On most mobile phones it's only possible to play audio
// only if it's triggered by a user action. Moreover, since it's also
// impossible to listen for touch events on child frames (only on mobile phones)
// we delegate the audio unlocking to the parent window.
if (window.parent && !window.parent.KASM_AUDIO_UNLOCKED) {
window.parent.unlockAudio();
}
if (!this.focusOnClick) {
return;
}