Skip to content

Commit 7ad51e5

Browse files
committed
Add -t udp and -t tcp for UDP and TCP RTP transport to demo example
1 parent 9cd6170 commit 7ad51e5

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

examples/demo.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ program.description("Yellowstone RTSP Client Test Software");
2323
program.option('-u, --username <value>', 'Optional RTSP Username');
2424
program.option('-p, --password <value>', 'Optional RTSP Password');
2525
program.option('-o, --outfile <value>', 'Optional Output File with no File Extension for captured H264/H265/AV1/AAC');
26+
program.option('-t, --transport <value>', 'Optional RTP Transport - UDP or TCP');
2627

2728
program.argument('<rtsp url eg rtsp://1.2.3.4/stream1>');
2829

@@ -36,7 +37,10 @@ let password = "";
3637
if ('username' in options) username = options.username;
3738
if ('password' in options) password = options.password;
3839

39-
const filename = "outfile"
40+
let transport = "tcp";
41+
if ('transport' in options) transport = options.transport.toString().toLowerCase();
42+
43+
const filename = "outfile"
4044

4145
console.log("Connecting to " + url);
4246

@@ -48,7 +52,7 @@ const client = new RTSPClient(username, password);
4852
// "keepAlive" option is set to true by default
4953
// "connection" option is set to "udp" by default and defines the method the RTP media packets are set to Yellowstone. Options are "udp" or "tcp" (where RTP media packets are sent down the RTSP connection)
5054
// "secure" option is set to true when connecting with TLS to the RTSP Server (eg for RTSPS)
51-
client.connect(url, { connection: "tcp", secure: false })
55+
client.connect(url, { connection: transport, secure: false })
5256
.then(async (detailsArray) => {
5357
console.log("Connected");
5458

0 commit comments

Comments
 (0)