File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change 573573 init : function ( o ) {
574574 var self = this ;
575575
576- // If we don't have an AudioContext created yet, run the setup.
577- if ( ! Howler . ctx ) {
578- setupAudioContext ( ) ;
579- }
580-
581576 // Setup user-defined default properties.
582577 self . _autoplay = o . autoplay || false ;
583578 self . _format = ( typeof o . format !== 'string' ) ? o . format : [ o . format ] ;
596591 withCredentials : o . xhr && o . xhr . withCredentials ? o . xhr . withCredentials : false ,
597592 } ;
598593
594+ if ( ! self . _html5 ) {
595+ // If we're not forcing HTML5 and we don't have an AudioContext created yet, run the setup.
596+ if ( ! Howler . ctx ) {
597+ // sets Howler.usingWebAudio
598+ setupAudioContext ( ) ;
599+ }
600+ } else {
601+ Howler . usingWebAudio = false ;
602+ }
603+ self . _webAudio = Howler . usingWebAudio ;
604+
599605 // Setup all other default properties.
600606 self . _duration = 0 ;
601607 self . _state = 'unloaded' ;
620626 self . _onunlock = o . onunlock ? [ { fn : o . onunlock } ] : [ ] ;
621627 self . _onresume = [ ] ;
622628
623- // Web Audio or HTML5 Audio?
624- self . _webAudio = Howler . usingWebAudio && ! self . _html5 ;
625-
626629 // Automatically try to enable audio.
627630 if ( typeof Howler . ctx !== 'undefined' && Howler . ctx && Howler . autoUnlock ) {
628631 Howler . _unlockAudio ( ) ;
25472550
25482551 // Create and expose the master GainNode when using Web Audio (useful for plugins or advanced usage).
25492552 if ( Howler . usingWebAudio ) {
2553+ // note: this part breaks iOS 13.3+ ControlCenter notification
25502554 Howler . masterGain = ( typeof Howler . ctx . createGain === 'undefined' ) ? Howler . ctx . createGainNode ( ) : Howler . ctx . createGain ( ) ;
25512555 Howler . masterGain . gain . setValueAtTime ( Howler . _muted ? 0 : Howler . _volume , Howler . ctx . currentTime ) ;
25522556 Howler . masterGain . connect ( Howler . ctx . destination ) ;
You can’t perform that action at this time.
0 commit comments