Skip to content
This repository was archived by the owner on Jan 25, 2023. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions lib/PlaybackArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,14 @@ interface PlaybackAreaProps {
readonly autoRetry?: boolean
}

const wsUri = (protocol: Protocol.WS | Protocol.WSS, host: string) => {
return host.length !== 0 ? `${protocol}//${host}/rtsp-over-websocket` : ''
const wsUri = (
protocol: Protocol.WS | Protocol.WSS,
host: string,
searchParams: string,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
searchParams: string,
searchParams?: string,

) => {
return host.length !== 0
? `${protocol}//${host}/rtsp-over-websocket?${searchParams}`
: ''
}

const rtspUri = (host: string, searchParams: string) => {
Expand Down Expand Up @@ -236,7 +242,13 @@ export const PlaybackArea: React.FC<PlaybackAreaProps> = ({
const timestamp = refresh.toString()

if (format === Format.RTP_H264) {
const ws = wsUri(secure ? Protocol.WSS : Protocol.WS, host)
const ws = wsUri(
secure ? Protocol.WSS : Protocol.WS,
host,
searchParams(FORMAT_API[format], {
...parameters,
}),
Comment on lines +248 to +250
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would also need to be optional somehow, as I guess this is specific for your setup?

)
const rtsp = rtspUri(
host,
searchParams(FORMAT_API[format], {
Expand Down Expand Up @@ -267,7 +279,13 @@ export const PlaybackArea: React.FC<PlaybackAreaProps> = ({
}

if (format === Format.RTP_JPEG) {
const ws = wsUri(secure ? Protocol.WSS : Protocol.WS, host)
const ws = wsUri(
secure ? Protocol.WSS : Protocol.WS,
host,
searchParams(FORMAT_API[format], {
...parameters,
}),
)
const rtsp = rtspUri(
host,
searchParams(FORMAT_API[format], {
Expand Down