@vestra-player/sdk - v1.11.3
    Preparing search index...

    Interface Stream

    A generated source, from Player.openStream. Disposing it stops it.

    A source whose frames this plugin generates, from Player.openStream. The SDK pulls frames on the audio clock over a local connection and handles prefill, activation and pausing; the plugin only supplies frame(). A stream ends when the plugin stops it, when another source replaces it or the user closes it (onStop with null), or when it fails (onStop with the error).

    A menu item ends the plugin's generated stream and closes it as the player's source. stop closes the source first and then the frame connection, so the user never sees a playback error; onStop is not called for the plugin's own stop.

    // Enabled while the stream produces frames.
    plugin.commands.add({
    id: "stop-generator",
    path: ["@playback", "Stop generator"],
    enabled: () => stream.running,
    run: () => stream.stop(),
    });

    1.0.0

    interface Stream {
        dispose(): Promise<void>;
        running: boolean;
        onStop(listener: (error: PluginError | null) => void): Disposable;
        stop(): Promise<void>;
    }

    Hierarchy (View Summary)

    Index
    • Release the resource. Resolves once the player confirmed the release (or immediately for purely local resources). Never rejects.

      Returns Promise<void>

      Never.

      A "Turn feature off" item removes the feature's own menu item at once, before the plugin stops. dispose takes the command out of the menu and the binding table and resolves once the player confirmed it; the id can be added again later.

      const extra = plugin.commands.add({ id: "extra", path: ["Tools", "Extra"], run() {} });
      plugin.commands.add({
      id: "extra-off",
      path: ["Tools", "Turn extra off"],
      run: () => extra.dispose(), // never rejects
      });

      1.0.0

    • The stream stopped for a reason outside this plugin: error is null when another source replaced it or the user closed it, otherwise the failure (stream with the player's text, invalid for a bad frame, …). Not called when the plugin itself stops it (stop(), dispose(), deactivation): the promise of stop() is that notification.

      The player retires a stream's producer as soon as it is replaced or closed; the SDK reads the player's state to tell that from a failure (before 1.5.7 a replaced or closed stream could get unavailable "producer absent"). Without plugin.player.read() a failure the SDK has not seen yet is reported as null.

      Parameters

      Returns Disposable

      The OSD explains a failure, and nothing is said when the user simply opened another file. The listener runs only for stops from outside the plugin: null for a replacement or the user's close, an error (such as stream with the player's text) for a failure.

      stream.onStop((error) => {
      if (error) void plugin.osd.show("Generator stopped: {}", [error.message]);
      });

      1.0.0

    • Stop producing and close the stream if it is still the player's source. The source closes first, then the frame connection, then the producer, so stopping never shows as a playback failure. dispose() and deactivation do the same.

      Returns Promise<void>

      Whatever code closing the player's source failed with (the frame connection and the producer are released either way). A stream that is no longer the source just resolves.

      Closing the generator window stops the stream it feeds. stop closes the player's source if it is still this stream and then the frame connection; it resolves once both are closed.

      generatorWindow.onClose(() => stream.stop());
      

      1.0.0

    running: boolean

    The stream is producing frames.