Web Video/Chat application using PeerConnection

875 views
Skip to first unread message

Scott Haynes

unread,
Apr 30, 2012, 1:56:06 PM4/30/12
to discuss-webrtc
I'm trying to build a video/chat application using the
PeerConnection. I'm running into a few issues and I wanted to see if
anyone could offer some help. There isn't a lot of info out there and
the only demo I've found that seems to work is the jsep/roap sample in
the webrtc-samples. The apprtc has a syntax error, at least in the
branch I have of that demo.

I've got an web application frame work that allows me to communicate
between clients, so it was my understanding that I should NOT need to
run a server.

I'm calling:
var peerConn = new webkitDeprecatedPeerConnection("{{ pc_config }}",
function( message ) {
console.info( "message = " + message );
} ); )

and I'm getting a callback into the function defined. 'message' is
defined as object with messageType, offererSessionID, sdp, seq, and
tieBreaker. This looks to be valid, from seeing the JSEP/ROAP demo.
Do I need to pass the 'message' object to the other clients?

I'm also getting a callback to 'onconnecting' in the PeerConnection
object.

From the samples it looks like I should be getting a callback into
'onaddstream', and from that callback I can call
webkitURL.createObjectURL to get the remote URL to pass along to any
other clients. I am adding the local stream to the peerConn, but the
onaddstream callback never gets called. Does anyone see something
that I'm doing wrong? Or have I made incorrect assumptions?

Thanks,
Scott

Justin Uberti

unread,
Apr 30, 2012, 10:12:27 PM4/30/12
to discuss...@googlegroups.com
What syntax error are you seeing? The apprtc sample code should run out of the box.

Scott Haynes

unread,
May 2, 2012, 10:31:54 AM5/2/12
to discuss...@googlegroups.com
I'm attempting to load apprtc on a local server from the following repository: http://webrtc-samples.googlecode.com/svn/trunk
 
The syntax error was on line 86:  var initiator = {{ initiator }};
I fixed that error by comparing the code to the example at:  https://apprtc.appspot.com/
 
Now, I'm running into an issue with my network security. 
Uncaught ReferenceError: goog is not defined
 
I work for Lockheed Martin and the network security is always causing issues.  Just getting canary installed took weeks, because the something the installer does is blocked by our version of mcafee.  Error from the network tab is below when I directly try to access the channel.js file.
 
Is the goog.appengine.channel object absolutely required?  I noticed that the roap-jsep demo does not appear to include channel.js.  Would it be possible to just get a copy of the file and add it as a script locally?  I know we are using the closure math library and we didn't have any troubles loading that from google.com(or where ever), so I'm kind of puzzled why I don't have access to https://talkgadget.google.com/
 
 
 

This webpage is not available

The webpage at https://talkgadget.google.com/talkgadget/channel.js might be temporarily down or it may have moved permanently to a new web address.
Error 111 (net::ERR_TUNNEL_CONNECTION_FAILED): Unknown error.
 
Thanks,
Scott

Ivan Vučica

unread,
May 3, 2012, 12:37:22 PM5/3/12
to discuss...@googlegroups.com
Based on its name, goog.appengine.channel seems to be related to Google's app hosting service, Google App Engine.

You'll definitely want to learn by looking at other examples and WebRTC drafts from w3c as your primary source of information. The sample you are referring to can be a nice example, but probably can't be a good starting point.
--
Ivan Vučica - iv...@vucica.net


Scott Haynes

unread,
May 3, 2012, 1:18:49 PM5/3/12
to discuss...@googlegroups.com
I just found this:   http://www.webrtc.org/reference 

Probably a good candidate for a link on the home page.
Scott

Ivan Vučica

unread,
May 3, 2012, 1:24:54 PM5/3/12
to discuss...@googlegroups.com
Actually, that has more to do with the C++ API than with web-based API. Be careful! :)

But there are some nice demos out there. You may not have something very basic and universally functional to start with, but looking at the demos carefully enough, you can assemble something functional quite quickly.

This made me realize how I really, really need to find some spare time to work on that Jingle client with the new webkitPeerConnection00 APIs.

Scott Haynes

