cannot play iPad <audio> over https

可紊 提交于 2019-12-11 00:49:02

问题


I am trying to play HTML5 on iPad Safari . Below is my code;

var audio = document.createElement('audio');
    audio.type = "audio/mpeg";
    audio.src = audioUrl;         
    x.appendChild(audio);
    audio.load();
    audio.play();

Now my audio files are called over https and for some reasons, it cannot play audio over https...I mean if I try manually playing mp3 files on http, it plays them fine..

How do I fix this issue?


回答1:


var audio = document.createElement('audio');
audio.type = "audio/mp3";
audio.src = audioUrl;         
x.appendChild(audio);
audio.load();
audio.play();

audio/mpeg may be the issue. Safari on iOS (including iPad) currently supports uncompressed WAV and AIF audio, MP3 audio, and AAC-LC or HE-AAC audio. HE-AAC is the preferred format.



来源:https://stackoverflow.com/questions/6306508/cannot-play-ipad-audio-over-https

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!