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 580
580
init : function ( o ) {
581
581
var self = this ;
582
582
583
- // If we don't have an AudioContext created yet, run the setup.
584
- if ( ! Howler . ctx ) {
585
- setupAudioContext ( ) ;
586
- }
587
-
588
583
// Setup user-defined default properties.
589
584
self . _autoplay = o . autoplay || false ;
590
585
self . _format = ( typeof o . format !== 'string' ) ? o . format : [ o . format ] ;
603
598
withCredentials : o . xhr && o . xhr . withCredentials ? o . xhr . withCredentials : false ,
604
599
} ;
605
600
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
+
606
612
// Setup all other default properties.
607
613
self . _duration = 0 ;
608
614
self . _state = 'unloaded' ;
627
633
self . _onunlock = o . onunlock ? [ { fn : o . onunlock } ] : [ ] ;
628
634
self . _onresume = [ ] ;
629
635
630
- // Web Audio or HTML5 Audio?
631
- self . _webAudio = Howler . usingWebAudio && ! self . _html5 ;
632
-
633
636
// Automatically try to enable audio.
634
637
if ( typeof Howler . ctx !== 'undefined' && Howler . ctx && Howler . autoUnlock ) {
635
638
Howler . _unlockAudio ( ) ;
2584
2587
2585
2588
// Create and expose the master GainNode when using Web Audio (useful for plugins or advanced usage).
2586
2589
if ( Howler . usingWebAudio ) {
2590
+ // note: this part breaks iOS 13.3+ ControlCenter notification
2587
2591
Howler . masterGain = ( typeof Howler . ctx . createGain === 'undefined' ) ? Howler . ctx . createGainNode ( ) : Howler . ctx . createGain ( ) ;
2588
2592
Howler . masterGain . gain . setValueAtTime ( Howler . _muted ? 0 : Howler . _volume , Howler . ctx . currentTime ) ;
2589
2593
Howler . masterGain . connect ( Howler . ctx . destination ) ;
You can’t perform that action at this time.
0 commit comments