简体   繁体   中英

WebRTC Audio Track No Sound on iOS iPhone/IPad

I am trying to figure out why there is no audio on my iPhone or iPad, my code is working on other devices. I am on IPad iOS 15.3.1 on my pad. Video is working, and both the video and audio work on Android, Chrome, etc. This is just an audio problem on iOS.

From my WebRTC I have HTML5 Audio Track tracks as such:

<audio muted="false" autoplay="1" id="xxxx"></audio>

When debugging, I connect my IPad and have run this volume check:

document.getElementById('xxx').volume

And it returns the value of 1, so the volume is on its loudest (I think according to HTML5 audio tags range from 0, 0.1, 0.2, xxxx 1).

document.getElementById('xxx').end

The ended returns false. Next I try to run the play() function as such:

$('#xxx')[0].play()
.then((resp) => { 
    console.log("Success"); 
    console.log(resp)
})
.catch(error => {console.log(error)})

And it executes the success response. But there is still no sound. What could be causing this issue on iOS only? enter code here

Try adding playsinline="true" to your video element. You can read more here: https://webrtchacks.com/autoplay-restrictions-and-webrtc/

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