react-native-webrtc 106.0.0-beta.5 → 106.0.0-beta.7
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 +2 -2
- package/android/src/main/java/com/oney/WebRTCModule/GetUserMediaImpl.java +1 -1
- package/android/src/main/java/com/oney/WebRTCModule/PeerConnectionObserver.java +18 -24
- package/android/src/main/java/com/oney/WebRTCModule/VideoTrackAdapter.java +1 -1
- package/android/src/main/java/com/oney/WebRTCModule/WebRTCModule.java +59 -68
- package/ios/RCTWebRTC/RCTConvert+WebRTC.m +10 -0
- package/ios/RCTWebRTC/SerializeUtils.m +4 -2
- package/ios/RCTWebRTC/WebRTCModule+RTCPeerConnection.m +73 -60
- package/ios/RCTWebRTC/WebRTCModule+Transceivers.m +23 -22
- package/ios/RCTWebRTC/WebRTCModule+VideoTrackAdapter.m +1 -1
- package/ios/RCTWebRTC/WebRTCModule.h +0 -8
- package/ios/RCTWebRTC/WebRTCModule.m +1 -20
- package/lib/commonjs/MediaStreamTrack.js +24 -7
- package/lib/commonjs/MediaStreamTrack.js.map +1 -1
- package/lib/commonjs/RTCIceCandidate.js +14 -4
- package/lib/commonjs/RTCIceCandidate.js.map +1 -1
- package/lib/commonjs/RTCPeerConnection.js +129 -132
- package/lib/commonjs/RTCPeerConnection.js.map +1 -1
- package/lib/commonjs/RTCRtpSender.js +6 -5
- package/lib/commonjs/RTCRtpSender.js.map +1 -1
- package/lib/commonjs/RTCRtpTransceiver.js +11 -49
- package/lib/commonjs/RTCRtpTransceiver.js.map +1 -1
- package/lib/commonjs/RTCView.js +0 -55
- package/lib/commonjs/RTCView.js.map +1 -1
- package/lib/commonjs/index.js +3 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/MediaStreamTrack.js +25 -8
- package/lib/module/MediaStreamTrack.js.map +1 -1
- package/lib/module/RTCIceCandidate.js +14 -4
- package/lib/module/RTCIceCandidate.js.map +1 -1
- package/lib/module/RTCPeerConnection.js +129 -130
- package/lib/module/RTCPeerConnection.js.map +1 -1
- package/lib/module/RTCRtpSender.js +6 -5
- package/lib/module/RTCRtpSender.js.map +1 -1
- package/lib/module/RTCRtpTransceiver.js +11 -44
- package/lib/module/RTCRtpTransceiver.js.map +1 -1
- package/lib/module/RTCView.js +0 -49
- package/lib/module/RTCView.js.map +1 -1
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/MediaStreamTrack.d.ts +11 -3
- package/lib/typescript/RTCIceCandidate.d.ts +5 -1
- package/lib/typescript/RTCPeerConnection.d.ts +5 -5
- package/lib/typescript/RTCRtpTransceiver.d.ts +2 -8
- package/lib/typescript/RTCView.d.ts +53 -46
- package/package.json +2 -2
- package/src/MediaStreamTrack.ts +23 -7
- package/src/RTCIceCandidate.ts +8 -5
- package/src/RTCPeerConnection.ts +133 -126
- package/src/RTCRtpSender.ts +6 -7
- package/src/RTCRtpTransceiver.ts +15 -45
- package/src/RTCView.ts +53 -49
- package/src/index.ts +2 -0
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
import { defineCustomEventTarget } from 'event-target-shim';
|
|
2
1
|
import RTCRtpReceiver from './RTCRtpReceiver';
|
|
3
2
|
import RTCRtpSender from './RTCRtpSender';
|
|
4
|
-
|
|
5
|
-
export default class RTCRtpTransceiver extends RTCRtpTransceiver_base {
|
|
3
|
+
export default class RTCRtpTransceiver {
|
|
6
4
|
_peerConnectionId: number;
|
|
7
5
|
_sender: RTCRtpSender;
|
|
8
6
|
_receiver: RTCRtpReceiver;
|
|
9
|
-
_id: string;
|
|
10
7
|
_mid: string | null;
|
|
11
8
|
_direction: string;
|
|
12
9
|
_currentDirection: string;
|
|
13
10
|
_stopped: boolean;
|
|
14
11
|
constructor(args: {
|
|
15
12
|
peerConnectionId: number;
|
|
16
|
-
id: string;
|
|
17
13
|
isStopped: boolean;
|
|
18
14
|
direction: string;
|
|
19
15
|
currentDirection: string;
|
|
@@ -21,7 +17,6 @@ export default class RTCRtpTransceiver extends RTCRtpTransceiver_base {
|
|
|
21
17
|
sender: RTCRtpSender;
|
|
22
18
|
receiver: RTCRtpReceiver;
|
|
23
19
|
});
|
|
24
|
-
get id(): string;
|
|
25
20
|
get mid(): string | null;
|
|
26
21
|
get stopped(): boolean;
|
|
27
22
|
get direction(): string;
|
|
@@ -30,6 +25,5 @@ export default class RTCRtpTransceiver extends RTCRtpTransceiver_base {
|
|
|
30
25
|
get sender(): RTCRtpSender;
|
|
31
26
|
get receiver(): RTCRtpReceiver;
|
|
32
27
|
stop(): void;
|
|
33
|
-
|
|
28
|
+
_setStopped(): void;
|
|
34
29
|
}
|
|
35
|
-
export {};
|
|
@@ -1,53 +1,60 @@
|
|
|
1
|
-
|
|
1
|
+
import { ViewProps } from 'react-native';
|
|
2
2
|
/**
|
|
3
3
|
* Native prop validation was removed from RN in:
|
|
4
4
|
* https://github.com/facebook/react-native/commit/8dc3ba0444c94d9bbb66295b5af885bff9b9cd34
|
|
5
5
|
*
|
|
6
6
|
* So we list them here for documentation purposes.
|
|
7
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
|
-
|
|
8
|
+
interface RTCVideoViewProps extends ViewProps {
|
|
9
|
+
/**
|
|
10
|
+
* Indicates whether the video specified by {@link #streamURL} should be
|
|
11
|
+
* mirrored during rendering. Commonly, applications choose to mirror the
|
|
12
|
+
* user-facing camera.
|
|
13
|
+
*
|
|
14
|
+
* mirror: boolean
|
|
15
|
+
*/
|
|
16
|
+
mirror?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* In the fashion of
|
|
19
|
+
* https://www.w3.org/TR/html5/embedded-content-0.html#dom-video-videowidth
|
|
20
|
+
* and https://www.w3.org/TR/html5/rendering.html#video-object-fit,
|
|
21
|
+
* resembles the CSS style object-fit.
|
|
22
|
+
*
|
|
23
|
+
* objectFit: 'contain' | 'cover'
|
|
24
|
+
*/
|
|
25
|
+
objectFit?: 'contain' | 'cover';
|
|
26
|
+
/**
|
|
27
|
+
* URL / id of the stream that should be rendered.
|
|
28
|
+
*
|
|
29
|
+
* streamURL: string
|
|
30
|
+
*/
|
|
31
|
+
streamURL: string;
|
|
32
|
+
/**
|
|
33
|
+
* Similarly to the CSS property z-index, specifies the z-order of this
|
|
34
|
+
* RTCView in the stacking space of all RTCViews. When RTCViews overlap,
|
|
35
|
+
* zOrder determines which one covers the other. An RTCView with a larger
|
|
36
|
+
* zOrder generally covers an RTCView with a lower one.
|
|
37
|
+
*
|
|
38
|
+
* Non-overlapping RTCViews may safely share a z-order (because one does not
|
|
39
|
+
* have to cover the other).
|
|
40
|
+
*
|
|
41
|
+
* The support for zOrder is platform-dependent and/or
|
|
42
|
+
* implementation-specific. Thus, specifying a value for zOrder is to be
|
|
43
|
+
* thought of as giving a hint rather than as imposing a requirement. For
|
|
44
|
+
* example, video renderers such as RTCView are commonly implemented using
|
|
45
|
+
* OpenGL and OpenGL views may have different numbers of layers in their
|
|
46
|
+
* stacking space. Android has three: a layer bellow the window (aka
|
|
47
|
+
* default), a layer bellow the window again but above the previous layer
|
|
48
|
+
* (aka media overlay), and above the window. Consequently, it is advisable
|
|
49
|
+
* to limit the number of utilized layers in the stacking space to the
|
|
50
|
+
* minimum sufficient for the desired display. For example, a video call
|
|
51
|
+
* application usually needs a maximum of two zOrder values: 0 for the
|
|
52
|
+
* remote video(s) which appear in the background, and 1 for the local
|
|
53
|
+
* video(s) which appear above the remote video(s).
|
|
54
|
+
*
|
|
55
|
+
* zOrder: number
|
|
56
|
+
*/
|
|
57
|
+
zOrder?: number;
|
|
58
|
+
}
|
|
59
|
+
declare const _default: import("react-native").HostComponent<RTCVideoViewProps>;
|
|
53
60
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-webrtc",
|
|
3
|
-
"version": "106.0.0-beta.
|
|
3
|
+
"version": "106.0.0-beta.7",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/react-native-webrtc/react-native-webrtc.git"
|
|
@@ -64,6 +64,6 @@
|
|
|
64
64
|
]
|
|
65
65
|
},
|
|
66
66
|
"webrtc-builds": {
|
|
67
|
-
"android": "https://github.com/jitsi/webrtc/releases/download/v106.0.
|
|
67
|
+
"android": "https://github.com/jitsi/webrtc/releases/download/v106.0.1/android-webrtc.zip"
|
|
68
68
|
}
|
|
69
69
|
}
|
package/src/MediaStreamTrack.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { defineCustomEventTarget } from 'event-target-shim';
|
|
2
|
+
import { defineCustomEventTarget, Event } from 'event-target-shim';
|
|
3
3
|
import { NativeModules } from 'react-native';
|
|
4
4
|
|
|
5
5
|
import { deepClone } from './RTCUtil';
|
|
@@ -16,11 +16,11 @@ class MediaStreamTrack extends defineCustomEventTarget(...MEDIA_STREAM_TRACK_EVE
|
|
|
16
16
|
_settings: object;
|
|
17
17
|
_muted: boolean;
|
|
18
18
|
_peerConnectionId: number;
|
|
19
|
+
_readyState: MediaStreamTrackState;
|
|
19
20
|
|
|
20
21
|
readonly id: string;
|
|
21
22
|
readonly kind: string;
|
|
22
23
|
readonly label: string = '';
|
|
23
|
-
readyState: MediaStreamTrackState;
|
|
24
24
|
readonly remote: boolean;
|
|
25
25
|
|
|
26
26
|
constructor(info) {
|
|
@@ -31,14 +31,11 @@ class MediaStreamTrack extends defineCustomEventTarget(...MEDIA_STREAM_TRACK_EVE
|
|
|
31
31
|
this._settings = info.settings || {};
|
|
32
32
|
this._muted = false;
|
|
33
33
|
this._peerConnectionId = info.peerConnectionId;
|
|
34
|
+
this._readyState = info.readyState;
|
|
34
35
|
|
|
35
36
|
this.id = info.id;
|
|
36
37
|
this.kind = info.kind;
|
|
37
38
|
this.remote = info.remote;
|
|
38
|
-
|
|
39
|
-
const _readyState = info.readyState.toLowerCase();
|
|
40
|
-
|
|
41
|
-
this.readyState = _readyState === 'initializing' || _readyState === 'live' ? 'live' : 'ended';
|
|
42
39
|
}
|
|
43
40
|
|
|
44
41
|
get enabled(): boolean {
|
|
@@ -58,9 +55,13 @@ class MediaStreamTrack extends defineCustomEventTarget(...MEDIA_STREAM_TRACK_EVE
|
|
|
58
55
|
return this._muted;
|
|
59
56
|
}
|
|
60
57
|
|
|
58
|
+
get readyState(): string {
|
|
59
|
+
return this._readyState;
|
|
60
|
+
}
|
|
61
|
+
|
|
61
62
|
stop(): void {
|
|
62
63
|
WebRTCModule.mediaStreamTrackSetEnabled(this.id, false);
|
|
63
|
-
this.
|
|
64
|
+
this._readyState = 'ended';
|
|
64
65
|
// TODO: save some stopped flag?
|
|
65
66
|
}
|
|
66
67
|
|
|
@@ -95,6 +96,21 @@ class MediaStreamTrack extends defineCustomEventTarget(...MEDIA_STREAM_TRACK_EVE
|
|
|
95
96
|
WebRTCModule.mediaStreamTrackSetVideoEffect(this.id, name);
|
|
96
97
|
}
|
|
97
98
|
|
|
99
|
+
/**
|
|
100
|
+
* Internal function which is used to set the muted state on remote tracks and
|
|
101
|
+
* emit the mute / unmute event.
|
|
102
|
+
*
|
|
103
|
+
* @param muted Whether the track should be marked as muted / unmuted.
|
|
104
|
+
*/
|
|
105
|
+
_setMutedInternal(muted: boolean) {
|
|
106
|
+
if (!this.remote) {
|
|
107
|
+
throw new Error('Track is not remote!');
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
this._muted = muted;
|
|
111
|
+
this.dispatchEvent(new Event(muted ? 'mute' : 'unmute'));
|
|
112
|
+
}
|
|
113
|
+
|
|
98
114
|
applyConstraints(): never {
|
|
99
115
|
throw new Error('Not implemented.');
|
|
100
116
|
}
|
package/src/RTCIceCandidate.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
|
|
2
1
|
export default class RTCIceCandidate {
|
|
3
2
|
candidate: string;
|
|
4
3
|
sdpMLineIndex: number;
|
|
5
4
|
sdpMid: string;
|
|
6
5
|
|
|
7
|
-
constructor(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
constructor({ candidate = '', sdpMLineIndex = null, sdpMid = null }) {
|
|
7
|
+
if (sdpMLineIndex === null || sdpMid === null) {
|
|
8
|
+
throw new TypeError('`sdpMLineIndex` and `sdpMid` must not null');
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
this.candidate = candidate;
|
|
12
|
+
this.sdpMLineIndex = sdpMLineIndex;
|
|
13
|
+
this.sdpMid = sdpMid;
|
|
11
14
|
}
|
|
12
15
|
|
|
13
16
|
toJSON() {
|