@driftengine/audio 4.8.1 → 4.8.2

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/dist/graph.d.ts CHANGED
@@ -386,6 +386,11 @@ export declare class AudioGraph {
386
386
  *
387
387
  * The same tap every time. Building one per recording left the last one
388
388
  * connected and running.
389
+ *
390
+ * **Null while the context is not running**, `audible` false. A suspended context's
391
+ * stream is a live track that never carries a sample, and a recorder given one stalls
392
+ * on it: a recording started before the page's first gesture kept 19 frames of 120 and
393
+ * no sound. Asked again once the context runs, it answers the tap.
389
394
  */
390
395
  captureStream(): MediaStream | null;
391
396
  /**
package/dist/graph.js CHANGED
@@ -539,15 +539,22 @@ export class AudioGraph {
539
539
  *
540
540
  * The same tap every time. Building one per recording left the last one
541
541
  * connected and running.
542
+ *
543
+ * **Null while the context is not running**, `audible` false. A suspended context's
544
+ * stream is a live track that never carries a sample, and a recorder given one stalls
545
+ * on it: a recording started before the page's first gesture kept 19 frames of 120 and
546
+ * no sound. Asked again once the context runs, it answers the tap.
542
547
  */
543
548
  captureStream() {
549
+ // Only a live context can hand out a stream; an offline render has no listener
550
+ // to stream to and produces its buffer instead.
551
+ const live = this.live();
552
+ if (live === null || live.state !== 'running')
553
+ return null;
544
554
  if (this.tap !== null)
545
555
  return this.tap.stream;
546
556
  try {
547
- // Only a live context can hand out a stream; an offline render has no listener
548
- // to stream to and produces its buffer instead.
549
- const live = this.live();
550
- if (live === null || typeof live.createMediaStreamDestination !== 'function')
557
+ if (typeof live.createMediaStreamDestination !== 'function')
551
558
  return null;
552
559
  const tap = live.createMediaStreamDestination();
553
560
  this.mix.out.connect(tap);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@driftengine/audio",
3
- "version": "4.8.1",
3
+ "version": "4.8.2",
4
4
  "description": "Layered stems, synthesis, rhythm analysis and positional placement",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
package/src/graph.ts CHANGED
@@ -673,14 +673,20 @@ export class AudioGraph {
673
673
  *
674
674
  * The same tap every time. Building one per recording left the last one
675
675
  * connected and running.
676
+ *
677
+ * **Null while the context is not running**, `audible` false. A suspended context's
678
+ * stream is a live track that never carries a sample, and a recorder given one stalls
679
+ * on it: a recording started before the page's first gesture kept 19 frames of 120 and
680
+ * no sound. Asked again once the context runs, it answers the tap.
676
681
  */
677
682
  captureStream(): MediaStream | null {
683
+ // Only a live context can hand out a stream; an offline render has no listener
684
+ // to stream to and produces its buffer instead.
685
+ const live = this.live();
686
+ if (live === null || live.state !== 'running') return null;
678
687
  if (this.tap !== null) return this.tap.stream;
679
688
  try {
680
- // Only a live context can hand out a stream; an offline render has no listener
681
- // to stream to and produces its buffer instead.
682
- const live = this.live();
683
- if (live === null || typeof live.createMediaStreamDestination !== 'function') return null;
689
+ if (typeof live.createMediaStreamDestination !== 'function') return null;
684
690
  const tap = live.createMediaStreamDestination();
685
691
  this.mix.out.connect(tap);
686
692
  this.tap = tap;