goldfire / howler.js

Javascript audio library for the modern web.
https://howlerjs.com
MIT License
23.29k stars 2.21k forks source link

Howler.mute(false) doesn't work sometimes after the document lost focus or if the screen is locked and then unlocked IOS Chrome/Safari #1674

Open EvanetaI opened 11 months ago

EvanetaI commented 11 months ago

The Problem

Howler.mute(false) doesn't work sometimes after the document lost focus or if the screen is locked and then unlocked IOS Chrome, Safari. This happens when "visibilitychange" is being emitted, i.e., screen locked or if the tab is minimized. It's not an audio context issue, because I did check if the context is lost, and it's not. Sometimes the audio is back when a screen click is performed, but sometimes this doesn't work.

protected handleVisibilityChange(): void { if (document.visibilityState == 'hidden') { Howler.mute(true); } else { Howler.mute(false); } }

Reproducible Example

No response

Reproduction Steps

Device: iOS - iPhone X 16.5.1 & 11 Pro 15.6

100% Reproducible: yes

Browser: Safari, Chrome

  1. Play sound
  2. Lock the screen
  3. Unlock

Possible Solution

No response

Context

No response

Howler.js Version

v2.1.2 v2.2.3

Affected Browser(s)/Versiuon(s)

No response