| 1 | import type * as ivs from "@distilled.cloud/aws/ivs"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Channel } from "./Channel.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for `ivs:StopStream`. |
| 8 | * |
| 9 | * Disconnects the incoming RTMPS broadcast on the bound {@link Channel}. |
| 10 | * Fails with the typed `ChannelNotBroadcasting` tag when the channel is |
| 11 | * not live. Many broadcast clients auto-reconnect, so to stop a stream |
| 12 | * permanently, first delete or rotate the channel's stream key. The |
| 13 | * channel ARN is injected from the binding. Provide the implementation |
| 14 | * with `Effect.provide(AWS.IVS.StopStreamHttp)`. |
| 15 | * ### Controlling Live Streams |
| 16 | * **Example:** Kick the Current Broadcast |
| 17 | * ```typescript |
| 18 | * // init — bind the operation to the channel |
| 19 | * const stopStream = yield* AWS.IVS.StopStream(channel); |
| 20 | * |
| 21 | * // runtime |
| 22 | * yield* stopStream().pipe( |
| 23 | * Effect.catchTag("ChannelNotBroadcasting", () => Effect.void), |
| 24 | * ); |
| 25 | * ``` |
| 26 | * |
| 27 | * @binding |
| 28 | */ |
| 29 | export interface StopStream extends Binding.Service< |
| 30 | StopStream, |
| 31 | "AWS.IVS.StopStream", |
| 32 | ( |
| 33 | channel: Channel, |
| 34 | ) => Effect.Effect< |
| 35 | () => Effect.Effect<ivs.StopStreamResponse, ivs.StopStreamError> |
| 36 | > |
| 37 | > {} |
| 38 | export const StopStream = Binding.Service<StopStream>("AWS.IVS.StopStream"); |