javascript - video framerate problems with webrtc on socket -
i have made simple application webrtc using kurento media server. application server side written on nodejs , client side simple html.
the problem facing little weird.
for being able use webrtc functionalities using sockets (socketio) achieve functionalities.
when make socket object in same file server.js , use within same file, frame rate of videos seen on screen perfect:
server.js
var app = express(); var server; var server = app.listen(port, function () { console.log('app started'); }); var io = require('socket.io')(server); io.on('connection', function (socket) { socket.emit('id', socket.id); socket.on('error', function (data) { }); socket.on('disconnect', function (data) { }); socket.on('message', function (message) { }); });
in above case, frame rate of video stable @ 30fps when send or receive streams.
but when make separate file handle socket messages, application seems go slower , video frame rate drops 15-20 fps:
server.js
var app = express(); var server; var server = app.listen(port, function () { console.log('app started'); }); var io = require('socket.io')(server); require('./sockethandler')(io);
sockethandler.js
module.exports = function(io) { io.on('connection', function (socket) { socket.emit('id', socket.id); socket.on('error', function (data) { }); }); socket.on('disconnect', function (data) { }); socket.on('message', function (message) { }); }); }
it seems passing reference of socket object server.js sockethandler.js seems causing application level problems. have solution this??
Comments
Post a Comment