| 1 | import type * as ivsrealtime from "@distilled.cloud/aws/ivs-realtime"; |
| 2 | import type * as Duration from "effect/Duration"; |
| 3 | import type * as Effect from "effect/Effect"; |
| 4 | import * as Binding from "../../Binding.ts"; |
| 5 | import type { Stage } from "./Stage.ts"; |
| 6 | |
| 7 | /** |
| 8 | * The `sourceStageArn` and `destinationStageArn` are injected by the binding |
| 9 | * from the bound stages, and the wire `reconnectWindowSeconds` is expressed |
| 10 | * as a `Duration.Input`. |
| 11 | */ |
| 12 | export interface StartParticipantReplicationRequest extends Omit< |
| 13 | ivsrealtime.StartParticipantReplicationRequest, |
| 14 | "sourceStageArn" | "destinationStageArn" | "reconnectWindowSeconds" |
| 15 | > { |
| 16 | /** |
| 17 | * If the participant disconnects and reconnects within this window, the |
| 18 | * replication continues seamlessly. Converted to whole seconds on the |
| 19 | * wire (`0` - `300` seconds). |
| 20 | * @default 0 |
| 21 | */ |
| 22 | reconnectWindow?: Duration.Input; |
| 23 | } |
| 24 | |
| 25 | /** |
| 26 | * Replicate a participant's media from the bound source stage into the |
| 27 | * bound destination stage — e.g. to bring a guest publisher into a second |
| 28 | * room without a re-publish. |
| 29 | * |
| 30 | * ### Replicating Participants |
| 31 | * **Example:** Replicate a publisher into another stage |
| 32 | * ```typescript |
| 33 | * // init — bound to (source, destination) |
| 34 | * const startParticipantReplication = |
| 35 | * yield* IVSRealtime.StartParticipantReplication(mainStage, overflowStage); |
| 36 | * |
| 37 | * // runtime |
| 38 | * yield* startParticipantReplication({ |
| 39 | * participantId: "abcDEF123", |
| 40 | * reconnectWindow: "30 seconds", |
| 41 | * }); |
| 42 | * ``` |
| 43 | * |
| 44 | * @binding |
| 45 | */ |
| 46 | export interface StartParticipantReplication extends Binding.Service< |
| 47 | StartParticipantReplication, |
| 48 | "AWS.IVSRealtime.StartParticipantReplication", |
| 49 | ( |
| 50 | sourceStage: Stage, |
| 51 | destinationStage: Stage, |
| 52 | ) => Effect.Effect< |
| 53 | ( |
| 54 | request: StartParticipantReplicationRequest, |
| 55 | ) => Effect.Effect< |
| 56 | ivsrealtime.StartParticipantReplicationResponse, |
| 57 | ivsrealtime.StartParticipantReplicationError |
| 58 | > |
| 59 | > |
| 60 | > {} |
| 61 | export const StartParticipantReplication = |
| 62 | Binding.Service<StartParticipantReplication>( |
| 63 | "AWS.IVSRealtime.StartParticipantReplication", |
| 64 | ); |