| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * libjingle | |
| 3 * Copyright 2013 Google Inc. | |
| 4 * | |
| 5 * Redistribution and use in source and binary forms, with or without | |
| 6 * modification, are permitted provided that the following conditions are met: | |
| 7 * | |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | |
| 9 * this list of conditions and the following disclaimer. | |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | |
| 11 * this list of conditions and the following disclaimer in the documentation | |
| 12 * and/or other materials provided with the distribution. | |
| 13 * 3. The name of the author may not be used to endorse or promote products | |
| 14 * derived from this software without specific prior written permission. | |
| 15 * | |
| 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED | |
| 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | |
| 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | |
| 19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 26 */ | |
| 27 | |
| 28 package org.appspot.apprtc; | |
| 29 | |
| 30 import org.webrtc.IceCandidate; | |
| 31 import org.webrtc.PeerConnection; | |
| 32 import org.webrtc.SessionDescription; | |
| 33 | |
| 34 import java.util.List; | |
| 35 | |
| 36 /** | |
| 37 * AppRTCClient is the interface representing an AppRTC client. | |
| 38 */ | |
| 39 public interface AppRTCClient { | |
| 40 | |
| 41 /** | |
| 42 * Struct holding the connection parameters of an AppRTC room. | |
| 43 */ | |
| 44 public static class RoomConnectionParameters { | |
| 45 public final String roomUrl; | |
| 46 public final String roomId; | |
| 47 public final boolean loopback; | |
| 48 public RoomConnectionParameters( | |
| 49 String roomUrl, String roomId, boolean loopback) { | |
| 50 this.roomUrl = roomUrl; | |
| 51 this.roomId = roomId; | |
| 52 this.loopback = loopback; | |
| 53 } | |
| 54 } | |
| 55 | |
| 56 /** | |
| 57 * Asynchronously connect to an AppRTC room URL using supplied connection | |
| 58 * parameters. Once connection is established onConnectedToRoom() | |
| 59 * callback with room parameters is invoked. | |
| 60 */ | |
| 61 public void connectToRoom(RoomConnectionParameters connectionParameters); | |
| 62 | |
| 63 /** | |
| 64 * Send offer SDP to the other participant. | |
| 65 */ | |
| 66 public void sendOfferSdp(final SessionDescription sdp); | |
| 67 | |
| 68 /** | |
| 69 * Send answer SDP to the other participant. | |
| 70 */ | |
| 71 public void sendAnswerSdp(final SessionDescription sdp); | |
| 72 | |
| 73 /** | |
| 74 * Send Ice candidate to the other participant. | |
| 75 */ | |
| 76 public void sendLocalIceCandidate(final IceCandidate candidate); | |
| 77 | |
| 78 /** | |
| 79 * Disconnect from room. | |
| 80 */ | |
| 81 public void disconnectFromRoom(); | |
| 82 | |
| 83 /** | |
| 84 * Struct holding the signaling parameters of an AppRTC room. | |
| 85 */ | |
| 86 public static class SignalingParameters { | |
| 87 public final List<PeerConnection.IceServer> iceServers; | |
| 88 public final boolean initiator; | |
| 89 public final String clientId; | |
| 90 public final String wssUrl; | |
| 91 public final String wssPostUrl; | |
| 92 public final SessionDescription offerSdp; | |
| 93 public final List<IceCandidate> iceCandidates; | |
| 94 | |
| 95 public SignalingParameters( | |
| 96 List<PeerConnection.IceServer> iceServers, | |
| 97 boolean initiator, String clientId, | |
| 98 String wssUrl, String wssPostUrl, | |
| 99 SessionDescription offerSdp, List<IceCandidate> iceCandidates) { | |
| 100 this.iceServers = iceServers; | |
| 101 this.initiator = initiator; | |
| 102 this.clientId = clientId; | |
| 103 this.wssUrl = wssUrl; | |
| 104 this.wssPostUrl = wssPostUrl; | |
| 105 this.offerSdp = offerSdp; | |
| 106 this.iceCandidates = iceCandidates; | |
| 107 } | |
| 108 } | |
| 109 | |
| 110 /** | |
| 111 * Callback interface for messages delivered on signaling channel. | |
| 112 * | |
| 113 * <p>Methods are guaranteed to be invoked on the UI thread of |activity|. | |
| 114 */ | |
| 115 public static interface SignalingEvents { | |
| 116 /** | |
| 117 * Callback fired once the room's signaling parameters | |
| 118 * SignalingParameters are extracted. | |
| 119 */ | |
| 120 public void onConnectedToRoom(final SignalingParameters params); | |
| 121 | |
| 122 /** | |
| 123 * Callback fired once remote SDP is received. | |
| 124 */ | |
| 125 public void onRemoteDescription(final SessionDescription sdp); | |
| 126 | |
| 127 /** | |
| 128 * Callback fired once remote Ice candidate is received. | |
| 129 */ | |
| 130 public void onRemoteIceCandidate(final IceCandidate candidate); | |
| 131 | |
| 132 /** | |
| 133 * Callback fired once channel is closed. | |
| 134 */ | |
| 135 public void onChannelClose(); | |
| 136 | |
| 137 /** | |
| 138 * Callback fired once channel error happened. | |
| 139 */ | |
| 140 public void onChannelError(final String description); | |
| 141 } | |
| 142 } | |
| OLD | NEW |