简体   繁体   中英

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) 第一次

Second time played with muted(also stop immediately. Please check audio duration) 在此处输入图像描述

I posted bug report at webkit bugzilla and received answer.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM