I have a code that plays audio files which downloads from S3. On the page user sees carousel with picture and word that he should pronounce and hear a audio with correct pronounciation. The problem is in Safari, it block auto-play of audio file on window load. I know that Safari block auto play by default and in setting Auto-Play: Stop Media with Sound is enabled. When I go to the page, Safari block autoplay of audio file and page stop to load and 'freez' and AudioContext state is 'suspended' if to call resume() on any user action click on document for example, state changes to 'running', but if i click next slide, the next function will call source.stop() to stop audio playing if audio was playing, the source is a bufferSource(AudioContext.createBufferSource()) and it throw error 'InvalidStateError' screenshot with error
Why this error occurred ? If state is in 'running' not 'suspended'. Also in coursel exist 3 button to play audio again, record audio and play recorded audio and after resume all work, but when the stop function called the error shown.