JavaScript HTML5 audio issue with Mobile Safari iOS

I have created a Simon Game here on Codepen: http://codepen.io/nalexiou/pen/rOaQOK

On the desktop, the audio/sound is playing fine. However, when I visit the site using my iPhone's Safari, the sound will not play.

I call the play() method on the sound variables (green, red, etc.) via this jQueryUI code:

......
 $('.' + items[0]).addClass('active', speed, function() {
    obj[items[0]].play();}).removeClass('active', speed, 
    function() {
    nextItemActivate(items.slice(1));
 });
......

However, if I trigger the play() methods first like this:

$('.test').on('click', function() {
  green.play();
  red.play();
  yellow.play();
  blue.play();
})

then the my addClass code does play the sounds.

Could this issue be related with the jQueryUI library or is there something special I need to consider for the Mobile Safari browser?

Thank you.

Answer:1

I have a one-page website with several anchors (signifying div positions). After the page is resized (change in height only), I want to refresh the page. Then I want to scroll to the anchor the page ...

I have a one-page website with several anchors (signifying div positions). After the page is resized (change in height only), I want to refresh the page. Then I want to scroll to the anchor the page ...

I need this input informs when the user does not use a valid email address. takes the form gets red border or a message appears (a hover) next to the field HTML <body ng-controller="...

I need this input informs when the user does not use a valid email address. takes the form gets red border or a message appears (a hover) next to the field HTML <body ng-controller="...

  1. validating email address with regex
  2. validating email address with regex hackerrank
  3. validating email address with regex python
  4. validating email address with regex java
  5. validating email address with regex hackerrank java
  6. validating email address with regex c++
  7. validating email address with regex leetcode
  8. validating email address python
  9. validating email addresses with a filter hackerrank solution
  10. validating email address javascript
  11. validating email addresses with a filter
  12. validating email address in java
  13. validating email address in html
  14. validating email address in php
  15. validating email address c++
  16. validating email address in excel
  17. validating email address with regex hackerrank solution
  18. validating email address with regex hackerrank javascript

I have done a very long and tedious way of showing details for each option from the select list. I do understand this should not be the way as imagining having to do for hundreds of options. It is ...

I have done a very long and tedious way of showing details for each option from the select list. I do understand this should not be the way as imagining having to do for hundreds of options. It is ...

  1. display fields from table
  2. display fields in lightning component
  3. display fields in report filter area
  4. display fields in word
  5. display fields in mongodb
  6. display fields in visualforce page
  7. display fields in html
  8. display fields in splunk
  9. display fields in table sql
  10. display fields in powerapps
  11. display fields in sql
  12. display fields of custom post type
  13. display fields in jira
  14. display fields in tableau
  15. display fields in cobol
  16. display fields in access
  17. display fields in foxpro
  18. display fields inline
  19. form display field
  20. display fields in arcmap

I have some element like : <button ng-click="weirdFunction()">Pretty Button</button> And function in controller : $scope.weirdFunction = function(element) { console.log(element); } in ...

I have some element like : <button ng-click="weirdFunction()">Pretty Button</button> And function in controller : $scope.weirdFunction = function(element) { console.log(element); } in ...

  1. element with click event
  2. element click intercepted
  3. element click intercepted selenium
  4. element click intercepted exception
  5. element click
  6. element click javascript
  7. element click intercepted exception selenium
  8. element click intercepted protractor
  9. element click intercepted selenium python
  10. element click intercepted selenium java
  11. element click intercepted selenium c#
  12. element click jquery
  13. element click intercepted error in selenium
  14. element click js
  15. element clickable selenium
  16. element click intercepted python
  17. element click intercepted exception in selenium java
  18. element click web scraper
  19. element.click not working
  20. element click intercepted exception in selenium webdriver