OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2013 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 package org.appspot.apprtc; | 11 package org.appspot.apprtc; |
12 | 12 |
13 import org.webrtc.IceCandidate; | 13 import org.webrtc.IceCandidate; |
14 import org.webrtc.PeerConnection; | 14 import org.webrtc.PeerConnection; |
15 import org.webrtc.SessionDescription; | 15 import org.webrtc.SessionDescription; |
16 | 16 |
17 import java.util.List; | 17 import java.util.List; |
18 | 18 |
19 /** | 19 /** |
20 * AppRTCClient is the interface representing an AppRTC client. | 20 * AppRTCClient is the interface representing an AppRTC client. |
21 */ | 21 */ |
22 public interface AppRTCClient { | 22 public interface AppRTCClient { |
23 | 23 |
24 /** | 24 /** |
25 * Struct holding the connection parameters of an AppRTC room. | 25 * Struct holding the connection parameters of an AppRTC room. |
26 */ | 26 */ |
27 public static class RoomConnectionParameters { | 27 class RoomConnectionParameters { |
28 public final String roomUrl; | 28 public final String roomUrl; |
29 public final String roomId; | 29 public final String roomId; |
30 public final boolean loopback; | 30 public final boolean loopback; |
31 public RoomConnectionParameters( | 31 public RoomConnectionParameters( |
32 String roomUrl, String roomId, boolean loopback) { | 32 String roomUrl, String roomId, boolean loopback) { |
33 this.roomUrl = roomUrl; | 33 this.roomUrl = roomUrl; |
34 this.roomId = roomId; | 34 this.roomId = roomId; |
35 this.loopback = loopback; | 35 this.loopback = loopback; |
36 } | 36 } |
37 } | 37 } |
38 | 38 |
39 /** | 39 /** |
40 * Asynchronously connect to an AppRTC room URL using supplied connection | 40 * Asynchronously connect to an AppRTC room URL using supplied connection |
41 * parameters. Once connection is established onConnectedToRoom() | 41 * parameters. Once connection is established onConnectedToRoom() |
42 * callback with room parameters is invoked. | 42 * callback with room parameters is invoked. |
43 */ | 43 */ |
44 public void connectToRoom(RoomConnectionParameters connectionParameters); | 44 void connectToRoom(RoomConnectionParameters connectionParameters); |
45 | 45 |
46 /** | 46 /** |
47 * Send offer SDP to the other participant. | 47 * Send offer SDP to the other participant. |
48 */ | 48 */ |
49 public void sendOfferSdp(final SessionDescription sdp); | 49 void sendOfferSdp(final SessionDescription sdp); |
50 | 50 |
51 /** | 51 /** |
52 * Send answer SDP to the other participant. | 52 * Send answer SDP to the other participant. |
53 */ | 53 */ |
54 public void sendAnswerSdp(final SessionDescription sdp); | 54 void sendAnswerSdp(final SessionDescription sdp); |
55 | 55 |
56 /** | 56 /** |
57 * Send Ice candidate to the other participant. | 57 * Send Ice candidate to the other participant. |
58 */ | 58 */ |
59 public void sendLocalIceCandidate(final IceCandidate candidate); | 59 void sendLocalIceCandidate(final IceCandidate candidate); |
60 | 60 |
61 /** | 61 /** |
62 * Send removed ICE candidates to the other participant. | 62 * Send removed ICE candidates to the other participant. |
63 */ | 63 */ |
64 public void sendLocalIceCandidateRemovals(final IceCandidate[] candidates); | 64 void sendLocalIceCandidateRemovals(final IceCandidate[] candidates); |
65 | 65 |
66 /** | 66 /** |
67 * Disconnect from room. | 67 * Disconnect from room. |
68 */ | 68 */ |
69 public void disconnectFromRoom(); | 69 void disconnectFromRoom(); |
70 | 70 |
71 /** | 71 /** |
72 * Struct holding the signaling parameters of an AppRTC room. | 72 * Struct holding the signaling parameters of an AppRTC room. |
73 */ | 73 */ |
74 public static class SignalingParameters { | 74 class SignalingParameters { |
75 public final List<PeerConnection.IceServer> iceServers; | 75 public final List<PeerConnection.IceServer> iceServers; |
76 public final boolean initiator; | 76 public final boolean initiator; |
77 public final String clientId; | 77 public final String clientId; |
78 public final String wssUrl; | 78 public final String wssUrl; |
79 public final String wssPostUrl; | 79 public final String wssPostUrl; |
80 public final SessionDescription offerSdp; | 80 public final SessionDescription offerSdp; |
81 public final List<IceCandidate> iceCandidates; | 81 public final List<IceCandidate> iceCandidates; |
82 | 82 |
83 public SignalingParameters( | 83 public SignalingParameters( |
84 List<PeerConnection.IceServer> iceServers, | 84 List<PeerConnection.IceServer> iceServers, |
85 boolean initiator, String clientId, | 85 boolean initiator, String clientId, |
86 String wssUrl, String wssPostUrl, | 86 String wssUrl, String wssPostUrl, |
87 SessionDescription offerSdp, List<IceCandidate> iceCandidates) { | 87 SessionDescription offerSdp, List<IceCandidate> iceCandidates) { |
88 this.iceServers = iceServers; | 88 this.iceServers = iceServers; |
89 this.initiator = initiator; | 89 this.initiator = initiator; |
90 this.clientId = clientId; | 90 this.clientId = clientId; |
91 this.wssUrl = wssUrl; | 91 this.wssUrl = wssUrl; |
92 this.wssPostUrl = wssPostUrl; | 92 this.wssPostUrl = wssPostUrl; |
93 this.offerSdp = offerSdp; | 93 this.offerSdp = offerSdp; |
94 this.iceCandidates = iceCandidates; | 94 this.iceCandidates = iceCandidates; |
95 } | 95 } |
96 } | 96 } |
97 | 97 |
98 /** | 98 /** |
99 * Callback interface for messages delivered on signaling channel. | 99 * Callback interface for messages delivered on signaling channel. |
100 * | 100 * |
101 * <p>Methods are guaranteed to be invoked on the UI thread of |activity|. | 101 * <p>Methods are guaranteed to be invoked on the UI thread of |activity|. |
102 */ | 102 */ |
103 public static interface SignalingEvents { | 103 interface SignalingEvents { |
104 /** | 104 /** |
105 * Callback fired once the room's signaling parameters | 105 * Callback fired once the room's signaling parameters |
106 * SignalingParameters are extracted. | 106 * SignalingParameters are extracted. |
107 */ | 107 */ |
108 public void onConnectedToRoom(final SignalingParameters params); | 108 void onConnectedToRoom(final SignalingParameters params); |
109 | 109 |
110 /** | 110 /** |
111 * Callback fired once remote SDP is received. | 111 * Callback fired once remote SDP is received. |
112 */ | 112 */ |
113 public void onRemoteDescription(final SessionDescription sdp); | 113 void onRemoteDescription(final SessionDescription sdp); |
114 | 114 |
115 /** | 115 /** |
116 * Callback fired once remote Ice candidate is received. | 116 * Callback fired once remote Ice candidate is received. |
117 */ | 117 */ |
118 public void onRemoteIceCandidate(final IceCandidate candidate); | 118 void onRemoteIceCandidate(final IceCandidate candidate); |
119 | 119 |
120 /** | 120 /** |
121 * Callback fired once remote Ice candidate removals are received. | 121 * Callback fired once remote Ice candidate removals are received. |
122 */ | 122 */ |
123 public void onRemoteIceCandidatesRemoved(final IceCandidate[] candidates); | 123 void onRemoteIceCandidatesRemoved(final IceCandidate[] candidates); |
124 | 124 |
125 /** | 125 /** |
126 * Callback fired once channel is closed. | 126 * Callback fired once channel is closed. |
127 */ | 127 */ |
128 public void onChannelClose(); | 128 void onChannelClose(); |
129 | 129 |
130 /** | 130 /** |
131 * Callback fired once channel error happened. | 131 * Callback fired once channel error happened. |
132 */ | 132 */ |
133 public void onChannelError(final String description); | 133 void onChannelError(final String description); |
134 } | 134 } |
135 } | 135 } |
OLD | NEW |