@@ -734,7 +734,14 @@ EasySpeech.speak = ({ text, voice, pitch, rate, volume, force, infiniteResume, .
734734 utterance . pitch = getValue ( { pitch } ) ;
735735 utterance . rate = getValue ( { rate } ) ;
736736 utterance . volume = getValue ( { volume } ) ;
737- debugUtterance ( utterance ) ;
737+
738+ const isMsNatural =
739+ utterance . voice &&
740+ utterance . voice . name &&
741+ utterance . voice . name
742+ . toLocaleLowerCase ( )
743+ . includes ( '(natural)' ) ;
744+ debugUtterance ( utterance , { isMsNatural } ) ;
738745
739746 utteranceEvents . forEach ( name => {
740747 const fn = handlers [ name ] ;
@@ -769,9 +776,15 @@ EasySpeech.speak = ({ text, voice, pitch, rate, volume, force, infiniteResume, .
769776 patches . paused = false ;
770777 patches . speaking = true ;
771778
779+ const defaultResumeInfinity = (
780+ ! isMsNatural &&
781+ ! patches . isFirefox &&
782+ ! patches . isSafari &&
783+ patches . isAndroid !== true
784+ ) ;
772785 const useResumeInfinity = typeof infiniteResume === 'boolean'
773786 ? infiniteResume
774- : ! patches . isFirefox && ! patches . isSafari && patches . isAndroid !== true ;
787+ : defaultResumeInfinity ;
775788
776789 if ( useResumeInfinity ) {
777790 resumeInfinity ( utterance ) ;
@@ -798,15 +811,13 @@ EasySpeech.speak = ({ text, voice, pitch, rate, volume, force, infiniteResume, .
798811 clearTimeout ( timeoutResumeInfinity ) ;
799812 internal . speechSynthesis . cancel ( ) ;
800813
801- setTimeout ( ( ) => {
802- internal . speechSynthesis . speak ( utterance ) ;
803- } , 10 ) ;
814+ setTimeout ( ( ) => internal . speechSynthesis . speak ( utterance ) , 10 ) ;
804815 } )
805816} ;
806817
807818/** @private **/
808- const debugUtterance = ( { voice, pitch, rate, volume } ) => {
809- debug ( `utterance: voice=${ voice ?. name } volume=${ volume } rate=${ rate } pitch=${ pitch } ` ) ;
819+ const debugUtterance = ( { voice, pitch, rate, volume } , { isMsNatural = false } = { } ) => {
820+ debug ( `utterance: voice=${ voice ?. name } volume=${ volume } rate=${ rate } pitch=${ pitch } isMsNatural= ${ isMsNatural } ` ) ;
810821} ;
811822
812823/**
0 commit comments