@clockworkdog/cogs-client-react 1.4.3 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,10 +4,11 @@ export interface RtspVideoProps {
|
|
|
4
4
|
websocketHostname?: string;
|
|
5
5
|
websocketPort?: number;
|
|
6
6
|
websocketPath?: string;
|
|
7
|
+
live?: boolean;
|
|
7
8
|
}
|
|
8
9
|
/**
|
|
9
10
|
* Takes an RTSP video URL and streams it in a video element. By default this will open the TCP relay
|
|
10
11
|
* websocket on the same hostname as COGS is running, but can be configured by passing in custom
|
|
11
12
|
* websocket details.
|
|
12
13
|
*/
|
|
13
|
-
export default function RtspVideo({ uri, websocketHostname, websocketPort, websocketPath, ...rest }: RtspVideoProps & React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>): JSX.Element | null;
|
|
14
|
+
export default function RtspVideo({ uri, websocketHostname, websocketPort, websocketPath, live, ...rest }: RtspVideoProps & React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>): JSX.Element | null;
|
|
@@ -30,7 +30,7 @@ const usePageVisibility_1 = __importDefault(require("../hooks/usePageVisibility"
|
|
|
30
30
|
* websocket on the same hostname as COGS is running, but can be configured by passing in custom
|
|
31
31
|
* websocket details.
|
|
32
32
|
*/
|
|
33
|
-
function RtspVideo({ uri, websocketHostname, websocketPort, websocketPath, ...rest }) {
|
|
33
|
+
function RtspVideo({ uri, websocketHostname, websocketPort, websocketPath, live, ...rest }) {
|
|
34
34
|
// We need to monitor the page visibility as we only want the stream to play when the page is visible
|
|
35
35
|
// This is needed because the stream will "pause" when the page looses focus and start playback when it
|
|
36
36
|
// becomes visible again. This will essentially cause a delay to be introduced into the stream when loosing
|
|
@@ -55,11 +55,13 @@ function RtspVideo({ uri, websocketHostname, websocketPort, websocketPath, ...re
|
|
|
55
55
|
const pipeline = rtspStreamer.play({
|
|
56
56
|
uri,
|
|
57
57
|
videoElement: videoRef,
|
|
58
|
+
playbackRate: live ? cogs_client_1.LIVE_VIDEO_PLAYBACK_RATE : undefined,
|
|
59
|
+
restartIfStopped: live ? true : undefined,
|
|
58
60
|
});
|
|
59
61
|
return () => {
|
|
60
62
|
pipeline.close();
|
|
61
63
|
};
|
|
62
|
-
}, [uri, isVisible, rtspStreamer, videoRef]);
|
|
64
|
+
}, [uri, isVisible, rtspStreamer, videoRef, live]);
|
|
63
65
|
return react_1.default.createElement("video", Object.assign({ ref: videoRefCallback, autoPlay: true }, rest));
|
|
64
66
|
}
|
|
65
67
|
exports.default = RtspVideo;
|
|
@@ -32,6 +32,8 @@ function VideoContainer({ className, style, videoPlayer: customVideoPlayer, full
|
|
|
32
32
|
}
|
|
33
33
|
}, [videoPlayer]);
|
|
34
34
|
const fullscreenCustomStyle = typeof fullscreen === 'object' ? fullscreen.style : style;
|
|
35
|
-
return (react_1.default.createElement("div", { ref: containerRef, className: className, style: fullscreen
|
|
35
|
+
return (react_1.default.createElement("div", { ref: containerRef, className: className, style: fullscreen
|
|
36
|
+
? { position: 'absolute', zIndex: 1, top: 0, left: 0, width: '100vw', height: '100vh', ...fullscreenCustomStyle }
|
|
37
|
+
: { position: 'relative', ...style } }));
|
|
36
38
|
}
|
|
37
39
|
exports.default = VideoContainer;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clockworkdog/cogs-client-react",
|
|
3
|
-
"version": "v1.
|
|
3
|
+
"version": "v1.5.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"typescript": "^4.1.3"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@clockworkdog/cogs-client": "^1.
|
|
34
|
+
"@clockworkdog/cogs-client": "^1.5.0"
|
|
35
35
|
},
|
|
36
36
|
"description": "React components and hooks to connect to COGS to build a custom Media Master",
|
|
37
37
|
"repository": {
|