unread,
May 3, 2012, 3:07:31 PM5/3/12
to discuss...@googlegroups.com
I thought that was about the C API as well, and that is why I didn't pay as much attention to that API definition to start with.  Do you have any web application demos that I might not have seen, that could be helpful?  The apprtc is the most relevant demo I've found so far, and I can't get it to work on my work PC.

Where is the best source of info about the  web-based API?

Thanks, Scott

medusade

unread,
May 3, 2012, 3:35:58 PM5/3/12
to discuss...@googlegroups.com
Hi Scott,

The old "peerconnection_client" signaling protocol is different than the one in there browser, so if you want to make a browser app that wont work.

I've found a good JavaScript sample app (webrtc_test) buried on a link somewhere in this forum. Can't seem to find it again, so I will attempt to send it to you.

You need to access the page (In Canary) from a web sever, and connect it to a "peerconnection_server".

I hope this helps
webrtc_test.html

Scott Haynes

unread,
May 3, 2012, 3:57:38 PM5/3/12
to discuss...@googlegroups.com

I know the demo you're talking about.  It's located in the svn repository for webrtc: webrtc\test\sanity_check\www\html

I looked at it, but couldn't figure out how to get the call button to enable.  Probably something I'm either blocked from or just not knowledgeable enough to get working...

Are there any additional steps other than loading the page?

Thanks,
Scott 

google19

unread,
May 4, 2012, 11:19:10 PM5/4/12
to discuss-webrtc
Would it be
possible to just get a copy of the file and add it as a script
locally?

I've succesfu;;y running webrtc sample by downloading app engine sdk
dan run it locally. (python2.7)
I guess you can disable channel.js but you need to replacing it with
your own pool mecanism...
> >>> On Thu, May 3, 2012 at 7:18 PM, Scott Haynes <scottnc27...@gmail.com>wrote:
>
> >>>> I just found this:  http://www.webrtc.org/reference
>
> >>>> Probably a good candidate for a link on the home page.
> >>>> Scott
>
> >>>> On Thursday, May 3, 2012 12:37:22 PM UTC-4, Ivan Vučica wrote:
>
> >>>>> Based on its name, goog.appengine.channel seems to be related to
> >>>>> Google's app hosting service, Google App Engine.
>
> >>>>> You'll definitely want to learn by looking at other examples and
> >>>>> WebRTC drafts from w3c as your primary source of information. The sample
> >>>>> you are referring to can be a nice example, but probably can't be a good
> >>>>> starting point.
>
> >>>>> On Wed, May 2, 2012 at 4:31 PM, Scott Haynes <scottnc27...@gmail.com>wrote:
>
> >>>>>> I'm attempting to load apprtc on a local server from the following
> >>>>>> repository:http://webrtc-samples.**googlecode.com/svn/trunk<http://webrtc-samples.googlecode.com/svn/trunk>
>
> >>>>>> The syntax error was on line 86:  var initiator = {{ initiator }};
> >>>>>> I fixed that error by comparing the code to the example at:
> >>>>>>https://apprtc.appspot.com/
>
> >>>>>> Now, I'm running into an issue with my network security.
> >>>>>> Uncaught ReferenceError: goog is not defined
>
> >>>>>> I work for Lockheed Martin and the network security is always causing
> >>>>>> issues.  Just getting canary installed took weeks, because the something
> >>>>>> the installer does is blocked by our version of mcafee.  Error from the
> >>>>>> network tab is below when I directly try to access the channel.js file.
>
> >>>>>> Is the goog.appengine.channel object absolutely required?  I noticed
> >>>>>> that the roap-jsep demo does not appear to include channel.js.  Would it be
> >>>>>> possible to just get a copy of the file and add it as a script locally?  I
> >>>>>> know we are using the closure math library and we didn't have any troubles
> >>>>>> loading that from google.com(or where ever), so I'm kind of puzzled
> >>>>>> why I don't have access to *https://talkgadget.google.com/*<https://talkgadget.google.com/>
>
> >>>>>> This webpage is not available
> >>>>>> The webpage at *https://talkgadget.google.com/talkgadget/channel.js*
> >>>>>> migh**t be temporarily down or it may have moved permanently to a
> >>>>>> new web address.
> >>>>>>  Error 111 (net::ERR_TUNNEL_CONNECTION_**FAILED): Unknown error.
>
> >>>>>> Thanks,
> >>>>>> Scott
>
> >>>>>> On Monday, April 30, 2012 10:12:27 PM UTC-4, Justin Uberti wrote:
>
> >>>>>>> What syntax error are you seeing? The apprtc sample code should run
> >>>>>>> out of the box.
>
> >>>>>>> On Mon, Apr 30, 2012 at 10:56 AM, Scott Haynes <
> >>>>>>> scottnc27...@gmail.com> wrote:
>
> >>>>>>>> I'm trying to build a video/chat application using the
> >>>>>>>> PeerConnection.  I'm running into a few issues and I wanted to see
> >>>>>>>> if
> >>>>>>>> anyone could offer some help.  There isn't a lot of info out there
> >>>>>>>> and
> >>>>>>>> the only demo I've found that seems to work is the jsep/roap sample
> >>>>>>>> in
> >>>>>>>> the webrtc-samples.  The apprtc has a syntax error, at least in the
> >>>>>>>> branch I have of that demo.
>
> >>>>>>>> I've got an web application frame work that allows me to communicate
> >>>>>>>> between clients, so it was my understanding that I should NOT need
> >>>>>>>> to
> >>>>>>>> run a server.
>
> >>>>>>>> I'm calling:
> >>>>>>>> var peerConn = new webkitDeprecatedPeerConnection****("{{
> >>>>>>>> pc_config }}",
> >>>>>>>>              function( message ) {
> >>>>>>>>                console.info( "message = " + message );
> >>>>>>>>              } );  )
>
> >>>>>>>> and I'm getting a callback into the function defined.  'message' is
> >>>>>>>> defined as object with messageType, offererSessionID, sdp, seq, and
> >>>>>>>> tieBreaker.  This looks to be valid, from seeing the JSEP/ROAP demo.
> >>>>>>>> Do I need to pass the 'message' object to the other clients?
>
> >>>>>>>> I'm also getting a callback to 'onconnecting' in the PeerConnection
> >>>>>>>> object.
>
> >>>>>>>> From the samples it looks like I should be getting a callback into
> >>>>>>>> 'onaddstream', and from that callback I can call
> >>>>>>>> webkitURL.createObjectURL to get the remote URL to pass along to any
> >>>>>>>> other clients.  I am adding the local stream to the peerConn, but
> >>>>>>>> the
> >>>>>>>> onaddstream callback never gets called.  Does anyone see something
> >>>>>>>> that I'm doing wrong?  Or have I made incorrect assumptions?
>
> >>>>>>>> Thanks,
> >>>>>>>> Scott
>
> >>>>> --
> >>>>> Ivan Vučica - i...@vucica.net
>
> >>> --
> >>> Ivan Vučica - i...@vucica.net

