New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

easy-speech

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

easy-speech - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

4

CHANGELOG.md

@@ -0,1 +1,5 @@

**1.1.1**
- fixed `resumeInfinity` timer on android browsers, because on Android
`speechSynthesis.pause()` has the same effect as `cancel`
**1.1.0**

@@ -2,0 +6,0 @@ - coverage only includes main file

@@ -137,3 +137,4 @@ /**

// not published to the outside
patches.skipInfinity = skipInfinity()
patches.isAndroid = isAndroid()
patches.isFirefox = isFirefox()

@@ -147,3 +148,3 @@ return features

/** @private **/
const skipInfinity = () => {
const isAndroid = () => {
const ua = (scope.navigator || {}).userAgent || ''

@@ -153,2 +154,5 @@ return /android/i.test(ua)

/** @private **/
const isFirefox = () => typeof scope.InstallTrigger !== 'undefined'
/**

@@ -402,2 +406,4 @@ * Common prefixes for browsers that tend to implement their custom names for

if (hasProperty(speechSynthesis, 'addEventListener')) {
status('init: voices (addEventListener)')
voicesChangedListener = () => {

@@ -654,4 +660,10 @@ if (voicesLoaded()) { return complete() }

// mobile (android), so we need to detect chrome desktop
//
// XXX: resumeInfinity breaks on firefox macOs so we need to avoid it there
// as well. Since we don't need it in FF anyway, we can safely skip there
utterance.addEventListener('start', () => {
if (patches.skipInfinity !== true) {
patches.paused = false
patches.speaking = true
if (!patches.isFirefox && patches.isAndroid !== true) {
resumeInfinity(utterance)

@@ -663,2 +675,4 @@ }

status('speak complete')
patches.paused = false
patches.speaking = false
clearTimeout(timeoutResumeInfinity)

@@ -670,2 +684,4 @@ resolve(endEvent)

status(`speak failed: ${errorEvent.message}`)
patches.paused = false
patches.speaking = false
clearTimeout(timeoutResumeInfinity)

@@ -708,4 +724,15 @@ reject(errorEvent)

internal.speechSynthesis.pause()
internal.speechSynthesis.resume()
// only execute on speaking utterances, otherwise paused
// utterances will get resumed, thus breaking user experience
// include internal patching, since some systems have problems with
// pause/resume and updateing the internal state on speechSynthesis
const { paused, speaking } = internal.speechSynthesis
const isSpeaking = speaking || patches.speaking
const isPaused = paused || patches.paused
debug(`resumeInfinity isSpeaking=${isSpeaking} isPaused=${isPaused}`)
if (isSpeaking && !isPaused) {
internal.speechSynthesis.pause()
internal.speechSynthesis.resume()
}
timeoutResumeInfinity = scope.setTimeout(function () {

@@ -723,2 +750,4 @@ resumeInfinity(target)

internal.speechSynthesis.cancel()
patches.paused = false
patches.speaking = false
}

@@ -732,2 +761,5 @@

status('resuming')
patches.paused = false
patches.speaking = true
internal.speechSynthesis.resume()

@@ -742,3 +774,15 @@ }

status('pausing')
// exec pause on Android causes speech to end but not to fire end-event
// se we simply do it manually instead of pausing
if (patches.isAndroid) {
debug('patch pause on Android with cancel')
return internal.speechSynthesis.cancel()
}
internal.speechSynthesis.pause()
// in some cases, pause does not update the internal state,
// so we need to update it manually using an own state
patches.paused = true
patches.speaking = false
}

@@ -745,0 +789,0 @@

2

package.json
{
"name": "easy-speech",
"version": "1.1.1",
"version": "1.1.2",
"description": "Cross browser Speech Synthesis",

@@ -5,0 +5,0 @@ "type": "module",

@@ -148,2 +148,7 @@ # Easy Speech

- https://stackoverflow.com/questions/21947730/chrome-speech-synthesis-with-longer-texts
- https://stackoverflow.com/a/34130734
- https://stackoverflow.com/a/68060634
- https://stackoverflow.com/a/48056986
- https://bugs.chromium.org/p/chromium/issues/detail?id=582455
- https://stackoverflow.com/a/65883556

@@ -150,0 +155,0 @@ ## License

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc