Skip to content

GetStream

Source: src/AWS/IVS/GetStream.ts

Runtime binding for ivs:GetStream.

Reads the bound Channel’s active (live) stream — state, health, viewer count, and playback URL. Fails with the typed ChannelNotBroadcasting tag when the channel is not live. The channel ARN is injected from the binding. Provide the implementation with Effect.provide(AWS.IVS.GetStreamHttp).

// init — bind the operation to the channel
const getStream = yield* AWS.IVS.GetStream(channel);
// runtime
const live = yield* getStream().pipe(
Effect.map(({ stream }) => ({ live: true, viewers: stream?.viewerCount })),
Effect.catchTag("ChannelNotBroadcasting", () =>
Effect.succeed({ live: false, viewers: 0 }),
),
);