abcjs 6.0.0-beta.38 → 6.0.0-beta.39

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "abcjs",
3
- "version": "6.0.0-beta.38",
3
+ "version": "6.0.0-beta.39",
4
4
  "description": "Renderer for abc music notation",
5
5
  "main": "index.js",
6
6
  "types": "types/index.d.ts",
@@ -318,11 +318,25 @@ function CreateSynth() {
318
318
  self.debugCallback("totalSamples = " + totalSamples);
319
319
  self.debugCallback("creationTime = " + Math.floor((activeAudioContext().currentTime - startTime)*1000) + "ms");
320
320
  }
321
+ function resolveData(me) {
322
+ var duration = me && me.audioBuffers && me.audioBuffers.length > 0 ? me.audioBuffers[0].duration : 0;
323
+ return { status: activeAudioContext().state, duration: duration}
324
+ }
321
325
  Promise.all(allPromises).then(function() {
322
- resolve({
323
- status: "ok",
324
- seconds: 0
325
- });
326
+ // Safari iOS can mess with the audioContext state, so resume if needed.
327
+ if (activeAudioContext().state === "suspended") {
328
+ activeAudioContext().resume().then(function () {
329
+ resolve(resolveData(self));
330
+ })
331
+ } else if (activeAudioContext().state === "interrupted") {
332
+ activeAudioContext().suspend().then(function () {
333
+ activeAudioContext().resume().then(function () {
334
+ resolve(resolveData(self));
335
+ })
336
+ })
337
+ } else {
338
+ resolve(resolveData(self));
339
+ }
326
340
  });
327
341
  });
328
342
  };
package/temp.txt ADDED
File without changes
package/version.js CHANGED
@@ -1,3 +1,3 @@
1
- var version = '6.0.0-beta.38';
1
+ var version = '6.0.0-beta.39';
2
2
 
3
3
  module.exports = version;