forked from react-native-webrtc/react-native-webrtc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RTCPeerConnectionBase.js
74 lines (69 loc) · 2.37 KB
/
RTCPeerConnectionBase.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
'use strict';
var RTCSessionDescription = require('./RTCSessionDescription');
class RTCPeerConnectionBase {
localDescription: RTCSessionDescription;
remoteDescription: RTCSessionDescription;
onicecandidate: ?Function;
onnegotiationneeded: ?Function;
oniceconnectionstatechange: ?Function;
onsignalingstatechange: ?Function;
onaddstream: ?Function;
constructor(configuration) {
this.constructorImpl(configuration);
}
addStream(stream) {
this.addStreamImpl(stream);
}
removeStream(stream) {
this.removeStreamImpl(stream);
}
createOffer(success: ?Function, failure: ?Function, constraints) {
this.createOfferImpl(success, failure, constraints);
}
createAnswer(success: ?Function, failure: ?Function, constraints) {
this.createAnswerImpl(success, failure, constraints);
}
setLocalDescription(sessionDescription: RTCSessionDescription, success: ?Function, failure: ?Function, constraints) {
this.setLocalDescriptionImpl(sessionDescription, success, failure, constraints);
}
setRemoteDescription(sessionDescription: RTCSessionDescription, success: ?Function, failure: ?Function) {
this.setRemoteDescriptionImpl(sessionDescription, success, failure);
}
addIceCandidate(candidate, success, failure) {
this.addIceCandidateImpl(candidate, success, failure);
}
addIceCandidateDirect(candidate, success, failure) {
this.addIceCandidateDirectImpl(candidate, success, failure);
}
close() {
this.closeImpl();
}
constructorImpl() {
throw new Error('Subclass must define constructorImpl method');
}
addStreamImpl() {
throw new Error('Subclass must define addStreamImpl method');
}
createOfferImpl() {
throw new Error('Subclass must define createOfferImpl method');
}
createAnswerImpl() {
throw new Error('Subclass must define createAnswerImpl method');
}
setLocalDescriptionImpl() {
throw new Error('Subclass must define setLocalDescriptionImpl method');
}
setRemoteDescriptionImpl() {
throw new Error('Subclass must define setRemoteDescriptionImpl method');
}
addIceCandidateImpl() {
throw new Error('Subclass must define addIceCandidateImpl method');
}
addIceCandidateDirectImpl() {
throw new Error('Subclass must define addIceCandidateDirectImpl method');
}
closeImpl() {
throw new Error('Subclass must define closeImpl method');
}
}
module.exports = RTCPeerConnectionBase;