Skip to content

Documentation clarification for newbs #24

Description

@jimbo1969

Thanks for sharing, Chris! Here is one detail that may throw off some newbies like me:

In addition to your note about javascript (vs. typescript) needing const RtspServer = require('rtsp-streaming-server').default;, one more change is required in your script to use plain old javascript -- removal of the void type specification for the run() function. In fact, it might not be totally clear that the 'require' business above in intended to replace the import statement.

For a standalone deployment, I create a file called 'app.js', containing the following:

//import RtspServer from 'rtsp-streaming-server'
const RtspServer = require('rtsp-streaming-server').default;  //replaced above typescript import
 
const server = new RtspServer({
    serverPort: 5554,
    clientPort: 6554,
    rtpPortStart: 10000,
    rtpPortCount: 10000
});
 
 
async function run () {   //removed ': void' type specification intended for typescript
    try {
        await server.start();
    } catch (e) {
        console.error(e);
    }
}
 
run();

Then I run it with node app.js.

I'm a Node.js newbie, and the above surely "goes without saying" for more node-or-javascript -seasoned folks, but it was not obvious at first glance for me.

Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions