Comparing version 1.1.6 to 1.2.0
@@ -19,3 +19,6 @@ (function(e){if("function"==typeof bootstrap)bootstrap("hark",e);else if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeHark=e}else"undefined"!=typeof window?window.hark=e():global.hark=e()})(function(){var define,ses,bootstrap,module,exports; | ||
var audioContextType = window.AudioContext || window.webkitAudioContext; | ||
var audioContextType; | ||
if (typeof window !== 'undefined') { | ||
audioContextType = window.AudioContext || window.webkitAudioContext; | ||
} | ||
// use a single audio context due to hardware limits | ||
@@ -48,3 +51,3 @@ var audioContext = null; | ||
analyser.smoothingTimeConstant = smoothing; | ||
fftBins = new Float32Array(analyser.fftSize); | ||
fftBins = new Float32Array(analyser.frequencyBinCount); | ||
@@ -68,2 +71,15 @@ if (stream.jquery) stream = stream[0]; | ||
harker.suspend = function() { | ||
audioContext.suspend(); | ||
} | ||
harker.resume = function() { | ||
audioContext.resume(); | ||
} | ||
Object.defineProperty(harker, 'state', { get: function() { | ||
return audioContext.state; | ||
}}); | ||
audioContext.onstatechange = function() { | ||
harker.emit('state_change', audioContext.state); | ||
} | ||
harker.setThreshold = function(t) { | ||
@@ -70,0 +86,0 @@ threshold = t; |
13
hark.js
@@ -67,2 +67,15 @@ var WildEmitter = require('wildemitter'); | ||
harker.suspend = function() { | ||
audioContext.suspend(); | ||
} | ||
harker.resume = function() { | ||
audioContext.resume(); | ||
} | ||
Object.defineProperty(harker, 'state', { get: function() { | ||
return audioContext.state; | ||
}}); | ||
audioContext.onstatechange = function() { | ||
harker.emit('state_change', audioContext.state); | ||
} | ||
harker.setThreshold = function(t) { | ||
@@ -69,0 +82,0 @@ threshold = t; |
{ | ||
"name": "hark", | ||
"version": "1.1.6", | ||
"version": "1.2.0", | ||
"description": "Converts an audio stream to speech events in the browser", | ||
@@ -5,0 +5,0 @@ "main": "hark.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17955
385