Merge pull request #18 from kasmtech/bugfix/KASM-2034_mobile_audio

KASM-2034 Unlock mobile audio playing on first mobile touch event
This commit is contained in:
j-travis 2021-11-08 10:51:49 -05:00 committed by GitHub
commit 0509b6241f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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;
}