Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation clarification for newbs #24

Open
jimbo1969 opened this issue May 13, 2021 · 0 comments
Open

Documentation clarification for newbs #24

jimbo1969 opened this issue May 13, 2021 · 0 comments

Comments

@jimbo1969
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant