Re: Getting a Simple Example of webkitRTCPeerConnection to work

6,363 views
Skip to first unread message

Brave Yao

unread,
Nov 4, 2012, 9:12:12 PM11/4/12
to discuss...@googlegroups.com
https://webrtc-demos.appspot.com/html/pc1.html
This page gives a more simple example of webkitRTCPeerConnection APIs.

On Saturday, November 3, 2012 11:06:29 PM UTC+8, T Man wrote:
I've taken a look at Justin's neat example of a 1 to 1 video conferencing application, http://apprtc.appspot.com/ source code: http://code.google.com/p/webrtc-samples/source/browse/trunk/apprtc/

which uses a python server for signalling and hosting the javascript code.

I wanted to break this down into a simpler version to understand how everything actually works, so I tried doing the complete implementation in only JavaScript.

I used node.js websockets as a signalling channel, and created 2 pages, one called client.html and another server.html, where I intended that the clients GetUserMedia video stream to eventually get streamed on the my server.html.

I used jquery just to make my code look a bit more structured, with DOM manipulation. 


The client.thml does manage to send an offer and get an answer from the server.html via the websocket, and eventually the server gets a URL blob, but after I added it to src attributed of the server's video player nothing seems to be getting rendered.

Looks like i've not understood some part of the webrtc API, would someone here be able to tell me what I'm missing. I've attached my source code here.
 

T Man

unread,
Nov 5, 2012, 1:30:18 PM11/5/12
to discuss...@googlegroups.com
Thank you very much, this was exactly what I needed.
Message has been deleted
Message has been deleted
Message has been deleted

Dick Gooris

unread,
Feb 4, 2013, 1:03:26 PM2/4/13
to discuss...@googlegroups.com
Hello Antony,

There were two reasons why there was no video stream. The ANSWER was not sent back towards the offering party so it could not apply the setRemoteDescription() using the information from the answer. Secondly, there were no facilities in place to send the CANDIDATE messages between the two parties. The correction resulted in some updates in the node function which is the appstract.js file.

See the attachment jsep-v02.zip in which these updates can be found.

Kind regards

- Dick
jsep-v02.zip

Takahiro Ichihashi

unread,
Feb 6, 2013, 10:08:09 AM2/6/13
to discuss...@googlegroups.com
This is really simple & handful working example. Thanks a lot for the work Dick.

 - ti

2013/2/5 Dick Gooris <dick....@alcatel-lucent.com>

--
 
---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Padma Prasad Dharmaraja

unread,
Feb 23, 2013, 9:24:21 AM2/23/13
to discuss...@googlegroups.com
Hi Dick, Chris,
I downloaded your "jsep-v02.zip" and trying to establish video calls between two browser running on different machines within the same network.
Following are the changes, I did to establish the connection, I do not need any stun server as I am are running within our own network.

var nodeHostAddress  = "10.70.xx.xx";      ( local IP address)
var nodeHostPort     = "8080";

var pc_config = null;
pc = new webkitRTCPeerConnection(pc_config);

We are not able to make video calls yet( no video screen visible at the server.html side.
I am attaching sceen shot of both server.html and client.html logs here for your reference.
Could you help us out to resolve this issue.

Thanks much,
Padma Prasad
Screen_logs.rtf

Dick Gooris

unread,
Mar 23, 2013, 4:05:50 PM3/23/13
to discuss...@googlegroups.com
Padma Prasad, others,

The version jsep-v02.zip will not work anymore with Chrome release higher than 25

There are two function calls you need to adapt.

pc.createOffer
pc.createAnswer

Both have sdp definitions {audio:true, video:true}
 
You need to replace this definition by a variable such as sdpConstraints, and define it as follows:

var sdpConstraints = {'mandatory': {
    'OfferToReceiveAudio':true, 
    'OfferToReceiveVideo':true }
};


If you don't you will get DOM exception 17.

I did some tests with pc_config = null, and it still works on my local lan. 
The candidates only have local addresses. Setting it to the Stun definition, then I also see my WAN addresses.

Regards,

- Dick Gooris

Noman Sadiq

unread,
Feb 4, 2014, 2:19:40 AM2/4/14
to discuss...@googlegroups.com
Hi DICK,

Can you please share a working copy of this code i try to make change but it is still not working at local Lan.

Thanks
Regards
Noman Sadiq
Reply all
Reply to author
Forward
0 new messages