javascript - YouTube API on iOS Safari, programmatically mute/unmute with custom controls? -


my goal have videos play, muted, scroll view, using youtube iframe api. part have working fine.

what doesn't work, on mobile, trying give users button mute/unmute video. so, video starts playing , want give user option turn on sound. unfortunately, youtube controls on mobile don't show option that. also, calling mute() or unmute() on video, on mobile, has 0 effect. mute/unmute button works on desktop, though, know isn't syntax issue.

i've found various answers on here, they're older, , have read webkit specs regarding rules of video. mute() video before calling play() in order them programmatically start playing on scroll on ios. once it's playing, though, there magic combination of events tell ios let user's organic click interaction impact player?

the rules audio must controlled user, if user clicks mute/unmute video, how convey webkit it's ok?

i relying on youtube api ismuted() method, returns boolean, decide when mute/unmute video. after logging value of ismuted(), though, discovered reason on mobile wasn't correct. so, video muted still return false, wouldn't fire unmute function.

the solution not trust api , toggle is-muted class on video wrappers when user taps button mute/unmute it. works intended on desktop , ios safari.


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -