Search code examples
javascripthtmliossafarihtml5-audio

I can't play html audio with muted attribute in ios14.2 safari


Audio plays well with the muted attribute in versions below ios 14.2. (In muted state, but time of music continues.)

However, since iOS 14.2, audio has been acting strangely. If audio is played with the muted attribute applied, the audio stops immediately. if the audio is played again, it stops immediately and the audio duration is distorted. ( like 0.0006 )

Is there anyone who knows why?

I attach jsfiddle. ( Testing in ios 14.2 can check issue )

<div>
  <div>* Mp3</div>
  <audio onplay="onPlayHandler()" id="audio" 
 src="https://upload.wikimedia.org/wikipedia/commons/transcoded/d/de/Lorem_ipsum.ogg/Lorem_ipsum.ogg.mp3" muted="true" controls="true"></audio>
  <button onclick="mutedAudio()">toggle muted</button>
  <div>
    <br/>
    * isMuted : <span id="muted_state">true</span>
  </div>
  <div>
    * audioDuration(update when play audio) : <span id="duration"/>
  </div>
</div>

JSFiddle

First time played with muted(stop immediately) First time

Second time played with muted(also stop immediately. Please check audio duration) enter image description here


Solution

  • I posted bug report at webkit bugzilla and received answer.

    https://bugs.webkit.org/show_bug.cgi?id=219295#c5