Live video on the AT Protocol
1import React from "react";
2import { streamNotification } from "../components/stream-notification";
3import { TeleportNotification } from "../components/stream-notification/teleport-notification";
4
5export const StreamNotifications = {
6 teleport: (params: {
7 targetHandle: string;
8 targetDID: string;
9 countdown: number;
10 canCancel: boolean;
11 onDismiss?: (reason?: "user" | "auto") => void;
12 }) => {
13 streamNotification.show({
14 id: "teleport",
15 render: (isExiting, onDismiss, startTime) => {
16 return React.createElement(TeleportNotification, {
17 targetHandle: params.targetHandle,
18 countdown: params.countdown,
19 canCancel: params.canCancel,
20 startTime: startTime,
21 onDismiss: onDismiss,
22 });
23 },
24 duration: 0, // manually dismissed by countdown or user cancel
25 variant: "warning",
26 onDismiss: params.onDismiss,
27 });
28 },
29
30 teleportCancelled: () => {
31 streamNotification.hide("teleport");
32 },
33
34 teleportNow: (targetHandle: string) => {
35 streamNotification.show({
36 id: "teleport-now",
37 message: `Teleporting to @${targetHandle}...`,
38 duration: 2,
39 variant: "info",
40 });
41 },
42
43 activate: (message: string) => {
44 streamNotification.show({
45 id: "stream-activate",
46 message: message,
47 duration: 3,
48 variant: "info",
49 });
50 },
51};