Ivan Vučica

unread,
May 5, 2012, 3:14:18 AM5/5/12
to discuss...@googlegroups.com
Did you put the HTML file on an HTTP server? By default, WebRTC-related stuff doesn't work in HTML files hosted on file://.

Scott Haynes

unread,
May 5, 2012, 8:13:48 AM5/5/12
to discuss...@googlegroups.com
I tried that, but I ran into other issues.  I ended up tracing through the code on my mac at home and I see what all is going on.  I've got everything written for the most part now without channel.js.  I'll be testing first thing monday morning, hopefully everything will work out.  It looked like the channel object was just being used so the clients could communicate with each other, and that is something I already have working.

I'm working on another project on github, the virtual world framework.  It's pretty cool.

Scott

Scott Haynes

unread,
May 5, 2012, 8:18:11 AM5/5/12
to discuss...@googlegroups.com
I was running a server locally.  Now that I've actually been able to trace through code is see there is a lot more going on than I originally knew.  Sorry for asking a bunch of uneducated questions, unfortunately there just isn't a lot of info about the Javascript side of the API.  I think I'm good now though.

Thanks,
Scott

Justin Uberti

unread,
May 7, 2012, 1:55:38 PM5/7/12
to discuss...@googlegroups.com
Yes, the apprtc demo uses Channel to provide server->client messaging for exchanging signaling data, and it looks like the Channel HTTPS connection is being blocked by your firewall. But if you already have your own backchannel, you can just send the signaling messages on that .
Reply all
Reply to author
Forward
0 new messages