react-native-webrtc 1.94.2 → 1.100.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/android/src/main/java/com/oney/WebRTCModule/PeerConnectionObserver.java +1 -1
- package/android/src/main/java/com/oney/WebRTCModule/VideoTrackAdapter.java +17 -21
- package/android/src/main/java/com/oney/WebRTCModule/WebRTCModule.java +3 -0
- package/ios/RCTWebRTC/RCTConvert+WebRTC.m +3 -0
- package/ios/RCTWebRTC/ScreenCaptureController.m +4 -0
- package/ios/RCTWebRTC/ScreenCapturer.m +8 -0
- package/ios/RCTWebRTC/WebRTCModule+RTCPeerConnection.m +3 -1
- package/ios/RCTWebRTC/WebRTCModule+VideoTrackAdapter.h +1 -1
- package/ios/RCTWebRTC/WebRTCModule+VideoTrackAdapter.m +3 -9
- package/lib/commonjs/EventEmitter.js +16 -0
- package/lib/commonjs/EventEmitter.js.map +1 -0
- package/lib/commonjs/MediaDevices.js +61 -0
- package/lib/commonjs/MediaDevices.js.map +1 -0
- package/lib/commonjs/MediaStream.js +158 -0
- package/lib/commonjs/MediaStream.js.map +1 -0
- package/lib/commonjs/MediaStreamError.js +26 -0
- package/lib/commonjs/MediaStreamError.js.map +1 -0
- package/lib/commonjs/MediaStreamErrorEvent.js +23 -0
- package/lib/commonjs/MediaStreamErrorEvent.js.map +1 -0
- package/lib/commonjs/MediaStreamEvent.js +23 -0
- package/lib/commonjs/MediaStreamEvent.js.map +1 -0
- package/lib/commonjs/MediaStreamTrack.js +127 -0
- package/lib/commonjs/MediaStreamTrack.js.map +1 -0
- package/lib/commonjs/MediaStreamTrackEvent.js +23 -0
- package/lib/commonjs/MediaStreamTrackEvent.js.map +1 -0
- package/lib/commonjs/MessageEvent.js +23 -0
- package/lib/commonjs/MessageEvent.js.map +1 -0
- package/lib/commonjs/Permissions.js +125 -0
- package/lib/commonjs/Permissions.js.map +1 -0
- package/lib/commonjs/RTCDataChannel.js +198 -0
- package/lib/commonjs/RTCDataChannel.js.map +1 -0
- package/lib/commonjs/RTCDataChannelEvent.js +23 -0
- package/lib/commonjs/RTCDataChannelEvent.js.map +1 -0
- package/lib/commonjs/RTCEvent.js +20 -0
- package/lib/commonjs/RTCEvent.js.map +1 -0
- package/lib/commonjs/RTCIceCandidate.js +34 -0
- package/lib/commonjs/RTCIceCandidate.js.map +1 -0
- package/lib/commonjs/RTCIceCandidateEvent.js +25 -0
- package/lib/commonjs/RTCIceCandidateEvent.js.map +1 -0
- package/lib/commonjs/RTCPeerConnection.js +371 -0
- package/lib/commonjs/RTCPeerConnection.js.map +1 -0
- package/lib/commonjs/RTCSessionDescription.js +43 -0
- package/lib/commonjs/RTCSessionDescription.js.map +1 -0
- package/lib/commonjs/RTCUtil.js +218 -0
- package/lib/commonjs/RTCUtil.js.map +1 -0
- package/lib/commonjs/RTCView.js +68 -0
- package/lib/commonjs/RTCView.js.map +1 -0
- package/lib/commonjs/ScreenCapturePickerView.js +13 -0
- package/lib/commonjs/ScreenCapturePickerView.js.map +1 -0
- package/lib/commonjs/getDisplayMedia.js +39 -0
- package/lib/commonjs/getDisplayMedia.js.map +1 -0
- package/lib/commonjs/getUserMedia.js +122 -0
- package/lib/commonjs/getUserMedia.js.map +1 -0
- package/lib/commonjs/index.js +101 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/typings.d.js +2 -0
- package/lib/commonjs/typings.d.js.map +1 -0
- package/lib/module/EventEmitter.js +7 -0
- package/lib/module/EventEmitter.js.map +1 -0
- package/lib/module/MediaDevices.js +46 -0
- package/lib/module/MediaDevices.js.map +1 -0
- package/lib/module/MediaStream.js +142 -0
- package/lib/module/MediaStream.js.map +1 -0
- package/lib/module/MediaStreamError.js +17 -0
- package/lib/module/MediaStreamError.js.map +1 -0
- package/lib/module/MediaStreamErrorEvent.js +14 -0
- package/lib/module/MediaStreamErrorEvent.js.map +1 -0
- package/lib/module/MediaStreamEvent.js +14 -0
- package/lib/module/MediaStreamEvent.js.map +1 -0
- package/lib/module/MediaStreamTrack.js +116 -0
- package/lib/module/MediaStreamTrack.js.map +1 -0
- package/lib/module/MediaStreamTrackEvent.js +14 -0
- package/lib/module/MediaStreamTrackEvent.js.map +1 -0
- package/lib/module/MessageEvent.js +14 -0
- package/lib/module/MessageEvent.js.map +1 -0
- package/lib/module/Permissions.js +115 -0
- package/lib/module/Permissions.js.map +1 -0
- package/lib/module/RTCDataChannel.js +176 -0
- package/lib/module/RTCDataChannel.js.map +1 -0
- package/lib/module/RTCDataChannelEvent.js +14 -0
- package/lib/module/RTCDataChannelEvent.js.map +1 -0
- package/lib/module/RTCEvent.js +11 -0
- package/lib/module/RTCEvent.js.map +1 -0
- package/lib/module/RTCIceCandidate.js +25 -0
- package/lib/module/RTCIceCandidate.js.map +1 -0
- package/lib/module/RTCIceCandidateEvent.js +16 -0
- package/lib/module/RTCIceCandidateEvent.js.map +1 -0
- package/lib/module/RTCPeerConnection.js +342 -0
- package/lib/module/RTCPeerConnection.js.map +1 -0
- package/lib/module/RTCSessionDescription.js +34 -0
- package/lib/module/RTCSessionDescription.js.map +1 -0
- package/lib/module/RTCUtil.js +207 -0
- package/lib/module/RTCUtil.js.map +1 -0
- package/lib/module/RTCView.js +59 -0
- package/lib/module/RTCView.js.map +1 -0
- package/lib/module/ScreenCapturePickerView.js +3 -0
- package/lib/module/ScreenCapturePickerView.js.map +1 -0
- package/lib/module/getDisplayMedia.js +26 -0
- package/lib/module/getDisplayMedia.js.map +1 -0
- package/lib/module/getUserMedia.js +103 -0
- package/lib/module/getUserMedia.js.map +1 -0
- package/lib/module/index.js +31 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/typings.d.js +2 -0
- package/lib/module/typings.d.js.map +1 -0
- package/lib/typescript/EventEmitter.d.ts +3 -0
- package/lib/typescript/MediaDevices.d.ts +27 -0
- package/lib/typescript/MediaStream.d.ts +39 -0
- package/lib/typescript/MediaStreamError.d.ts +6 -0
- package/lib/typescript/MediaStreamErrorEvent.d.ts +6 -0
- package/lib/typescript/MediaStreamEvent.d.ts +8 -0
- package/lib/typescript/MediaStreamTrack.d.ts +34 -0
- package/lib/typescript/MediaStreamTrackEvent.d.ts +8 -0
- package/lib/typescript/MessageEvent.d.ts +9 -0
- package/lib/typescript/Permissions.d.ts +55 -0
- package/lib/typescript/RTCDataChannel.d.ts +33 -0
- package/lib/typescript/RTCDataChannelEvent.d.ts +8 -0
- package/lib/typescript/RTCEvent.d.ts +4 -0
- package/lib/typescript/RTCIceCandidate.d.ts +11 -0
- package/lib/typescript/RTCIceCandidateEvent.d.ts +6 -0
- package/lib/typescript/RTCPeerConnection.d.ts +58 -0
- package/lib/typescript/RTCSessionDescription.d.ts +14 -0
- package/lib/typescript/RTCUtil.d.ts +28 -0
- package/lib/typescript/RTCView.d.ts +53 -0
- package/lib/typescript/ScreenCapturePickerView.d.ts +2 -0
- package/lib/typescript/getDisplayMedia.d.ts +1 -0
- package/lib/typescript/getUserMedia.d.ts +6 -0
- package/lib/typescript/index.d.ts +11 -0
- package/package.json +24 -8
- package/src/{EventEmitter.js → EventEmitter.ts} +0 -0
- package/src/{MediaDevices.js → MediaDevices.ts} +2 -3
- package/src/{MediaStream.js → MediaStream.ts} +1 -1
- package/src/{MediaStreamError.js → MediaStreamError.ts} +2 -2
- package/src/{MediaStreamErrorEvent.js → MediaStreamErrorEvent.ts} +1 -1
- package/src/{MediaStreamEvent.js → MediaStreamEvent.ts} +2 -2
- package/src/{MediaStreamTrack.js → MediaStreamTrack.ts} +9 -7
- package/src/{MediaStreamTrackEvent.js → MediaStreamTrackEvent.ts} +2 -2
- package/src/MessageEvent.ts +11 -0
- package/src/{Permissions.js → Permissions.ts} +6 -6
- package/src/{RTCDataChannel.js → RTCDataChannel.ts} +12 -8
- package/src/{RTCDataChannelEvent.js → RTCDataChannelEvent.ts} +2 -2
- package/src/{RTCEvent.js → RTCEvent.ts} +1 -2
- package/src/{RTCIceCandidate.js → RTCIceCandidate.ts} +0 -0
- package/src/{RTCIceCandidateEvent.js → RTCIceCandidateEvent.ts} +2 -6
- package/src/{RTCPeerConnection.js → RTCPeerConnection.ts} +28 -19
- package/src/{RTCSessionDescription.js → RTCSessionDescription.ts} +6 -3
- package/src/{RTCUtil.js → RTCUtil.ts} +5 -1
- package/src/{RTCView.js → RTCView.ts} +0 -0
- package/src/{ScreenCapturePickerView.js → ScreenCapturePickerView.ts} +0 -0
- package/src/{getDisplayMedia.js → getDisplayMedia.ts} +0 -0
- package/src/{getUserMedia.js → getUserMedia.ts} +7 -2
- package/src/{index.js → index.ts} +6 -7
- package/src/typings.d.ts +1 -0
- package/tools/build-webrtc.py +25 -19
- package/tsconfig.json +14 -0
- package/src/MessageEvent.js +0 -10
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.deepClone = deepClone;
|
|
7
|
+
exports.normalizeConstraints = normalizeConstraints;
|
|
8
|
+
exports.normalizeOfferAnswerOptions = normalizeOfferAnswerOptions;
|
|
9
|
+
exports.uniqueID = uniqueID;
|
|
10
|
+
const DEFAULT_AUDIO_CONSTRAINTS = {};
|
|
11
|
+
const DEFAULT_VIDEO_CONSTRAINTS = {
|
|
12
|
+
facingMode: 'user',
|
|
13
|
+
frameRate: 30,
|
|
14
|
+
height: 720,
|
|
15
|
+
width: 1280
|
|
16
|
+
};
|
|
17
|
+
const ASPECT_RATIO = 16 / 9;
|
|
18
|
+
const STANDARD_OA_OPTIONS = {
|
|
19
|
+
icerestart: 'IceRestart',
|
|
20
|
+
offertoreceiveaudio: 'OfferToReceiveAudio',
|
|
21
|
+
offertoreceivevideo: 'OfferToReceiveVideo',
|
|
22
|
+
voiceactivitydetection: 'VoiceActivityDetection'
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
function getDefaultMediaConstraints(mediaType) {
|
|
26
|
+
switch (mediaType) {
|
|
27
|
+
case 'audio':
|
|
28
|
+
return DEFAULT_AUDIO_CONSTRAINTS;
|
|
29
|
+
|
|
30
|
+
case 'video':
|
|
31
|
+
return DEFAULT_VIDEO_CONSTRAINTS;
|
|
32
|
+
|
|
33
|
+
default:
|
|
34
|
+
throw new TypeError(`Invalid media type: ${mediaType}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function extractString(constraints, prop) {
|
|
39
|
+
const value = constraints[prop];
|
|
40
|
+
const type = typeof value;
|
|
41
|
+
|
|
42
|
+
if (type === 'object') {
|
|
43
|
+
for (const v of ['exact', 'ideal']) {
|
|
44
|
+
if (value[v]) {
|
|
45
|
+
return value[v];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
} else if (type === 'string') {
|
|
49
|
+
return value;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function extractNumber(constraints, prop) {
|
|
54
|
+
const value = constraints[prop];
|
|
55
|
+
const type = typeof value;
|
|
56
|
+
|
|
57
|
+
if (type === 'number') {
|
|
58
|
+
return Number.parseInt(value);
|
|
59
|
+
} else if (type === 'object') {
|
|
60
|
+
for (const v of ['exact', 'ideal', 'min', 'max']) {
|
|
61
|
+
if (value[v]) {
|
|
62
|
+
return Number.parseInt(value[v]);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function normalizeMediaConstraints(constraints, mediaType) {
|
|
69
|
+
switch (mediaType) {
|
|
70
|
+
case 'audio':
|
|
71
|
+
return constraints;
|
|
72
|
+
|
|
73
|
+
case 'video':
|
|
74
|
+
{
|
|
75
|
+
let c;
|
|
76
|
+
|
|
77
|
+
if (constraints.mandatory) {
|
|
78
|
+
// Old style.
|
|
79
|
+
c = {
|
|
80
|
+
deviceId: extractString(constraints.optional || {}, 'sourceId'),
|
|
81
|
+
facingMode: extractString(constraints, 'facingMode'),
|
|
82
|
+
frameRate: extractNumber(constraints.mandatory, 'minFrameRate'),
|
|
83
|
+
height: extractNumber(constraints.mandatory, 'minHeight'),
|
|
84
|
+
width: extractNumber(constraints.mandatory, 'minWidth')
|
|
85
|
+
};
|
|
86
|
+
} else {
|
|
87
|
+
// New style.
|
|
88
|
+
c = {
|
|
89
|
+
deviceId: extractString(constraints, 'deviceId'),
|
|
90
|
+
facingMode: extractString(constraints, 'facingMode'),
|
|
91
|
+
frameRate: extractNumber(constraints, 'frameRate'),
|
|
92
|
+
height: extractNumber(constraints, 'height'),
|
|
93
|
+
width: extractNumber(constraints, 'width')
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (!c.deviceId) {
|
|
98
|
+
delete c.deviceId;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (!c.facingMode || c.facingMode !== 'user' && c.facingMode !== 'environment') {
|
|
102
|
+
c.facingMode = DEFAULT_VIDEO_CONSTRAINTS.facingMode;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (!c.frameRate) {
|
|
106
|
+
c.frameRate = DEFAULT_VIDEO_CONSTRAINTS.frameRate;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (!c.height && !c.width) {
|
|
110
|
+
c.height = DEFAULT_VIDEO_CONSTRAINTS.height;
|
|
111
|
+
c.width = DEFAULT_VIDEO_CONSTRAINTS.width;
|
|
112
|
+
} else if (!c.height) {
|
|
113
|
+
c.height = Math.round(c.width / ASPECT_RATIO);
|
|
114
|
+
} else if (!c.width) {
|
|
115
|
+
c.width = Math.round(c.height * ASPECT_RATIO);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return c;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
default:
|
|
122
|
+
throw new TypeError(`Invalid media type: ${mediaType}`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Utility for creating short random strings from float point values.
|
|
127
|
+
* We take 4 characters from the end after converting to a string.
|
|
128
|
+
* Conversion to string gives us some letters as we don't want just numbers.
|
|
129
|
+
* Should be suitable to pass for enough randomness.
|
|
130
|
+
*
|
|
131
|
+
* @return {String} 4 random characters
|
|
132
|
+
*/
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
function chr4() {
|
|
136
|
+
return Math.random().toString(16).slice(-4);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Put together a random string in UUIDv4 format {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
|
|
140
|
+
*
|
|
141
|
+
* @return {String} uuidv4
|
|
142
|
+
*/
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
function uniqueID() {
|
|
146
|
+
return `${chr4()}${chr4()}-${chr4()}-${chr4()}-${chr4()}-${chr4()}${chr4()}${chr4()}`;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Utility for deep cloning an object. Object.assign() only does a shallow copy.
|
|
150
|
+
*
|
|
151
|
+
* @param {Object} obj - object to be cloned
|
|
152
|
+
* @return {Object} cloned obj
|
|
153
|
+
*/
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
function deepClone(obj) {
|
|
157
|
+
return JSON.parse(JSON.stringify(obj));
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Normalize options passed to createOffer() / createAnswer().
|
|
162
|
+
*
|
|
163
|
+
* @param {Object} options - user supplied options
|
|
164
|
+
* @return {Object} newOptions - normalized options
|
|
165
|
+
*/
|
|
166
|
+
function normalizeOfferAnswerOptions() {
|
|
167
|
+
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
168
|
+
const newOptions = {};
|
|
169
|
+
|
|
170
|
+
if (!options) {
|
|
171
|
+
return newOptions;
|
|
172
|
+
} // Support legacy constraints.
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
if (options.mandatory) {
|
|
176
|
+
options = options.mandatory;
|
|
177
|
+
} // Convert standard options into WebRTC internal constant names.
|
|
178
|
+
// See: https://github.com/jitsi/webrtc/blob/0cd6ce4de669bed94ba47b88cb71b9be0341bb81/sdk/media_constraints.cc#L113
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
for (const [key, value] of Object.entries(options)) {
|
|
182
|
+
const newKey = STANDARD_OA_OPTIONS[key.toLowerCase()];
|
|
183
|
+
|
|
184
|
+
if (newKey) {
|
|
185
|
+
newOptions[newKey] = String(Boolean(value));
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return newOptions;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Normalize the given constraints in something we can work with.
|
|
193
|
+
*/
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
function normalizeConstraints(constraints) {
|
|
197
|
+
const c = deepClone(constraints);
|
|
198
|
+
|
|
199
|
+
for (const mediaType of ['audio', 'video']) {
|
|
200
|
+
const mediaTypeConstraints = c[mediaType];
|
|
201
|
+
const typeofMediaTypeConstraints = typeof mediaTypeConstraints;
|
|
202
|
+
|
|
203
|
+
if (typeofMediaTypeConstraints !== 'undefined') {
|
|
204
|
+
if (typeofMediaTypeConstraints === 'boolean') {
|
|
205
|
+
if (mediaTypeConstraints) {
|
|
206
|
+
c[mediaType] = getDefaultMediaConstraints(mediaType);
|
|
207
|
+
}
|
|
208
|
+
} else if (typeofMediaTypeConstraints === 'object') {
|
|
209
|
+
c[mediaType] = normalizeMediaConstraints(mediaTypeConstraints, mediaType);
|
|
210
|
+
} else {
|
|
211
|
+
throw new TypeError(`constraints.${mediaType} is neither a boolean nor a dictionary`);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
return c;
|
|
217
|
+
}
|
|
218
|
+
//# sourceMappingURL=RTCUtil.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["RTCUtil.ts"],"names":["DEFAULT_AUDIO_CONSTRAINTS","DEFAULT_VIDEO_CONSTRAINTS","facingMode","frameRate","height","width","ASPECT_RATIO","STANDARD_OA_OPTIONS","icerestart","offertoreceiveaudio","offertoreceivevideo","voiceactivitydetection","getDefaultMediaConstraints","mediaType","TypeError","extractString","constraints","prop","value","type","v","extractNumber","Number","parseInt","normalizeMediaConstraints","c","mandatory","deviceId","optional","Math","round","chr4","random","toString","slice","uniqueID","deepClone","obj","JSON","parse","stringify","normalizeOfferAnswerOptions","options","newOptions","key","Object","entries","newKey","toLowerCase","String","Boolean","normalizeConstraints","mediaTypeConstraints","typeofMediaTypeConstraints"],"mappings":";;;;;;;;;AACA,MAAMA,yBAAyB,GAAG,EAAlC;AAEA,MAAMC,yBAAyB,GAAG;AAC9BC,EAAAA,UAAU,EAAE,MADkB;AAE9BC,EAAAA,SAAS,EAAE,EAFmB;AAG9BC,EAAAA,MAAM,EAAE,GAHsB;AAI9BC,EAAAA,KAAK,EAAE;AAJuB,CAAlC;AAOA,MAAMC,YAAY,GAAG,KAAK,CAA1B;AAEA,MAAMC,mBAAmB,GAAG;AACxBC,EAAAA,UAAU,EAAE,YADY;AAExBC,EAAAA,mBAAmB,EAAE,qBAFG;AAGxBC,EAAAA,mBAAmB,EAAE,qBAHG;AAIxBC,EAAAA,sBAAsB,EAAE;AAJA,CAA5B;;AAOA,SAASC,0BAAT,CAAoCC,SAApC,EAA+C;AAC3C,UAAQA,SAAR;AACI,SAAK,OAAL;AACI,aAAOb,yBAAP;;AACJ,SAAK,OAAL;AACI,aAAOC,yBAAP;;AACJ;AACI,YAAM,IAAIa,SAAJ,CAAe,uBAAsBD,SAAU,EAA/C,CAAN;AANR;AAQH;;AAED,SAASE,aAAT,CAAuBC,WAAvB,EAAoCC,IAApC,EAA0C;AACtC,QAAMC,KAAK,GAAGF,WAAW,CAACC,IAAD,CAAzB;AACA,QAAME,IAAI,GAAG,OAAOD,KAApB;;AAEA,MAAIC,IAAI,KAAK,QAAb,EAAuB;AACnB,SAAK,MAAMC,CAAX,IAAgB,CAAC,OAAD,EAAU,OAAV,CAAhB,EAAo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OAAP,CAAeJ,OAAf,CAA3B,EAAoD;AAChD,UAAMK,MAAM,GAAGxC,mBAAmB,CAACqC,GAAG,CAACI,WAAJ,EAAD,CAAlC;;AACA,QAAID,MAAJ,EAAY;AACRJ,MAAAA,UAAU,CAACI,MAAD,CAAV,GAAqBE,MAAM,CAACC,OAAO,CAAChC,KAAD,CAAR,CAA3B;AACH;AACJ;;AAED,SAAOyB,UAAP;AACH;AAED;AACA;AACA;;;AACO,SAASQ,oBAAT,CAA8BnC,WAA9B,EAA2C;AAC9C,QAAMS,CAAC,GAAGW,SAAS,CAACpB,WAAD,CAAnB;;AAEA,OAAK,MAAMH,SAAX,IAAwB,CAAC,OAAD,EAAU,OAAV,CAAxB,EAA4C;AACxC,UAAMuC,oBAAoB,GAAG3B,CAAC,CAACZ,SAAD,CAA9B;AACA,UAAMwC,0BAA0B,GAAG,OAAOD,oBAA1C;;AAEA,QAAIC,0BAA0B,KAAK,WAAnC,EAAgD;AAC5C,UAAIA,0BAA0B,KAAK,SAAnC,EAA8C;AAC1C,YAAID,oBAAJ,EAA0B;AACtB3B,UAAAA,CAAC,CAACZ,SAAD,CAAD,GAAeD,0BAA0B,CAACC,SAAD,CAAzC;AACH;AACJ,OAJD,MAIO,IAAIwC,0BAA0B,KAAK,QAAnC,EAA6C;AAChD5B,QAAAA,CAAC,CAACZ,SAAD,CAAD,GAAeW,yBAAyB,CAAC4B,oBAAD,EAAuBvC,SAAvB,CAAxC;AACH,OAFM,MAEA;AACH,cAAM,IAAIC,SAAJ,CAAe,eAAcD,SAAU,wCAAvC,CAAN;AACH;AACJ;AACJ;;AAED,SAAOY,CAAP;AACH","sourcesContent":["\nconst DEFAULT_AUDIO_CONSTRAINTS = {};\n\nconst DEFAULT_VIDEO_CONSTRAINTS = {\n facingMode: 'user',\n frameRate: 30,\n height: 720,\n width: 1280\n};\n\nconst ASPECT_RATIO = 16 / 9;\n\nconst STANDARD_OA_OPTIONS = {\n icerestart: 'IceRestart',\n offertoreceiveaudio: 'OfferToReceiveAudio',\n offertoreceivevideo: 'OfferToReceiveVideo',\n voiceactivitydetection: 'VoiceActivityDetection'\n};\n\nfunction getDefaultMediaConstraints(mediaType) {\n switch (mediaType) {\n case 'audio':\n return DEFAULT_AUDIO_CONSTRAINTS;\n case 'video':\n return DEFAULT_VIDEO_CONSTRAINTS;\n default:\n throw new TypeError(`Invalid media type: ${mediaType}`);\n }\n}\n\nfunction extractString(constraints, prop) {\n const value = constraints[prop];\n const type = typeof value;\n\n if (type === 'object') {\n for (const v of ['exact', 'ideal']) {\n if (value[v]) {\n return value[v];\n }\n }\n } else if (type === 'string') {\n return value;\n }\n}\n\nfunction extractNumber(constraints, prop) {\n const value = constraints[prop];\n const type = typeof value;\n\n if (type === 'number') {\n return Number.parseInt(value);\n } else if (type === 'object') {\n for (const v of ['exact', 'ideal', 'min', 'max']) {\n if (value[v]) {\n return Number.parseInt(value[v]);\n }\n }\n }\n}\n\nfunction normalizeMediaConstraints(constraints, mediaType) {\n switch (mediaType) {\n case 'audio':\n return constraints;\n case 'video': {\n let c;\n if (constraints.mandatory) {\n // Old style.\n c = {\n deviceId: extractString(constraints.optional || {}, 'sourceId'),\n facingMode: extractString(constraints, 'facingMode'),\n frameRate: extractNumber(constraints.mandatory, 'minFrameRate'),\n height: extractNumber(constraints.mandatory, 'minHeight'),\n width: extractNumber(constraints.mandatory, 'minWidth')\n };\n } else {\n // New style.\n c = {\n deviceId: extractString(constraints, 'deviceId'),\n facingMode: extractString(constraints, 'facingMode'),\n frameRate: extractNumber(constraints, 'frameRate'),\n height: extractNumber(constraints, 'height'),\n width: extractNumber(constraints, 'width')\n };\n }\n\n if (!c.deviceId) {\n delete c.deviceId;\n }\n\n if (!c.facingMode || (c.facingMode !== 'user' && c.facingMode !== 'environment')) {\n c.facingMode = DEFAULT_VIDEO_CONSTRAINTS.facingMode;\n }\n\n if (!c.frameRate) {\n c.frameRate = DEFAULT_VIDEO_CONSTRAINTS.frameRate;\n }\n\n if (!c.height && !c.width) {\n c.height = DEFAULT_VIDEO_CONSTRAINTS.height;\n c.width = DEFAULT_VIDEO_CONSTRAINTS.width;\n } else if (!c.height) {\n c.height = Math.round(c.width / ASPECT_RATIO);\n } else if (!c.width) {\n c.width = Math.round(c.height * ASPECT_RATIO);\n }\n\n return c;\n }\n default:\n throw new TypeError(`Invalid media type: ${mediaType}`);\n }\n}\n\n/**\n * Utility for creating short random strings from float point values.\n * We take 4 characters from the end after converting to a string.\n * Conversion to string gives us some letters as we don't want just numbers.\n * Should be suitable to pass for enough randomness.\n *\n * @return {String} 4 random characters\n */\nfunction chr4() {\n return Math.random().toString(16).slice(-4);\n}\n\n/**\n * Put together a random string in UUIDv4 format {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}\n *\n * @return {String} uuidv4\n */\nexport function uniqueID() {\n return `${chr4()}${chr4()}-${chr4()}-${chr4()}-${chr4()}-${chr4()}${chr4()}${chr4()}`;\n}\n\n/**\n * Utility for deep cloning an object. Object.assign() only does a shallow copy.\n *\n * @param {Object} obj - object to be cloned\n * @return {Object} cloned obj\n */\nexport function deepClone(obj) {\n return JSON.parse(JSON.stringify(obj));\n}\n\ninterface Constraints {\n mandatory?: object;\n}\n\n/**\n * Normalize options passed to createOffer() / createAnswer().\n *\n * @param {Object} options - user supplied options\n * @return {Object} newOptions - normalized options\n */\nexport function normalizeOfferAnswerOptions(options: Constraints = {}) {\n const newOptions = {};\n\n if (!options) {\n return newOptions;\n }\n\n // Support legacy constraints.\n if (options.mandatory) {\n options = options.mandatory;\n }\n\n // Convert standard options into WebRTC internal constant names.\n // See: https://github.com/jitsi/webrtc/blob/0cd6ce4de669bed94ba47b88cb71b9be0341bb81/sdk/media_constraints.cc#L113\n for (const [key, value] of Object.entries(options)) {\n const newKey = STANDARD_OA_OPTIONS[key.toLowerCase()];\n if (newKey) {\n newOptions[newKey] = String(Boolean(value));\n }\n }\n\n return newOptions;\n}\n\n/**\n * Normalize the given constraints in something we can work with.\n */\nexport function normalizeConstraints(constraints) {\n const c = deepClone(constraints);\n\n for (const mediaType of ['audio', 'video']) {\n const mediaTypeConstraints = c[mediaType];\n const typeofMediaTypeConstraints = typeof mediaTypeConstraints;\n\n if (typeofMediaTypeConstraints !== 'undefined') {\n if (typeofMediaTypeConstraints === 'boolean') {\n if (mediaTypeConstraints) {\n c[mediaType] = getDefaultMediaConstraints(mediaType);\n }\n } else if (typeofMediaTypeConstraints === 'object') {\n c[mediaType] = normalizeMediaConstraints(mediaTypeConstraints, mediaType);\n } else {\n throw new TypeError(`constraints.${mediaType} is neither a boolean nor a dictionary`);\n }\n }\n }\n\n return c;\n}\n"]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Native prop validation was removed from RN in:
|
|
12
|
+
* https://github.com/facebook/react-native/commit/8dc3ba0444c94d9bbb66295b5af885bff9b9cd34
|
|
13
|
+
*
|
|
14
|
+
* So we list them here for documentation purposes.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Indicates whether the video specified by {@link #streamURL} should be
|
|
19
|
+
* mirrored during rendering. Commonly, applications choose to mirror the
|
|
20
|
+
* user-facing camera.
|
|
21
|
+
*
|
|
22
|
+
* mirror: boolean
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* In the fashion of
|
|
27
|
+
* https://www.w3.org/TR/html5/embedded-content-0.html#dom-video-videowidth
|
|
28
|
+
* and https://www.w3.org/TR/html5/rendering.html#video-object-fit,
|
|
29
|
+
* resembles the CSS style object-fit.
|
|
30
|
+
*
|
|
31
|
+
* objectFit: 'contain' | 'cover'
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* URL / id of the stream that should be rendered.
|
|
36
|
+
*
|
|
37
|
+
* streamURL: string
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Similarly to the CSS property z-index, specifies the z-order of this
|
|
42
|
+
* RTCView in the stacking space of all RTCViews. When RTCViews overlap,
|
|
43
|
+
* zOrder determines which one covers the other. An RTCView with a larger
|
|
44
|
+
* zOrder generally covers an RTCView with a lower one.
|
|
45
|
+
*
|
|
46
|
+
* Non-overlapping RTCViews may safely share a z-order (because one does not
|
|
47
|
+
* have to cover the other).
|
|
48
|
+
*
|
|
49
|
+
* The support for zOrder is platform-dependent and/or
|
|
50
|
+
* implementation-specific. Thus, specifying a value for zOrder is to be
|
|
51
|
+
* thought of as giving a hint rather than as imposing a requirement. For
|
|
52
|
+
* example, video renderers such as RTCView are commonly implemented using
|
|
53
|
+
* OpenGL and OpenGL views may have different numbers of layers in their
|
|
54
|
+
* stacking space. Android has three: a layer bellow the window (aka
|
|
55
|
+
* default), a layer bellow the window again but above the previous layer
|
|
56
|
+
* (aka media overlay), and above the window. Consequently, it is advisable
|
|
57
|
+
* to limit the number of utilized layers in the stacking space to the
|
|
58
|
+
* minimum sufficient for the desired display. For example, a video call
|
|
59
|
+
* application usually needs a maximum of two zOrder values: 0 for the
|
|
60
|
+
* remote video(s) which appear in the background, and 1 for the local
|
|
61
|
+
* video(s) which appear above the remote video(s).
|
|
62
|
+
*
|
|
63
|
+
* zOrder: number
|
|
64
|
+
*/
|
|
65
|
+
var _default = (0, _reactNative.requireNativeComponent)('RTCVideoView');
|
|
66
|
+
|
|
67
|
+
exports.default = _default;
|
|
68
|
+
//# sourceMappingURL=RTCView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["RTCView.ts"],"names":[],"mappings":";;;;;;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;eAEe,yCAAuB,cAAvB,C","sourcesContent":["\nimport { requireNativeComponent } from 'react-native';\n\n/**\n * Native prop validation was removed from RN in:\n * https://github.com/facebook/react-native/commit/8dc3ba0444c94d9bbb66295b5af885bff9b9cd34\n *\n * So we list them here for documentation purposes.\n */\n\n/**\n * Indicates whether the video specified by {@link #streamURL} should be\n * mirrored during rendering. Commonly, applications choose to mirror the\n * user-facing camera.\n *\n * mirror: boolean\n */\n\n/**\n * In the fashion of\n * https://www.w3.org/TR/html5/embedded-content-0.html#dom-video-videowidth\n * and https://www.w3.org/TR/html5/rendering.html#video-object-fit,\n * resembles the CSS style object-fit.\n *\n * objectFit: 'contain' | 'cover'\n */\n\n/**\n * URL / id of the stream that should be rendered.\n *\n * streamURL: string\n */\n\n/**\n * Similarly to the CSS property z-index, specifies the z-order of this\n * RTCView in the stacking space of all RTCViews. When RTCViews overlap,\n * zOrder determines which one covers the other. An RTCView with a larger\n * zOrder generally covers an RTCView with a lower one.\n *\n * Non-overlapping RTCViews may safely share a z-order (because one does not\n * have to cover the other).\n *\n * The support for zOrder is platform-dependent and/or\n * implementation-specific. Thus, specifying a value for zOrder is to be\n * thought of as giving a hint rather than as imposing a requirement. For\n * example, video renderers such as RTCView are commonly implemented using\n * OpenGL and OpenGL views may have different numbers of layers in their\n * stacking space. Android has three: a layer bellow the window (aka\n * default), a layer bellow the window again but above the previous layer\n * (aka media overlay), and above the window. Consequently, it is advisable\n * to limit the number of utilized layers in the stacking space to the\n * minimum sufficient for the desired display. For example, a video call\n * application usually needs a maximum of two zOrder values: 0 for the\n * remote video(s) which appear in the background, and 1 for the local\n * video(s) which appear above the remote video(s).\n *\n * zOrder: number\n */\n\nexport default requireNativeComponent('RTCVideoView');\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
|
|
10
|
+
var _default = (0, _reactNative.requireNativeComponent)('ScreenCapturePickerView');
|
|
11
|
+
|
|
12
|
+
exports.default = _default;
|
|
13
|
+
//# sourceMappingURL=ScreenCapturePickerView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["ScreenCapturePickerView.ts"],"names":[],"mappings":";;;;;;;AACA;;eAEe,yCAAuB,yBAAvB,C","sourcesContent":["\nimport { requireNativeComponent } from 'react-native';\n\nexport default requireNativeComponent('ScreenCapturePickerView');\n"]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = getDisplayMedia;
|
|
7
|
+
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
|
|
10
|
+
var _MediaStream = _interopRequireDefault(require("./MediaStream"));
|
|
11
|
+
|
|
12
|
+
var _MediaStreamError = _interopRequireDefault(require("./MediaStreamError"));
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
const {
|
|
17
|
+
WebRTCModule
|
|
18
|
+
} = _reactNative.NativeModules;
|
|
19
|
+
|
|
20
|
+
function getDisplayMedia() {
|
|
21
|
+
return new Promise((resolve, reject) => {
|
|
22
|
+
WebRTCModule.getDisplayMedia().then(data => {
|
|
23
|
+
const {
|
|
24
|
+
streamId,
|
|
25
|
+
track
|
|
26
|
+
} = data;
|
|
27
|
+
const info = {
|
|
28
|
+
streamId: streamId,
|
|
29
|
+
streamReactTag: streamId,
|
|
30
|
+
tracks: [track]
|
|
31
|
+
};
|
|
32
|
+
const stream = new _MediaStream.default(info);
|
|
33
|
+
resolve(stream);
|
|
34
|
+
}, error => {
|
|
35
|
+
reject(new _MediaStreamError.default(error));
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=getDisplayMedia.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["getDisplayMedia.ts"],"names":["WebRTCModule","NativeModules","getDisplayMedia","Promise","resolve","reject","then","data","streamId","track","info","streamReactTag","tracks","stream","MediaStream","error","MediaStreamError"],"mappings":";;;;;;;AACA;;AAEA;;AACA;;;;AAEA,MAAM;AAAEA,EAAAA;AAAF,IAAmBC,0BAAzB;;AAEe,SAASC,eAAT,GAA2B;AACtC,SAAO,IAAIC,OAAJ,CAAY,CAACC,OAAD,EAAUC,MAAV,KAAqB;AACpCL,IAAAA,YAAY,CAACE,eAAb,GAA+BI,IAA/B,CACIC,IAAI,IAAI;AACJ,YAAM;AAAEC,QAAAA,QAAF;AAAYC,QAAAA;AAAZ,UAAsBF,IAA5B;AAEA,YAAMG,IAAI,GAAG;AACTF,QAAAA,QAAQ,EAAEA,QADD;AAETG,QAAAA,cAAc,EAAEH,QAFP;AAGTI,QAAAA,MAAM,EAAE,CAACH,KAAD;AAHC,OAAb;AAMA,YAAMI,MAAM,GAAG,IAAIC,oBAAJ,CAAgBJ,IAAhB,CAAf;AAEAN,MAAAA,OAAO,CAACS,MAAD,CAAP;AACH,KAbL,EAcIE,KAAK,IAAI;AACLV,MAAAA,MAAM,CAAC,IAAIW,yBAAJ,CAAqBD,KAArB,CAAD,CAAN;AACH,KAhBL;AAkBH,GAnBM,CAAP;AAoBH","sourcesContent":["\nimport { NativeModules } from 'react-native';\n\nimport MediaStream from './MediaStream';\nimport MediaStreamError from './MediaStreamError';\n\nconst { WebRTCModule } = NativeModules;\n\nexport default function getDisplayMedia() {\n return new Promise((resolve, reject) => {\n WebRTCModule.getDisplayMedia().then(\n data => {\n const { streamId, track } = data;\n\n const info = {\n streamId: streamId,\n streamReactTag: streamId,\n tracks: [track]\n };\n\n const stream = new MediaStream(info);\n\n resolve(stream);\n },\n error => {\n reject(new MediaStreamError(error));\n }\n );\n });\n}\n"]}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = getUserMedia;
|
|
7
|
+
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
|
|
10
|
+
var RTCUtil = _interopRequireWildcard(require("./RTCUtil"));
|
|
11
|
+
|
|
12
|
+
var _MediaStream = _interopRequireDefault(require("./MediaStream"));
|
|
13
|
+
|
|
14
|
+
var _MediaStreamError = _interopRequireDefault(require("./MediaStreamError"));
|
|
15
|
+
|
|
16
|
+
var _Permissions = _interopRequireDefault(require("./Permissions"));
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
20
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
|
+
|
|
22
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
+
|
|
24
|
+
const {
|
|
25
|
+
WebRTCModule
|
|
26
|
+
} = _reactNative.NativeModules;
|
|
27
|
+
|
|
28
|
+
function getUserMedia() {
|
|
29
|
+
let constraints = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
30
|
+
|
|
31
|
+
// According to
|
|
32
|
+
// https://www.w3.org/TR/mediacapture-streams/#dom-mediadevices-getusermedia,
|
|
33
|
+
// the constraints argument is a dictionary of type MediaStreamConstraints.
|
|
34
|
+
if (typeof constraints !== 'object') {
|
|
35
|
+
return Promise.reject(new TypeError('constraints is not a dictionary'));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if ((typeof constraints.audio === 'undefined' || !constraints.audio) && (typeof constraints.video === 'undefined' || !constraints.video)) {
|
|
39
|
+
return Promise.reject(new TypeError('audio and/or video is required'));
|
|
40
|
+
} // Normalize constraints.
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
constraints = RTCUtil.normalizeConstraints(constraints); // Request required permissions
|
|
44
|
+
|
|
45
|
+
const reqPermissions = [];
|
|
46
|
+
|
|
47
|
+
if (constraints.audio) {
|
|
48
|
+
reqPermissions.push(_Permissions.default.request({
|
|
49
|
+
name: 'microphone'
|
|
50
|
+
}));
|
|
51
|
+
} else {
|
|
52
|
+
reqPermissions.push(Promise.resolve(false));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (constraints.video) {
|
|
56
|
+
reqPermissions.push(_Permissions.default.request({
|
|
57
|
+
name: 'camera'
|
|
58
|
+
}));
|
|
59
|
+
} else {
|
|
60
|
+
reqPermissions.push(Promise.resolve(false));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return new Promise((resolve, reject) => {
|
|
64
|
+
Promise.all(reqPermissions).then(results => {
|
|
65
|
+
const [audioPerm, videoPerm] = results; // Check permission results and remove unneeded permissions.
|
|
66
|
+
|
|
67
|
+
if (!audioPerm && !videoPerm) {
|
|
68
|
+
// https://www.w3.org/TR/mediacapture-streams/#dom-mediadevices-getusermedia
|
|
69
|
+
// step 4
|
|
70
|
+
const error = {
|
|
71
|
+
message: 'Permission denied.',
|
|
72
|
+
name: 'SecurityError'
|
|
73
|
+
};
|
|
74
|
+
reject(new _MediaStreamError.default(error));
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
audioPerm || delete constraints.audio;
|
|
79
|
+
videoPerm || delete constraints.video;
|
|
80
|
+
|
|
81
|
+
const success = (id, tracks) => {
|
|
82
|
+
// Store initial constraints.
|
|
83
|
+
for (const trackInfo of tracks) {
|
|
84
|
+
const c = constraints[trackInfo.kind];
|
|
85
|
+
|
|
86
|
+
if (typeof c === 'object') {
|
|
87
|
+
trackInfo.constraints = RTCUtil.deepClone(c);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const info = {
|
|
92
|
+
streamId: id,
|
|
93
|
+
streamReactTag: id,
|
|
94
|
+
tracks
|
|
95
|
+
};
|
|
96
|
+
resolve(new _MediaStream.default(info));
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const failure = (type, message) => {
|
|
100
|
+
let error;
|
|
101
|
+
|
|
102
|
+
switch (type) {
|
|
103
|
+
case 'TypeError':
|
|
104
|
+
error = new TypeError(message);
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (!error) {
|
|
109
|
+
error = new _MediaStreamError.default({
|
|
110
|
+
message,
|
|
111
|
+
name: type
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
reject(error);
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
WebRTCModule.getUserMedia(constraints, success, failure);
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=getUserMedia.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["getUserMedia.ts"],"names":["WebRTCModule","NativeModules","getUserMedia","constraints","Promise","reject","TypeError","audio","video","RTCUtil","normalizeConstraints","reqPermissions","push","permissions","request","name","resolve","all","then","results","audioPerm","videoPerm","error","message","MediaStreamError","success","id","tracks","trackInfo","c","kind","deepClone","info","streamId","streamReactTag","MediaStream","failure","type"],"mappings":";;;;;;;AACA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;AAEA,MAAM;AAAEA,EAAAA;AAAF,IAAmBC,0BAAzB;;AAOe,SAASC,YAAT,GAAqD;AAAA,MAA/BC,WAA+B,uEAAJ,EAAI;;AAChE;AACA;AACA;AACA,MAAI,OAAOA,WAAP,KAAuB,QAA3B,EAAqC;AACjC,WAAOC,OAAO,CAACC,MAAR,CAAe,IAAIC,SAAJ,CAAc,iCAAd,CAAf,CAAP;AACH;;AAED,MACI,CAAC,OAAOH,WAAW,CAACI,KAAnB,KAA6B,WAA7B,IAA4C,CAACJ,WAAW,CAACI,KAA1D,MACC,OAAOJ,WAAW,CAACK,KAAnB,KAA6B,WAA7B,IAA4C,CAACL,WAAW,CAACK,KAD1D,CADJ,EAGE;AACE,WAAOJ,OAAO,CAACC,MAAR,CAAe,IAAIC,SAAJ,CAAc,gCAAd,CAAf,CAAP;AACH,GAb+D,CAehE;;;AACAH,EAAAA,WAAW,GAAGM,OAAO,CAACC,oBAAR,CAA6BP,WAA7B,CAAd,CAhBgE,CAkBhE;;AACA,QAAMQ,cAAuC,GAAG,EAAhD;;AACA,MAAIR,WAAW,CAACI,KAAhB,EAAuB;AACnBI,IAAAA,cAAc,CAACC,IAAf,CAAoBC,qBAAYC,OAAZ,CAAoB;AAAEC,MAAAA,IAAI,EAAE;AAAR,KAApB,CAApB;AACH,GAFD,MAEO;AACHJ,IAAAA,cAAc,CAACC,IAAf,CAAoBR,OAAO,CAACY,OAAR,CAAgB,KAAhB,CAApB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TC,UAAAA;AAHS,SAAb;AAMAX,QAAAA,OAAO,CAAC,IAAImB,oBAAJ,CAAgBH,IAAhB,CAAD,CAAP;AACH,OAhBD;;AAkBA,YAAMI,OAAO,GAAG,CAACC,IAAD,EAAOd,OAAP,KAAmB;AAC/B,YAAID,KAAJ;;AACA,gBAAQe,IAAR;AACI,eAAK,WAAL;AACIf,YAAAA,KAAK,GAAG,IAAIhB,SAAJ,CAAciB,OAAd,CAAR;AACA;AAHR;;AAKA,YAAI,CAACD,KAAL,EAAY;AACRA,UAAAA,KAAK,GAAG,IAAIE,yBAAJ,CAAqB;AAAED,YAAAA,OAAF;AAAWR,YAAAA,IAAI,EAAEsB;AAAjB,WAArB,CAAR;AACH;;AAEDhC,QAAAA,MAAM,CAACiB,KAAD,CAAN;AACH,OAZD;;AAcAtB,MAAAA,YAAY,CAACE,YAAb,CAA0BC,WAA1B,EAAuCsB,OAAvC,EAAgDW,OAAhD;AACH,KArDD;AAsDH,GAvDM,CAAP;AAwDH","sourcesContent":["\nimport { NativeModules } from 'react-native';\nimport * as RTCUtil from './RTCUtil';\n\nimport MediaStream from './MediaStream';\nimport MediaStreamError from './MediaStreamError';\nimport permissions from './Permissions';\n\nconst { WebRTCModule } = NativeModules;\n\ninterface Constraints {\n audio?: boolean | object;\n video?: boolean | object;\n}\n\nexport default function getUserMedia(constraints: Constraints = {}) {\n // According to\n // https://www.w3.org/TR/mediacapture-streams/#dom-mediadevices-getusermedia,\n // the constraints argument is a dictionary of type MediaStreamConstraints.\n if (typeof constraints !== 'object') {\n return Promise.reject(new TypeError('constraints is not a dictionary'));\n }\n\n if (\n (typeof constraints.audio === 'undefined' || !constraints.audio) &&\n (typeof constraints.video === 'undefined' || !constraints.video)\n ) {\n return Promise.reject(new TypeError('audio and/or video is required'));\n }\n\n // Normalize constraints.\n constraints = RTCUtil.normalizeConstraints(constraints);\n\n // Request required permissions\n const reqPermissions: Array<Promise<boolean>> = [];\n if (constraints.audio) {\n reqPermissions.push(permissions.request({ name: 'microphone' }));\n } else {\n reqPermissions.push(Promise.resolve(false));\n }\n if (constraints.video) {\n reqPermissions.push(permissions.request({ name: 'camera' }));\n } else {\n reqPermissions.push(Promise.resolve(false));\n }\n\n return new Promise((resolve, reject) => {\n Promise.all(reqPermissions).then(results => {\n const [audioPerm, videoPerm] = results;\n\n // Check permission results and remove unneeded permissions.\n\n if (!audioPerm && !videoPerm) {\n // https://www.w3.org/TR/mediacapture-streams/#dom-mediadevices-getusermedia\n // step 4\n const error = {\n message: 'Permission denied.',\n name: 'SecurityError'\n };\n reject(new MediaStreamError(error));\n\n return;\n }\n\n audioPerm || delete constraints.audio;\n videoPerm || delete constraints.video;\n\n const success = (id, tracks) => {\n // Store initial constraints.\n for (const trackInfo of tracks) {\n const c = constraints[trackInfo.kind];\n if (typeof c === 'object') {\n trackInfo.constraints = RTCUtil.deepClone(c);\n }\n }\n\n const info = {\n streamId: id,\n streamReactTag: id,\n tracks\n };\n\n resolve(new MediaStream(info));\n };\n\n const failure = (type, message) => {\n let error;\n switch (type) {\n case 'TypeError':\n error = new TypeError(message);\n break;\n }\n if (!error) {\n error = new MediaStreamError({ message, name: type });\n }\n\n reject(error);\n };\n\n WebRTCModule.getUserMedia(constraints, success, failure);\n });\n });\n}\n"]}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "MediaStream", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _MediaStream.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "MediaStreamTrack", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _MediaStreamTrack.default;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "RTCIceCandidate", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _RTCIceCandidate.default;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "RTCPeerConnection", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _RTCPeerConnection.default;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "RTCSessionDescription", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _RTCSessionDescription.default;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "RTCView", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _RTCView.default;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "ScreenCapturePickerView", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _ScreenCapturePickerView.default;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "mediaDevices", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _MediaDevices.default;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "permissions", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _Permissions.default;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
exports.registerGlobals = registerGlobals;
|
|
61
|
+
|
|
62
|
+
var _ScreenCapturePickerView = _interopRequireDefault(require("./ScreenCapturePickerView"));
|
|
63
|
+
|
|
64
|
+
var _RTCPeerConnection = _interopRequireDefault(require("./RTCPeerConnection"));
|
|
65
|
+
|
|
66
|
+
var _RTCIceCandidate = _interopRequireDefault(require("./RTCIceCandidate"));
|
|
67
|
+
|
|
68
|
+
var _RTCSessionDescription = _interopRequireDefault(require("./RTCSessionDescription"));
|
|
69
|
+
|
|
70
|
+
var _RTCView = _interopRequireDefault(require("./RTCView"));
|
|
71
|
+
|
|
72
|
+
var _MediaStream = _interopRequireDefault(require("./MediaStream"));
|
|
73
|
+
|
|
74
|
+
var _MediaStreamTrack = _interopRequireDefault(require("./MediaStreamTrack"));
|
|
75
|
+
|
|
76
|
+
var _MediaDevices = _interopRequireDefault(require("./MediaDevices"));
|
|
77
|
+
|
|
78
|
+
var _Permissions = _interopRequireDefault(require("./Permissions"));
|
|
79
|
+
|
|
80
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
81
|
+
|
|
82
|
+
function registerGlobals() {
|
|
83
|
+
// Should not happen. React Native has a global navigator object.
|
|
84
|
+
if (typeof global.navigator !== 'object') {
|
|
85
|
+
throw new Error('navigator is not an object');
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (!global.navigator.mediaDevices) {
|
|
89
|
+
global.navigator.mediaDevices = {};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
global.navigator.mediaDevices.getUserMedia = _MediaDevices.default.getUserMedia.bind(_MediaDevices.default);
|
|
93
|
+
global.navigator.mediaDevices.getDisplayMedia = _MediaDevices.default.getDisplayMedia.bind(_MediaDevices.default);
|
|
94
|
+
global.navigator.mediaDevices.enumerateDevices = _MediaDevices.default.enumerateDevices.bind(_MediaDevices.default);
|
|
95
|
+
global.RTCPeerConnection = _RTCPeerConnection.default;
|
|
96
|
+
global.RTCIceCandidate = _RTCIceCandidate.default;
|
|
97
|
+
global.RTCSessionDescription = _RTCSessionDescription.default;
|
|
98
|
+
global.MediaStream = _MediaStream.default;
|
|
99
|
+
global.MediaStreamTrack = _MediaStreamTrack.default;
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":["registerGlobals","global","navigator","Error","mediaDevices","getUserMedia","bind","getDisplayMedia","enumerateDevices","RTCPeerConnection","RTCIceCandidate","RTCSessionDescription","MediaStream","MediaStreamTrack"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAeA,SAASA,eAAT,GAA2B;AACvB;AACA,MAAI,OAAOC,MAAM,CAACC,SAAd,KAA4B,QAAhC,EAA0C;AACtC,UAAM,IAAIC,KAAJ,CAAU,4BAAV,CAAN;AACH;;AAED,MAAI,CAACF,MAAM,CAACC,SAAP,CAAiBE,YAAtB,EAAoC;AAChCH,IAAAA,MAAM,CAACC,SAAP,CAAiBE,YAAjB,GAAgC,EAAhC;AACH;;AAEDH,EAAAA,MAAM,CAACC,SAAP,CAAiBE,YAAjB,CAA8BC,YAA9B,GAA6CD,sBAAaC,YAAb,CAA0BC,IAA1B,CAA+BF,qBAA/B,CAA7C;AACAH,EAAAA,MAAM,CAACC,SAAP,CAAiBE,YAAjB,CAA8BG,eAA9B,GAAgDH,sBAAaG,eAAb,CAA6BD,IAA7B,CAAkCF,qBAAlC,CAAhD;AACAH,EAAAA,MAAM,CAACC,SAAP,CAAiBE,YAAjB,CAA8BI,gBAA9B,GAAiDJ,sBAAaI,gBAAb,CAA8BF,IAA9B,CAAmCF,qBAAnC,CAAjD;AAEAH,EAAAA,MAAM,CAACQ,iBAAP,GAA2BA,0BAA3B;AACAR,EAAAA,MAAM,CAACS,eAAP,GAAyBA,wBAAzB;AACAT,EAAAA,MAAM,CAACU,qBAAP,GAA+BA,8BAA/B;AACAV,EAAAA,MAAM,CAACW,WAAP,GAAqBA,oBAArB;AACAX,EAAAA,MAAM,CAACY,gBAAP,GAA0BA,yBAA1B;AACH","sourcesContent":["import ScreenCapturePickerView from './ScreenCapturePickerView';\nimport RTCPeerConnection from './RTCPeerConnection';\nimport RTCIceCandidate from './RTCIceCandidate';\nimport RTCSessionDescription from './RTCSessionDescription';\nimport RTCView from './RTCView';\nimport MediaStream from './MediaStream';\nimport MediaStreamTrack from './MediaStreamTrack';\nimport mediaDevices from './MediaDevices';\nimport permissions from './Permissions';\n\nexport {\n ScreenCapturePickerView,\n RTCPeerConnection,\n RTCIceCandidate,\n RTCSessionDescription,\n RTCView,\n MediaStream,\n MediaStreamTrack,\n mediaDevices,\n permissions,\n registerGlobals\n};\n\nfunction registerGlobals() {\n // Should not happen. React Native has a global navigator object.\n if (typeof global.navigator !== 'object') {\n throw new Error('navigator is not an object');\n }\n\n if (!global.navigator.mediaDevices) {\n global.navigator.mediaDevices = {};\n }\n\n global.navigator.mediaDevices.getUserMedia = mediaDevices.getUserMedia.bind(mediaDevices);\n global.navigator.mediaDevices.getDisplayMedia = mediaDevices.getDisplayMedia.bind(mediaDevices);\n global.navigator.mediaDevices.enumerateDevices = mediaDevices.enumerateDevices.bind(mediaDevices);\n\n global.RTCPeerConnection = RTCPeerConnection;\n global.RTCIceCandidate = RTCIceCandidate;\n global.RTCSessionDescription = RTCSessionDescription;\n global.MediaStream = MediaStream;\n global.MediaStreamTrack = MediaStreamTrack;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["EventEmitter.ts"],"names":["NativeModules","NativeEventEmitter","WebRTCModule","EventEmitter"],"mappings":"AAAA,SAASA,aAAT,EAAwBC,kBAAxB,QAAkD,cAAlD;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAmBF,aAAzB;AAEA,MAAMG,YAAY,GAAG,IAAIF,kBAAJ,CAAuBC,YAAvB,CAArB;AAEA,eAAeC,YAAf","sourcesContent":["import { NativeModules, NativeEventEmitter } from 'react-native';\n\nconst { WebRTCModule } = NativeModules;\n\nconst EventEmitter = new NativeEventEmitter(WebRTCModule);\n\nexport default EventEmitter;\n"]}
|