File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change 482
482
483
483
self . _suspendTimer = null ;
484
484
self . state = 'suspending' ;
485
- self . ctx . suspend ( ) . then ( function ( ) {
485
+
486
+ var handleSuspension = function ( ) {
486
487
self . state = 'suspended' ;
487
488
488
489
if ( self . _resumeAfterSuspend ) {
489
490
delete self . _resumeAfterSuspend ;
490
491
self . _autoResume ( ) ;
491
492
}
492
- } ) ;
493
+ } ;
494
+
495
+ // Either suspension is resolved or rejected (i.e. in case of interrupted state of audio context)
496
+ // the Howler's 'suspending' state needs to be updated.
497
+ self . ctx . suspend ( ) . then ( handleSuspension , handleSuspension ) ;
493
498
} , 30000 ) ;
494
499
495
500
return self ;
506
511
return ;
507
512
}
508
513
509
- if ( self . state === 'running' && self . _suspendTimer ) {
514
+ if ( self . state === 'running' && self . ctx . state !== 'interrupted' && self . _suspendTimer ) {
510
515
clearTimeout ( self . _suspendTimer ) ;
511
516
self . _suspendTimer = null ;
512
- } else if ( self . state === 'suspended' ) {
517
+ } else if ( self . state === 'suspended' || self . state === 'running' && self . ctx . state === 'interrupted' ) {
513
518
self . ctx . resume ( ) . then ( function ( ) {
514
519
self . state = 'running' ;
515
520
868
873
}
869
874
} ;
870
875
871
- if ( Howler . state === 'running' ) {
876
+ if ( Howler . state === 'running' && Howler . ctx . state !== 'interrupted' ) {
872
877
playWebAudio ( ) ;
873
878
} else {
874
879
self . _playLock = true ;
You can’t perform that action at this time.
0 commit comments