本文介绍了IOS13是否已损坏< audio>标签用作连接到音频上下文的音频缓冲区?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们目前正在开发一个网站,允许用户播放连接到音频上下文的简单音频标签.我们知道IOS的技术问题,例如由用户手势启动的播放.一切正常,直到IOS12.现在IOS13已经发布了,什么都没有了.

We are currently developing a website that allows users to play simple audio tags connected to the audiocontext. We are aware of technical issues with IOS such as playback initiated by user gestures. Everything is working fine up to IOS12.Now that IOS13 is out, nothing works anymore.

它适用于所有台式机,Android和IOS(最高IOS13).

It works on all desktops, android and IOS up to IOS13.

有什么想法吗?

使用连接到iPhone的Desktop上的Safari进行调试时,控制台中没有错误消息.

There are no error messages in the console when debugging with Safari on Desktop connected to the iphone.

https://codepen.io/gchad/pen/WNNvzzd

<!DOCTYPE html>
        <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<body>

<div>
  <h1>Play Audio Tag connected to audio context</h1>
  <div id="playbutton" style="width:100px; height:100px; background:blue; color:white; margin:auto; text-align: center; font-size: 30px; cursor: pointer;">
    Play
  </div>

  <audio  id="myPlayer" crossorigin="anonymous" >
    <source src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/858/outfoxing.mp3"/>
      <!--http://commondatastorage.googleapis.com/codeskulptor-assets/week7-brrring.m4a-->
  </audio>
</div>

<script>

var player = document.getElementById('myPlayer'),
playbutton = document.getElementById('playbutton'),
playStatus = 'paused';

var audioContext = new(window.AudioContext || window.webkitAudioContext)();
var audioSource = audioContext.createMediaElementSource(player);
audioSource.connect(audioContext.destination);

playbutton.addEventListener('click',function(ev){

  if( playStatus == 'paused'){

    audioContext.resume();
    player.play();
    playbutton.innerHTML = "Pause";
    playStatus = 'isPlaying';

  } else {

      player.pause();
      playbutton.innerHTML = "Play";
      playStatus = 'paused';
  }
});
</script>

</body>

推荐答案

不幸的是,自iOS 13发行以来, AudioContext.createMediaElementSource 已被破坏.据报道该错误已在: https://bugs.webkit.org/show_bug.cgi?id=203435 ,但它仍然存在在最新版本的iOS中已损坏,因此提交了新的错误报告,可在此处找到: https://bugs.webkit.org/show_bug.cgi?id=211394

Unfortunately, AudioContext.createMediaElementSource has been broken since the release of iOS 13. The bug was reported to be fixed in Safari Technology Preview 99: https://bugs.webkit.org/show_bug.cgi?id=203435, but it's still broken in the recent release of iOS, so a new bug report was filed which can be found here: https://bugs.webkit.org/show_bug.cgi?id=211394

这篇关于IOS13是否已损坏&lt; audio&gt;标签用作连接到音频上下文的音频缓冲区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 07:43