@digipair/skill-web-voice-activity-detection 0.58.9 → 0.58.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs.js CHANGED
@@ -15,10 +15,16 @@ function _extends() {
15
15
  return _extends.apply(this, arguments);
16
16
  }
17
17
 
18
- // import 'https://cdn.jsdelivr.net/npm/onnxruntime-web/dist/ort.js';
19
- // import 'https://cdn.jsdelivr.net/npm/@ricky0123/vad-web@0.0.22/dist/bundle.min.js';
20
- // import { MicVAD, utils } from '@ricky0123/vad-web';
21
- const { MicVAD, utils } = window['vad'];
18
+ // add a script tag to the document
19
+ async function addScript(src) {
20
+ const script = document.createElement('script');
21
+ script.src = src;
22
+ script.async = false;
23
+ document.body.appendChild(script);
24
+ return new Promise((resolve)=>{
25
+ script.onload = resolve;
26
+ });
27
+ }
22
28
  let VADService = class VADService {
23
29
  async listen(params, _pinsSettingsList, context) {
24
30
  const { stream = await navigator.mediaDevices.getUserMedia({
@@ -29,6 +35,13 @@ let VADService = class VADService {
29
35
  noiseSuppression: true
30
36
  }
31
37
  }), onFrameProcessed = [], onVADMisfire = [], onSpeechStart = [], onSpeechEnd = [], model = 'legacy', additionalAudioConstraints = {}, baseAssetPath = 'https://cdn.jsdelivr.net/npm/@ricky0123/vad-web@0.0.22/dist/', onnxWASMBasePath = 'https://cdn.jsdelivr.net/npm/onnxruntime-web@1.18.0/dist/', submitUserSpeechOnPause = false, positiveSpeechThreshold = 0.5, negativeSpeechThreshold = 0.35, preSpeechPadFrames = 1, redemptionFrames = 8, frameSamples = 1536, minSpeechFrames = 3 } = params;
38
+ if (!document.querySelector(`script[src="${onnxWASMBasePath}ort.js"]`)) {
39
+ await addScript(`${onnxWASMBasePath}ort.js`);
40
+ }
41
+ if (!document.querySelector(`script[src="${baseAssetPath}bundle.min.js"]`)) {
42
+ await addScript(`${baseAssetPath}bundle.min.js`);
43
+ }
44
+ const { MicVAD, utils } = window['vad'];
32
45
  const vad = await MicVAD.new({
33
46
  stream,
34
47
  onFrameProcessed: (probabilities, frame)=>{
package/index.esm.js CHANGED
@@ -23899,14 +23899,14 @@ function indent(str, spaces) {
23899
23899
  var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
23900
23900
  // match is required
23901
23901
  if (!match) {
23902
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, {
23902
+ return tokens = tokens1, nextMatch = nextMatch1, i = i1, {
23903
23903
  v: nextMatch1
23904
23904
  };
23905
23905
  }
23906
23906
  var token = match.token, offset = match.offset;
23907
23907
  i1 += offset;
23908
23908
  if (token === " ") {
23909
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
23909
+ return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
23910
23910
  }
23911
23911
  tokens1 = _to_consumable_array$1(tokens1).concat([
23912
23912
  token
@@ -23925,7 +23925,7 @@ function indent(str, spaces) {
23925
23925
  if (contextKeys.some(function(el) {
23926
23926
  return el.startsWith(name);
23927
23927
  })) {
23928
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
23928
+ return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
23929
23929
  }
23930
23930
  if (dateTimeIdentifiers.some(function(el) {
23931
23931
  return el === name;
@@ -23944,9 +23944,9 @@ function indent(str, spaces) {
23944
23944
  if (dateTimeIdentifiers.some(function(el) {
23945
23945
  return el.startsWith(name);
23946
23946
  })) {
23947
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
23947
+ return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
23948
23948
  }
23949
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, {
23949
+ return tokens = tokens1, nextMatch = nextMatch1, i = i1, {
23950
23950
  v: nextMatch1
23951
23951
  };
23952
23952
  };
@@ -27953,10 +27953,16 @@ const preparePinsSettings = async (settings, context)=>{
27953
27953
  });
27954
27954
  };
27955
27955
 
27956
- // import 'https://cdn.jsdelivr.net/npm/onnxruntime-web/dist/ort.js';
27957
- // import 'https://cdn.jsdelivr.net/npm/@ricky0123/vad-web@0.0.22/dist/bundle.min.js';
27958
- // import { MicVAD, utils } from '@ricky0123/vad-web';
27959
- const { MicVAD, utils } = window['vad'];
27956
+ // add a script tag to the document
27957
+ async function addScript(src) {
27958
+ const script = document.createElement('script');
27959
+ script.src = src;
27960
+ script.async = false;
27961
+ document.body.appendChild(script);
27962
+ return new Promise((resolve)=>{
27963
+ script.onload = resolve;
27964
+ });
27965
+ }
27960
27966
  let VADService = class VADService {
27961
27967
  async listen(params, _pinsSettingsList, context) {
27962
27968
  const { stream = await navigator.mediaDevices.getUserMedia({
@@ -27967,6 +27973,13 @@ let VADService = class VADService {
27967
27973
  noiseSuppression: true
27968
27974
  }
27969
27975
  }), onFrameProcessed = [], onVADMisfire = [], onSpeechStart = [], onSpeechEnd = [], model = 'legacy', additionalAudioConstraints = {}, baseAssetPath = 'https://cdn.jsdelivr.net/npm/@ricky0123/vad-web@0.0.22/dist/', onnxWASMBasePath = 'https://cdn.jsdelivr.net/npm/onnxruntime-web@1.18.0/dist/', submitUserSpeechOnPause = false, positiveSpeechThreshold = 0.5, negativeSpeechThreshold = 0.35, preSpeechPadFrames = 1, redemptionFrames = 8, frameSamples = 1536, minSpeechFrames = 3 } = params;
27976
+ if (!document.querySelector(`script[src="${onnxWASMBasePath}ort.js"]`)) {
27977
+ await addScript(`${onnxWASMBasePath}ort.js`);
27978
+ }
27979
+ if (!document.querySelector(`script[src="${baseAssetPath}bundle.min.js"]`)) {
27980
+ await addScript(`${baseAssetPath}bundle.min.js`);
27981
+ }
27982
+ const { MicVAD, utils } = window['vad'];
27970
27983
  const vad = await MicVAD.new({
27971
27984
  stream,
27972
27985
  onFrameProcessed: (probabilities, frame)=>{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-web-voice-activity-detection",
3
- "version": "0.58.9",
3
+ "version": "0.58.11",
4
4
  "dependencies": {},
5
5
  "main": "./index.cjs.js",
6
6
  "module": "./index.esm.js"