andresp@webrtc.org | 468516c | 2014-09-02 10:52:54 +0000 | [diff] [blame^] | 1 | // Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
| 2 | // |
| 3 | // Use of this source code is governed by a BSD-style license |
| 4 | // that can be found in the LICENSE file in the root of the source |
| 5 | // tree. An additional intellectual property rights grant can be found |
| 6 | // in the file PATENTS. All contributing project authors may |
| 7 | // be found in the AUTHORS file in the root of the source tree. |
| 8 | |
| 9 | var botExposedApi = { |
| 10 | ping: function (callback) { |
| 11 | callback("pong"); |
| 12 | }, |
| 13 | |
| 14 | createPeerConnection: function (doneCallback) { |
| 15 | console.log("Creating peer connection"); |
| 16 | var pc = new webkitRTCPeerConnection(null); |
| 17 | var obj = {}; |
| 18 | expose(obj, pc, "close"); |
| 19 | expose(obj, pc, "createOffer"); |
| 20 | expose(obj, pc, "createAnswer"); |
| 21 | expose(obj, pc, "setRemoteDescription", { 0: RTCSessionDescription }); |
| 22 | expose(obj, pc, "setLocalDescription", { 0: RTCSessionDescription }); |
| 23 | doneCallback(obj); |
| 24 | }, |
| 25 | }; |
| 26 | |
| 27 | connectToServer(botExposedApi); |