goldfire / howler.js

Javascript audio library for the modern web.
https://howlerjs.com
MIT License
23.98k stars 2.23k forks source link

iOS does not play using Web Audio API or HTML5 #1220

Open dorofino opened 5 years ago

dorofino commented 5 years ago

Hi, I'm trying to get code working on my mobile iOS 12.3 Safari 12. or Chrome 76. and it's not playing. I also tried your demos https://howlerjs.com/ and the only demo that works is the Music Player.

Do you have a working sample code that i can test?

Diego

dorofino commented 5 years ago

Please close this ticket,

In iOS, the Silent Mode needs to be set to off to work.

Joshfindit commented 5 years ago

I wish the silent mode was more consistent with playing audio that the user chooses to. YouTube, for example, plays every time. As does the music app. But Safari seems to be up to the whim of Apple.

dorofino commented 5 years ago

I wish the silent mode was more consistent with playing audio that the user chooses to. YouTube, for example, plays every time. As does the music app. But Safari seems to be up to the whim of Apple.

I know, I really dont understand Apple. They dont give a crap other norms.

st-h commented 5 years ago

this even is a little more complex: If you are using an audio element as it is done when html5 is set to true, then audio should play even when the device is muted. If you are using an AudioBuffer, as it is done when html5 is false, then audio is muted when the device is muted. One might speculate about the actual use cases apple had in mind when making these decisions, however the really unfortunate thing is that the audio element seems to be rather buggy on edge cases - especially when it is connected to an audio graph. I have submitted a detailed bug report about half a year ago and so far nobody at apple seems to have taken any notice of it.

valin0k commented 5 years ago

is it possible to play audio in iOS Safari with muted mode? I tried different cases but it still not works

st-h commented 5 years ago

@valin0k did you try as I suggested in the comment prior to yours? (Html5: true)

valin0k commented 5 years ago

@st-h hey, yes i tried different props and also html5: true, but no luck on iphone 8 & iphpne x emulators. const sound = new Howl({ src, format, usingWebAudio: false, html5: true, mute: false, loop: true, webAudio: false, volume: 1, }) html5: true is it works for you?

st-h commented 5 years ago

@valin0k seems to work here. I can even use the audio element to play a song when muted and then play another song using web audio and it still plays when the device is muted. However, if I first start web audio after a reload, sound is muted. Thanks, apple.

zhangolve commented 4 years ago

@st-h hey, yes i tried different props and also html5: true, but no luck on iphone 8 & iphpne x emulators. const sound = new Howl({ src, format, usingWebAudio: false, html5: true, mute: false, loop: true, webAudio: false, volume: 1, }) html5: true is it works for you?

thank you

Cooooe commented 4 years ago

@st-h hey, yes i tried different props and also html5: true, but no luck on iphone 8 & iphpne x emulators. const sound = new Howl({ src, format, usingWebAudio: false, html5: true, mute: false, loop: true, webAudio: false, volume: 1, }) html5: true is it works for you?

Thank you!

But.. Does anyone have a other solution?

I'm testing on iPhone 11, iPhone 10, iPhone 8, iPhone SE2. Sounds play well on most devices. However, on iPhone 11, the sound did not play when in mute mode.

quangv commented 4 years ago

If anyone else is having issue with howler and iphone/ios/mobile-safari, check your audio file extensions. For me, .wav & .mp3 works in iOS but .ogg does not. related: https://github.com/goldfire/howler.js/issues/1330

usamahashmii commented 4 years ago

@st-h hey, yes i tried different props and also html5: true, but no luck on iphone 8 & iphpne x emulators. const sound = new Howl({ src, format, usingWebAudio: false, html5: true, mute: false, loop: true, webAudio: false, volume: 1, }) html5: true is it works for you?

use of Howl library is the perfect way to do