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 580580 init : function ( o ) {
581581 var self = this ;
582582
583- // If we don't have an AudioContext created yet, run the setup.
584- if ( ! Howler . ctx ) {
585- setupAudioContext ( ) ;
586- }
587-
588583 // Setup user-defined default properties.
589584 self . _autoplay = o . autoplay || false ;
590585 self . _format = ( typeof o . format !== 'string' ) ? o . format : [ o . format ] ;
603598 withCredentials : o . xhr && o . xhr . withCredentials ? o . xhr . withCredentials : false ,
604599 } ;
605600
601+ if ( ! self . _html5 ) {
602+ // If we're not forcing HTML5 and we don't have an AudioContext created yet, run the setup.
603+ if ( ! Howler . ctx ) {
604+ // sets Howler.usingWebAudio
605+ setupAudioContext ( ) ;
606+ }
607+ } else {
608+ Howler . usingWebAudio = false ;
609+ }
610+ self . _webAudio = Howler . usingWebAudio ;
611+
606612 // Setup all other default properties.
607613 self . _duration = 0 ;
608614 self . _state = 'unloaded' ;
627633 self . _onunlock = o . onunlock ? [ { fn : o . onunlock } ] : [ ] ;
628634 self . _onresume = [ ] ;
629635
630- // Web Audio or HTML5 Audio?
631- self . _webAudio = Howler . usingWebAudio && ! self . _html5 ;
632-
633636 // Automatically try to enable audio.
634637 if ( typeof Howler . ctx !== 'undefined' && Howler . ctx && Howler . autoUnlock ) {
635638 Howler . _unlockAudio ( ) ;
25842587
25852588 // Create and expose the master GainNode when using Web Audio (useful for plugins or advanced usage).
25862589 if ( Howler . usingWebAudio ) {
2590+ // note: this part breaks iOS 13.3+ ControlCenter notification
25872591 Howler . masterGain = ( typeof Howler . ctx . createGain === 'undefined' ) ? Howler . ctx . createGainNode ( ) : Howler . ctx . createGain ( ) ;
25882592 Howler . masterGain . gain . setValueAtTime ( Howler . _muted ? 0 : Howler . _volume , Howler . ctx . currentTime ) ;
25892593 Howler . masterGain . connect ( Howler . ctx . destination ) ;
You can’t perform that action at this time.
0 commit comments