node rtsp stream code example

Example 1: node rts stream

$ npm install node-rtsp-stream

Example 2: node rts stream

Stream = require('node-rtsp-stream')
stream = new Stream({
  name: 'name',
  streamUrl: 'rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov',
  wsPort: 9999,
  ffmpegOptions: { // options ffmpeg flags
    '-stats': '', // an option with no neccessary value uses a blank string
    '-r': 30 // options with required values specify the value after the key
  }
})

Example 3: node rts stream

<html>
<body>
    <canvas id="canvas"></canvas>
</body>

<script type="text/javascript" src="jsmpeg.min.js"></script>
<script type="text/javascript">
    player = new JSMpeg.Player('ws://localhost:9999', {
      canvas: document.getElementById('canvas') // Canvas should be a canvas DOM element
    })	
</script>
</html>