From d89cdb33ac81b36e1e2620a6b676f6df28696f02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Trob=C3=A4ck?= Date: Thu, 2 Jun 2022 10:16:39 +0200 Subject: [PATCH] docs: improve react documentation Adds a basic react example to the readme and shows the interface for the Player component. --- README.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ lib/Player.tsx | 1 - 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c82c1d3f..eac52085 100644 --- a/README.md +++ b/README.md @@ -155,6 +155,55 @@ where you specify the IP of the camera you want to proxy as the `MSP_CAMERA` environment variable (default is `192.168.0.90`). The vite dev server will proxy requests to the camera, so that you'll have no CORS issues for any format. +The player component can currently accept these properties. + +```ts +interface PlayerProps { + readonly hostname: string + readonly vapixParams?: VapixParameters + readonly initialFormat?: Format + readonly autoPlay?: boolean + readonly onSdp?: (msg: Sdp) => void + readonly metadataHandler?: MetadataHandler + /** + * Set to true if the camera requires a secure + * connection, "https" and "wss" protocols. + */ + readonly secure?: boolean + readonly className?: string + /** + * When playing a recording, the time the video started + * (used for labeling with an absolute time) formatted + * as an ISO time, e.g.: 2021-02-03T12:21:57.465715Z + */ + readonly startTime?: string + /** + * When playing a recording, the total duration of the video + * if known by the user (and not reported from backend) in + * seconds. + */ + readonly duration?: number + + /** + * Activate automatic retries on RTSP errors. + */ + readonly autoRetry?: boolean +} +``` + +React example + +```jsx + +``` + ## FAQ **Does this library support audio?** diff --git a/lib/Player.tsx b/lib/Player.tsx index 01cd2410..324345ea 100644 --- a/lib/Player.tsx +++ b/lib/Player.tsx @@ -40,7 +40,6 @@ interface PlayerProps { * connection, "https" and "wss" protocols. */ readonly secure?: boolean - readonly aspectRatio?: number readonly className?: string /** * When playing a recording, the time the video started