Requires two clicks to play on iOS
See original GitHub issuePlease advice what is the right way to unlock <audio> element on user gesture as required by iOS. I have the following in my code (shortened for brevity), works without a hitch on Android/Windows/MacOS, but on iOS requires two clicks.
componentDidMount() {
document.addEventListener('click', this.onPageClick);
}
componentWillUnmount() {
document.removeEventListener('click', this.onPageClick);
}
onPageClick(e){
const $el = $(e.target).closest('a[data-playable]');
const url = $el.attr('href')
if( $el.length ){ //check if a "playable" link was clicked
e.preventDefault();
this.play(url);
return false;
}
}
play(url) {
const newState = {
url,
played: 0,
loaded: 0,
playing: true
};
this.setState(newState);
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top Results From Across the Web
Why/when do I have to tap twice to trigger click on iOS
In many cases, it seems I need to tap once to trigger a hover and then again to trigger a click. The Mobile...
Read more >How to turn off Double Click to Install for apps on iPhone or iPad
Having trouble with the double click to install apps via the App Store ... Want another option that doesn't require two hands to...
Read more >How To Disable Double Click To Install - macReports
Double Click to Install ... First of all, you cannot disable the need to verify your purchases. However, there is a way, instead...
Read more >Adjust settings for the side or Home button on iPhone
Click Speed: Choose the speed required to double-click or triple-click the button—Default, Slow, or Slowest. Press and Hold to Speak: Choose whether Siri ......
Read more >Double clicks required on Mobile devices to open links
There is a known bug on iOS that sometimes occurs when using the Delay JS. This bug causes links to not work until...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Adding
autoplay="true"
to<audio>
element for iOS devices fixes the “two-clicks” issue. (By the way, currently the react-player demo also has this problem.)I also face the same issue and it’s work for me by setting the volume =0 for iphone as in iphone volume can’t be control via js