diff --git a/packages/p2p-media-loader-demo/src/components/P2PVideoDemo.tsx b/packages/p2p-media-loader-demo/src/components/P2PVideoDemo.tsx index 98c97d47..064f3167 100644 --- a/packages/p2p-media-loader-demo/src/components/P2PVideoDemo.tsx +++ b/packages/p2p-media-loader-demo/src/components/P2PVideoDemo.tsx @@ -123,6 +123,7 @@ export const P2PVideoDemo = ({ { diff --git a/packages/p2p-media-loader-demo/src/components/players/hlsjs/HlsjsClapprPlayer.tsx b/packages/p2p-media-loader-demo/src/components/players/hlsjs/HlsjsClapprPlayer.tsx index 7ada97d9..642b820b 100644 --- a/packages/p2p-media-loader-demo/src/components/players/hlsjs/HlsjsClapprPlayer.tsx +++ b/packages/p2p-media-loader-demo/src/components/players/hlsjs/HlsjsClapprPlayer.tsx @@ -14,6 +14,7 @@ const SCRIPTS = [ export const HlsjsClapprPlayer = ({ streamUrl, announceTrackers, + swarmId, onPeerConnect, onPeerClose, onChunkDownloaded, @@ -35,6 +36,7 @@ export const HlsjsClapprPlayer = ({ const engine = new HlsJsP2PEngine({ core: { announceTrackers, + swarmId, }, }); @@ -79,6 +81,7 @@ export const HlsjsClapprPlayer = ({ onPeerConnect, onPeerClose, streamUrl, + swarmId, ]); return isHlsSupported ? ( diff --git a/packages/p2p-media-loader-demo/src/components/players/hlsjs/HlsjsDPLayer.tsx b/packages/p2p-media-loader-demo/src/components/players/hlsjs/HlsjsDPLayer.tsx index eb91c212..f4be5f02 100644 --- a/packages/p2p-media-loader-demo/src/components/players/hlsjs/HlsjsDPLayer.tsx +++ b/packages/p2p-media-loader-demo/src/components/players/hlsjs/HlsjsDPLayer.tsx @@ -8,6 +8,7 @@ import Hls from "hls.js"; export const HlsjsDPlayer = ({ streamUrl, announceTrackers, + swarmId, onPeerConnect, onPeerClose, onChunkDownloaded, @@ -29,6 +30,7 @@ export const HlsjsDPlayer = ({ p2p: { core: { announceTrackers, + swarmId, }, onHlsJsCreated(hls) { subscribeToUiEvents({ @@ -70,6 +72,7 @@ export const HlsjsDPlayer = ({ onPeerClose, onChunkDownloaded, onChunkUploaded, + swarmId, ]); return isHlsSupported ? ( diff --git a/packages/p2p-media-loader-demo/src/components/players/hlsjs/HlsjsMediaElement.tsx b/packages/p2p-media-loader-demo/src/components/players/hlsjs/HlsjsMediaElement.tsx index 3f9be296..abd0ed6f 100644 --- a/packages/p2p-media-loader-demo/src/components/players/hlsjs/HlsjsMediaElement.tsx +++ b/packages/p2p-media-loader-demo/src/components/players/hlsjs/HlsjsMediaElement.tsx @@ -9,6 +9,7 @@ import { PlayerProps } from "../../../types"; export const HlsjsMediaElement = ({ streamUrl, announceTrackers, + swarmId, onPeerConnect, onPeerClose, onChunkDownloaded, @@ -49,6 +50,7 @@ export const HlsjsMediaElement = ({ }, core: { announceTrackers, + swarmId, }, }, }, @@ -70,6 +72,7 @@ export const HlsjsMediaElement = ({ onPeerConnect, onPeerClose, streamUrl, + swarmId, ]); return isHlsSupported ? ( diff --git a/packages/p2p-media-loader-demo/src/components/players/hlsjs/HlsjsOpenPlayer.tsx b/packages/p2p-media-loader-demo/src/components/players/hlsjs/HlsjsOpenPlayer.tsx index 48fc5bf5..b56b8e8e 100644 --- a/packages/p2p-media-loader-demo/src/components/players/hlsjs/HlsjsOpenPlayer.tsx +++ b/packages/p2p-media-loader-demo/src/components/players/hlsjs/HlsjsOpenPlayer.tsx @@ -9,6 +9,7 @@ import { createVideoElements, subscribeToUiEvents } from "../utils"; export const HlsjsOpenPlayer = ({ streamUrl, announceTrackers, + swarmId, onPeerConnect, onPeerClose, onChunkDownloaded, @@ -58,7 +59,8 @@ export const HlsjsOpenPlayer = ({ }); }, core: { - trackers: announceTrackers, + announceTrackers, + swarmId, }, }, }, @@ -103,6 +105,7 @@ export const HlsjsOpenPlayer = ({ onPeerConnect, onPeerClose, streamUrl, + swarmId, ]); return isHlsSupported ? ( diff --git a/packages/p2p-media-loader-demo/src/components/players/hlsjs/HlsjsPlyr.tsx b/packages/p2p-media-loader-demo/src/components/players/hlsjs/HlsjsPlyr.tsx index ce6369fa..95b4b558 100644 --- a/packages/p2p-media-loader-demo/src/components/players/hlsjs/HlsjsPlyr.tsx +++ b/packages/p2p-media-loader-demo/src/components/players/hlsjs/HlsjsPlyr.tsx @@ -9,6 +9,7 @@ import { createVideoElements, subscribeToUiEvents } from "../utils"; export const HlsjsPlyr = ({ streamUrl, announceTrackers, + swarmId, onPeerConnect, onPeerClose, onChunkDownloaded, @@ -37,6 +38,7 @@ export const HlsjsPlyr = ({ p2p: { core: { announceTrackers, + swarmId, }, onHlsJsCreated(hls) { subscribeToUiEvents({ @@ -88,6 +90,7 @@ export const HlsjsPlyr = ({ onPeerConnect, onPeerClose, streamUrl, + swarmId, ]); return isHlsSupported ? ( diff --git a/packages/p2p-media-loader-demo/src/components/players/hlsjs/HlsjsVidstack.tsx b/packages/p2p-media-loader-demo/src/components/players/hlsjs/HlsjsVidstack.tsx index cc065b5e..4c19b9aa 100644 --- a/packages/p2p-media-loader-demo/src/components/players/hlsjs/HlsjsVidstack.tsx +++ b/packages/p2p-media-loader-demo/src/components/players/hlsjs/HlsjsVidstack.tsx @@ -19,6 +19,7 @@ import Hls from "hls.js"; export const HlsjsVidstack = ({ streamUrl, announceTrackers, + swarmId, onPeerConnect, onPeerClose, onChunkDownloaded, @@ -35,6 +36,7 @@ export const HlsjsVidstack = ({ p2p: { core: { announceTrackers, + swarmId, }, onHlsJsCreated: (hls) => { subscribeToUiEvents({ @@ -57,6 +59,7 @@ export const HlsjsVidstack = ({ onChunkUploaded, onPeerConnect, onPeerClose, + swarmId, ], ); diff --git a/packages/p2p-media-loader-demo/src/components/players/shaka/Shaka.tsx b/packages/p2p-media-loader-demo/src/components/players/shaka/Shaka.tsx index ecadd508..90f05ba4 100644 --- a/packages/p2p-media-loader-demo/src/components/players/shaka/Shaka.tsx +++ b/packages/p2p-media-loader-demo/src/components/players/shaka/Shaka.tsx @@ -8,6 +8,7 @@ import { createVideoElements, subscribeToUiEvents } from "../utils"; export const Shaka = ({ streamUrl, announceTrackers, + swarmId, onPeerConnect, onPeerClose, onChunkDownloaded, @@ -61,6 +62,7 @@ export const Shaka = ({ { core: { announceTrackers, + swarmId, }, }, shaka, @@ -109,6 +111,7 @@ export const Shaka = ({ onPeerConnect, onPeerClose, streamUrl, + swarmId, ]); return isShakaSupported ? ( diff --git a/packages/p2p-media-loader-demo/src/components/players/shaka/ShakaClappr.tsx b/packages/p2p-media-loader-demo/src/components/players/shaka/ShakaClappr.tsx index af8248b7..d04f33cc 100644 --- a/packages/p2p-media-loader-demo/src/components/players/shaka/ShakaClappr.tsx +++ b/packages/p2p-media-loader-demo/src/components/players/shaka/ShakaClappr.tsx @@ -15,6 +15,7 @@ const SCRIPTS = [ export const ShakaClappr = ({ streamUrl, announceTrackers, + swarmId, onPeerConnect, onPeerClose, onChunkDownloaded, @@ -61,6 +62,7 @@ export const ShakaClappr = ({ const shakaP2PEngine = new ShakaP2PEngine({ core: { announceTrackers, + swarmId, }, }); @@ -103,6 +105,7 @@ export const ShakaClappr = ({ onPeerConnect, onPeerClose, streamUrl, + swarmId, ]); return isShakaSupported ? ( diff --git a/packages/p2p-media-loader-demo/src/components/players/shaka/ShakaDPlayer.tsx b/packages/p2p-media-loader-demo/src/components/players/shaka/ShakaDPlayer.tsx index 780c3c23..7a34d9fe 100644 --- a/packages/p2p-media-loader-demo/src/components/players/shaka/ShakaDPlayer.tsx +++ b/packages/p2p-media-loader-demo/src/components/players/shaka/ShakaDPlayer.tsx @@ -8,6 +8,7 @@ import shaka from "./shaka-import"; export const ShakaDPlayer = ({ streamUrl, announceTrackers, + swarmId, onPeerConnect, onPeerClose, onChunkDownloaded, @@ -32,6 +33,7 @@ export const ShakaDPlayer = ({ { core: { announceTrackers, + swarmId, }, }, shaka, @@ -73,6 +75,7 @@ export const ShakaDPlayer = ({ onPeerConnect, onPeerClose, streamUrl, + swarmId, ]); return isShakaSupported ? ( diff --git a/packages/p2p-media-loader-demo/src/components/players/shaka/ShakaPlyr.tsx b/packages/p2p-media-loader-demo/src/components/players/shaka/ShakaPlyr.tsx index 52c63334..04ef9624 100644 --- a/packages/p2p-media-loader-demo/src/components/players/shaka/ShakaPlyr.tsx +++ b/packages/p2p-media-loader-demo/src/components/players/shaka/ShakaPlyr.tsx @@ -9,6 +9,7 @@ import { createVideoElements, subscribeToUiEvents } from "../utils"; export const ShakaPlyr = ({ streamUrl, announceTrackers, + swarmId, onPeerConnect, onPeerClose, onChunkDownloaded, @@ -52,6 +53,7 @@ export const ShakaPlyr = ({ { core: { announceTrackers, + swarmId, }, }, shaka, @@ -127,6 +129,7 @@ export const ShakaPlyr = ({ onPeerConnect, onPeerClose, streamUrl, + swarmId, ]); return isShakaSupported ? ( diff --git a/packages/p2p-media-loader-demo/src/hooks/useQueryParams.ts b/packages/p2p-media-loader-demo/src/hooks/useQueryParams.ts index bb18c58d..e6d11573 100644 --- a/packages/p2p-media-loader-demo/src/hooks/useQueryParams.ts +++ b/packages/p2p-media-loader-demo/src/hooks/useQueryParams.ts @@ -8,6 +8,7 @@ const defaultParams: QueryParamsType = { streamUrl: DEFAULT_STREAM, trackers: DEFAULT_TRACKERS, debug: "", + swarmId: "", }; function getInitialParams(searchParams: URLSearchParams): QueryParamsType { diff --git a/packages/p2p-media-loader-demo/src/types.ts b/packages/p2p-media-loader-demo/src/types.ts index c4b16319..cac490e9 100644 --- a/packages/p2p-media-loader-demo/src/types.ts +++ b/packages/p2p-media-loader-demo/src/types.ts @@ -22,6 +22,7 @@ export type PlayerName = (typeof PLAYERS)[PlayerKey]; export type PlayerProps = { streamUrl: string; announceTrackers: string[]; + swarmId?: string; } & Partial< Pick< CoreEventMap, @@ -29,4 +30,7 @@ export type PlayerProps = { > >; -export type PlayerEvents = Omit; +export type PlayerEvents = Omit< + PlayerProps, + "streamUrl" | "announceTrackers" | "swarmId" +>;