From 54e2d2d2af5c8d0834da5e8a4b2418230ca4dd5e Mon Sep 17 00:00:00 2001 From: Alexandr Kazachenko Date: Fri, 4 Dec 2015 15:41:18 +0600 Subject: [PATCH] Fix readstream --- RTSPRecorder.js | 4 ++++ example/index.html | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/RTSPRecorder.js b/RTSPRecorder.js index 08ce105..5d9878f 100644 --- a/RTSPRecorder.js +++ b/RTSPRecorder.js @@ -146,6 +146,10 @@ this.readStream.stdout.on('close', function() { self._readStarted = false; + if(self.readStream.connected){ + self.readStream.kill(); + self.readStream.disconnect(); + } self.readStream = null; self.reconnect(); }); diff --git a/example/index.html b/example/index.html index 0fcb586..06bdbc4 100644 --- a/example/index.html +++ b/example/index.html @@ -11,14 +11,17 @@ var oneCamera = false; - var player1 = new jsmpeg( new WebSocket('ws://localhost:8001'), { + var host = '192.168.1.137'; + var port = 27115; + + var player1 = new jsmpeg( new WebSocket('ws://'+host+':'+27115), { canvas: document.getElementById('videoCanvas1') }); player1.play(); if(!oneCamera){ - var player2 = new jsmpeg( new WebSocket('ws://localhost:8002'), { + var player2 = new jsmpeg( new WebSocket('ws://'+host+':'+27116), { canvas: document.getElementById('videoCanvas2') });