Manu
Manu

Reputation: 901

Cannot use webrtc.io package; JavaScript error on browser

I have just started working with WebRTC. I want to use WebRTC with NodeJS.

Currently I have tried webrtc.io package. When I write a basic code for using WebRTC, I get the following JavaScript error.

Error is :

Uncaught TypeError: Type error 
rtc._socket.onopen

Error Location:

webrtc.io.js:65

Here is my code.

CLIENT CODE :

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>HTML5 getUserMedia</title>
    <script src="socket.io.min.js" type="text/javascript"></script>
    <script src="webrtc.io.js" type="text/javascript"></script> 
    <script>

        rtc.connect('ws://abc.in:8001');

    </script>
</head>

<body>
    <video id="webcam" width="500" autoplay></video>
</body>

</html>

SERVER CODE :

var webRTC = require('/usr/local/node_modules/webrtc.io').listen( 8001 );

console.log( "Server Listening" );

webRTC.on( "connection", function() {

console.log( "Hi" ); // This gets executed successfully.
});

Q1. Since "Hi" does get printed successfully, I don't know if JS error is actually making a difference or no. Help me resolve this JS error issue. Issue also reported here.

Q2. Hitting http://abc.in:8001/ through browser prints "Not implemented". Is that an issue?

Q3. I wish to stream the audio+video from a mic and webcam to the server.

I understand that I need to create a peer to peer connection to achieve streaming of audio+video to server. Browser should act as one peer and the server would act as the second peer.

How do I send the WebRTC stream to the server? Lack of documentation of the webrtc.io package isn't helping me either.

Please help

EDIT : Browser used is the latest Google Chrome, Version 31.0.1650.57 m

Upvotes: 2

Views: 962

Answers (1)

Aung Thuya
Aung Thuya

Reputation: 47

I uploaded simplest webRTC code at

http://github.com/aungthuya-jse/simplest-webRTC/tree/master

You need to add the node_modules to under of project folder by installing

npm install express

and

npm install webrtc.io

after installation you will see /project-folder/node_modules/express folder and webrtc.io folder

Upvotes: 0

Related Questions