react-native-webrtc 106.0.0-beta.6 → 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.
Files changed (35) hide show
  1. package/android/src/main/java/com/oney/WebRTCModule/GetUserMediaImpl.java +1 -1
  2. package/android/src/main/java/com/oney/WebRTCModule/WebRTCModule.java +20 -6
  3. package/ios/RCTWebRTC/RCTConvert+WebRTC.m +10 -0
  4. package/ios/RCTWebRTC/SerializeUtils.m +4 -2
  5. package/ios/RCTWebRTC/WebRTCModule+RTCPeerConnection.m +19 -12
  6. package/lib/commonjs/MediaStreamTrack.js +8 -7
  7. package/lib/commonjs/MediaStreamTrack.js.map +1 -1
  8. package/lib/commonjs/RTCIceCandidate.js +14 -4
  9. package/lib/commonjs/RTCIceCandidate.js.map +1 -1
  10. package/lib/commonjs/RTCPeerConnection.js +40 -26
  11. package/lib/commonjs/RTCPeerConnection.js.map +1 -1
  12. package/lib/commonjs/RTCRtpTransceiver.js +2 -9
  13. package/lib/commonjs/RTCRtpTransceiver.js.map +1 -1
  14. package/lib/commonjs/RTCView.js +0 -55
  15. package/lib/commonjs/RTCView.js.map +1 -1
  16. package/lib/module/MediaStreamTrack.js +8 -7
  17. package/lib/module/MediaStreamTrack.js.map +1 -1
  18. package/lib/module/RTCIceCandidate.js +14 -4
  19. package/lib/module/RTCIceCandidate.js.map +1 -1
  20. package/lib/module/RTCPeerConnection.js +40 -26
  21. package/lib/module/RTCPeerConnection.js.map +1 -1
  22. package/lib/module/RTCRtpTransceiver.js +2 -9
  23. package/lib/module/RTCRtpTransceiver.js.map +1 -1
  24. package/lib/module/RTCView.js +0 -49
  25. package/lib/module/RTCView.js.map +1 -1
  26. package/lib/typescript/MediaStreamTrack.d.ts +2 -1
  27. package/lib/typescript/RTCIceCandidate.d.ts +5 -1
  28. package/lib/typescript/RTCRtpTransceiver.d.ts +0 -3
  29. package/lib/typescript/RTCView.d.ts +53 -46
  30. package/package.json +1 -1
  31. package/src/MediaStreamTrack.ts +7 -6
  32. package/src/RTCIceCandidate.ts +8 -5
  33. package/src/RTCPeerConnection.ts +41 -14
  34. package/src/RTCRtpTransceiver.ts +2 -9
  35. package/src/RTCView.ts +53 -49
@@ -21,8 +21,6 @@ class RTCRtpTransceiver {
21
21
 
22
22
  _defineProperty(this, "_receiver", void 0);
23
23
 
24
- _defineProperty(this, "_id", void 0);
25
-
26
24
  _defineProperty(this, "_mid", null);
27
25
 
28
26
  _defineProperty(this, "_direction", void 0);
@@ -32,7 +30,6 @@ class RTCRtpTransceiver {
32
30
  _defineProperty(this, "_stopped", void 0);
33
31
 
34
32
  this._peerConnectionId = args.peerConnectionId;
35
- this._id = args.id;
36
33
  this._mid = args.mid ? args.mid : null;
37
34
  this._direction = args.direction;
38
35
  this._currentDirection = args.currentDirection;
@@ -41,10 +38,6 @@ class RTCRtpTransceiver {
41
38
  this._receiver = args.receiver;
42
39
  }
43
40
 
44
- get id() {
45
- return this._id;
46
- }
47
-
48
41
  get mid() {
49
42
  return this._mid;
50
43
  }
@@ -71,7 +64,7 @@ class RTCRtpTransceiver {
71
64
  }
72
65
 
73
66
  const oldDirection = this._direction;
74
- WebRTCModule.transceiverSetDirection(this._peerConnectionId, this.id, val).catch(() => {
67
+ WebRTCModule.transceiverSetDirection(this._peerConnectionId, this.sender.id, val).catch(() => {
75
68
  this._direction = oldDirection;
76
69
  });
77
70
  this._direction = val;
@@ -94,7 +87,7 @@ class RTCRtpTransceiver {
94
87
  return;
95
88
  }
96
89
 
97
- WebRTCModule.transceiverStop(this._peerConnectionId, this.id).then(() => this._setStopped());
90
+ WebRTCModule.transceiverStop(this._peerConnectionId, this.sender.id).then(() => this._setStopped());
98
91
  }
99
92
 
100
93
  _setStopped() {
@@ -1 +1 @@
1
- {"version":3,"sources":["RTCRtpTransceiver.ts"],"names":["WebRTCModule","NativeModules","RTCRtpTransceiver","constructor","args","_peerConnectionId","peerConnectionId","_id","id","_mid","mid","_direction","direction","_currentDirection","currentDirection","_stopped","isStopped","_sender","sender","_receiver","receiver","stopped","val","includes","TypeError","Error","oldDirection","transceiverSetDirection","catch","stop","transceiverStop","then","_setStopped"],"mappings":";;;;;;;AAAA;;;;AAKA,MAAM;AAAEA,EAAAA;AAAF,IAAmBC,0BAAzB;;AAGe,MAAMC,iBAAN,CAAwB;AAWnCC,EAAAA,WAAW,CAACC,IAAD,EASR;AAAA;;AAAA;;AAAA;;AAAA;;AAAA,kCAdmB,IAcnB;;AAAA;;AAAA;;AAAA;;AACC,SAAKC,iBAAL,GAAyBD,IAAI,CAACE,gBAA9B;AACA,SAAKC,GAAL,GAAWH,IAAI,CAACI,EAAhB;AACA,SAAKC,IAAL,GAAYL,IAAI,CAACM,GAAL,GAAWN,IAAI,CAACM,GAAhB,GAAsB,IAAlC;AACA,SAAKC,UAAL,GAAkBP,IAAI,CAACQ,SAAvB;AACA,SAAKC,iBAAL,GAAyBT,IAAI,CAACU,gBAA9B;AACA,SAAKC,QAAL,GAAgBX,IAAI,CAACY,SAArB;AACA,SAAKC,OAAL,GAAeb,IAAI,CAACc,MAApB;AACA,SAAKC,SAAL,GAAiBf,IAAI,CAACgB,QAAtB;AACH;;AAEK,MAAFZ,EAAE,GAAG;AACL,WAAO,KAAKD,GAAZ;AACH;;AAEM,MAAHG,GAAG,GAAG;AACN,WAAO,KAAKD,IAAZ;AACH;;AAEU,MAAPY,OAAO,GAAG;AACV,WAAO,KAAKN,QAAZ;AACH;;AAEY,MAATH,SAAS,GAAG;AACZ,WAAO,KAAKD,UAAZ;AACH;;AAEY,MAATC,SAAS,CAACU,GAAD,EAAM;AACf,QAAI,CAAC,CAAE,UAAF,EAAc,UAAd,EAA0B,UAA1B,EAAsC,UAAtC,EAAmDC,QAAnD,CAA4DD,GAA5D,CAAL,EAAuE;AACnE,YAAM,IAAIE,SAAJ,CAAc,4BAAd,CAAN;AACH;;AAED,QAAI,KAAKT,QAAT,EAAmB;AACf,YAAMU,KAAK,CAAC,qBAAD,CAAX;AACH;;AAED,QAAI,KAAKd,UAAL,KAAoBW,GAAxB,EAA6B;AACzB;AACH;;AAED,UAAMI,YAAY,GAAG,KAAKf,UAA1B;AAEAX,IAAAA,YAAY,CAAC2B,uBAAb,CAAqC,KAAKtB,iBAA1C,EAA6D,KAAKG,EAAlE,EAAsEc,GAAtE,EACKM,KADL,CACW,MAAM;AACT,WAAKjB,UAAL,GAAkBe,YAAlB;AACH,KAHL;AAKA,SAAKf,UAAL,GAAkBW,GAAlB;AACH;;AAEmB,MAAhBR,gBAAgB,GAAG;AACnB,WAAO,KAAKD,iBAAZ;AACH;;AAES,MAANK,MAAM,GAAG;AACT,WAAO,KAAKD,OAAZ;AACH;;AAEW,MAARG,QAAQ,GAAG;AACX,WAAO,KAAKD,SAAZ;AACH;;AAEDU,EAAAA,IAAI,GAAG;AACH,QAAI,KAAKd,QAAT,EAAmB;AACf;AACH;;AAEDf,IAAAA,YAAY,CAAC8B,eAAb,CAA6B,KAAKzB,iBAAlC,EAAqD,KAAKG,EAA1D,EACKuB,IADL,CACU,MAAM,KAAKC,WAAL,EADhB;AAEH;;AAEDA,EAAAA,WAAW,GAAG;AACV,SAAKjB,QAAL,GAAgB,IAAhB;AACA,SAAKJ,UAAL,GAAkB,SAAlB;AACA,SAAKE,iBAAL,GAAyB,SAAzB;AACA,SAAKJ,IAAL,GAAY,IAAZ;AACH;;AAhGkC","sourcesContent":["import { NativeModules } from 'react-native';\n\nimport RTCRtpReceiver from './RTCRtpReceiver';\nimport RTCRtpSender from './RTCRtpSender';\n\nconst { WebRTCModule } = NativeModules;\n\n\nexport default class RTCRtpTransceiver {\n _peerConnectionId: number;\n _sender: RTCRtpSender;\n _receiver: RTCRtpReceiver;\n\n _id: string;\n _mid: string | null = null;\n _direction: string;\n _currentDirection: string;\n _stopped: boolean;\n\n constructor(args: {\n peerConnectionId: number,\n id: string,\n isStopped: boolean,\n direction: string,\n currentDirection: string,\n mid?: string,\n sender: RTCRtpSender,\n receiver: RTCRtpReceiver,\n }) {\n this._peerConnectionId = args.peerConnectionId;\n this._id = args.id;\n this._mid = args.mid ? args.mid : null;\n this._direction = args.direction;\n this._currentDirection = args.currentDirection;\n this._stopped = args.isStopped;\n this._sender = args.sender;\n this._receiver = args.receiver;\n }\n\n get id() {\n return this._id;\n }\n\n get mid() {\n return this._mid;\n }\n\n get stopped() {\n return this._stopped;\n }\n\n get direction() {\n return this._direction;\n }\n\n set direction(val) {\n if (![ 'sendonly', 'recvonly', 'sendrecv', 'inactive' ].includes(val)) {\n throw new TypeError('Invalid direction provided');\n }\n\n if (this._stopped) {\n throw Error('Transceiver Stopped');\n }\n\n if (this._direction === val) {\n return;\n }\n\n const oldDirection = this._direction;\n\n WebRTCModule.transceiverSetDirection(this._peerConnectionId, this.id, val)\n .catch(() => {\n this._direction = oldDirection;\n });\n\n this._direction = val;\n }\n\n get currentDirection() {\n return this._currentDirection;\n }\n\n get sender() {\n return this._sender;\n }\n\n get receiver() {\n return this._receiver;\n }\n\n stop() {\n if (this._stopped) {\n return;\n }\n\n WebRTCModule.transceiverStop(this._peerConnectionId, this.id)\n .then(() => this._setStopped());\n }\n\n _setStopped() {\n this._stopped = true;\n this._direction = 'stopped';\n this._currentDirection = 'stopped';\n this._mid = null;\n }\n}\n"]}
1
+ {"version":3,"sources":["RTCRtpTransceiver.ts"],"names":["WebRTCModule","NativeModules","RTCRtpTransceiver","constructor","args","_peerConnectionId","peerConnectionId","_mid","mid","_direction","direction","_currentDirection","currentDirection","_stopped","isStopped","_sender","sender","_receiver","receiver","stopped","val","includes","TypeError","Error","oldDirection","transceiverSetDirection","id","catch","stop","transceiverStop","then","_setStopped"],"mappings":";;;;;;;AAAA;;;;AAKA,MAAM;AAAEA,EAAAA;AAAF,IAAmBC,0BAAzB;;AAGe,MAAMC,iBAAN,CAAwB;AAUnCC,EAAAA,WAAW,CAACC,IAAD,EAQR;AAAA;;AAAA;;AAAA;;AAAA,kCAbmB,IAanB;;AAAA;;AAAA;;AAAA;;AACC,SAAKC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ACH;;AAEW,MAARG,QAAQ,GAAG;AACX,WAAO,KAAKD,SAAZ;AACH;;AAEDW,EAAAA,IAAI,GAAG;AACH,QAAI,KAAKf,QAAT,EAAmB;AACf;AACH;;AAEDb,IAAAA,YAAY,CAAC6B,eAAb,CAA6B,KAAKxB,iBAAlC,EAAqD,KAAKW,MAAL,CAAYU,EAAjE,EACKI,IADL,CACU,MAAM,KAAKC,WAAL,EADhB;AAEH;;AAEDA,EAAAA,WAAW,GAAG;AACV,SAAKlB,QAAL,GAAgB,IAAhB;AACA,SAAKJ,UAAL,GAAkB,SAAlB;AACA,SAAKE,iBAAL,GAAyB,SAAzB;AACA,SAAKJ,IAAL,GAAY,IAAZ;AACH;;AAzFkC","sourcesContent":["import { NativeModules } from 'react-native';\n\nimport RTCRtpReceiver from './RTCRtpReceiver';\nimport RTCRtpSender from './RTCRtpSender';\n\nconst { WebRTCModule } = NativeModules;\n\n\nexport default class RTCRtpTransceiver {\n _peerConnectionId: number;\n _sender: RTCRtpSender;\n _receiver: RTCRtpReceiver;\n\n _mid: string | null = null;\n _direction: string;\n _currentDirection: string;\n _stopped: boolean;\n\n constructor(args: {\n peerConnectionId: number,\n isStopped: boolean,\n direction: string,\n currentDirection: string,\n mid?: string,\n sender: RTCRtpSender,\n receiver: RTCRtpReceiver,\n }) {\n this._peerConnectionId = args.peerConnectionId;\n this._mid = args.mid ? args.mid : null;\n this._direction = args.direction;\n this._currentDirection = args.currentDirection;\n this._stopped = args.isStopped;\n this._sender = args.sender;\n this._receiver = args.receiver;\n }\n\n get mid() {\n return this._mid;\n }\n\n get stopped() {\n return this._stopped;\n }\n\n get direction() {\n return this._direction;\n }\n\n set direction(val) {\n if (![ 'sendonly', 'recvonly', 'sendrecv', 'inactive' ].includes(val)) {\n throw new TypeError('Invalid direction provided');\n }\n\n if (this._stopped) {\n throw Error('Transceiver Stopped');\n }\n\n if (this._direction === val) {\n return;\n }\n\n const oldDirection = this._direction;\n\n WebRTCModule.transceiverSetDirection(this._peerConnectionId, this.sender.id, val)\n .catch(() => {\n this._direction = oldDirection;\n });\n\n this._direction = val;\n }\n\n get currentDirection() {\n return this._currentDirection;\n }\n\n get sender() {\n return this._sender;\n }\n\n get receiver() {\n return this._receiver;\n }\n\n stop() {\n if (this._stopped) {\n return;\n }\n\n WebRTCModule.transceiverStop(this._peerConnectionId, this.sender.id)\n .then(() => this._setStopped());\n }\n\n _setStopped() {\n this._stopped = true;\n this._direction = 'stopped';\n this._currentDirection = 'stopped';\n this._mid = null;\n }\n}\n"]}
@@ -7,61 +7,6 @@ exports.default = void 0;
7
7
 
8
8
  var _reactNative = require("react-native");
9
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
10
  var _default = (0, _reactNative.requireNativeComponent)('RTCVideoView');
66
11
 
67
12
  exports.default = _default;
@@ -1 +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"]}
1
+ {"version":3,"sources":["RTCView.ts"],"names":[],"mappings":";;;;;;;AAAA;;eA+De,yCAA0C,cAA1C,C","sourcesContent":["import { requireNativeComponent, ViewProps } 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\ninterface RTCVideoViewProps extends ViewProps {\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 mirror?: boolean;\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 objectFit?: 'contain' | 'cover';\n\n /**\n * URL / id of the stream that should be rendered.\n *\n * streamURL: string\n */\n streamURL: string;\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 zOrder?: number;\n}\n\nexport default requireNativeComponent<RTCVideoViewProps>('RTCVideoView');\n"]}
@@ -22,14 +22,14 @@ class MediaStreamTrack extends defineCustomEventTarget(...MEDIA_STREAM_TRACK_EVE
22
22
 
23
23
  _defineProperty(this, "_peerConnectionId", void 0);
24
24
 
25
+ _defineProperty(this, "_readyState", void 0);
26
+
25
27
  _defineProperty(this, "id", void 0);
26
28
 
27
29
  _defineProperty(this, "kind", void 0);
28
30
 
29
31
  _defineProperty(this, "label", '');
30
32
 
31
- _defineProperty(this, "readyState", void 0);
32
-
33
33
  _defineProperty(this, "remote", void 0);
34
34
 
35
35
  this._constraints = info.constraints || {};
@@ -37,13 +37,10 @@ class MediaStreamTrack extends defineCustomEventTarget(...MEDIA_STREAM_TRACK_EVE
37
37
  this._settings = info.settings || {};
38
38
  this._muted = false;
39
39
  this._peerConnectionId = info.peerConnectionId;
40
+ this._readyState = info.readyState;
40
41
  this.id = info.id;
41
42
  this.kind = info.kind;
42
43
  this.remote = info.remote;
43
-
44
- const _readyState = info.readyState.toLowerCase();
45
-
46
- this.readyState = _readyState === 'initializing' || _readyState === 'live' ? 'live' : 'ended';
47
44
  }
48
45
 
49
46
  get enabled() {
@@ -63,9 +60,13 @@ class MediaStreamTrack extends defineCustomEventTarget(...MEDIA_STREAM_TRACK_EVE
63
60
  return this._muted;
64
61
  }
65
62
 
63
+ get readyState() {
64
+ return this._readyState;
65
+ }
66
+
66
67
  stop() {
67
68
  WebRTCModule.mediaStreamTrackSetEnabled(this.id, false);
68
- this.readyState = 'ended'; // TODO: save some stopped flag?
69
+ this._readyState = 'ended'; // TODO: save some stopped flag?
69
70
  }
70
71
  /**
71
72
  * Private / custom API for switching the cameras on the fly, without the
@@ -1 +1 @@
1
- {"version":3,"sources":["MediaStreamTrack.ts"],"names":["defineCustomEventTarget","Event","NativeModules","deepClone","WebRTCModule","MEDIA_STREAM_TRACK_EVENTS","MediaStreamTrack","constructor","info","_constraints","constraints","_enabled","enabled","_settings","settings","_muted","_peerConnectionId","peerConnectionId","id","kind","remote","_readyState","readyState","toLowerCase","mediaStreamTrackSetEnabled","muted","stop","_switchCamera","Error","mediaStreamTrackSwitchCamera","_setVideoEffect","name","mediaStreamTrackSetVideoEffect","_setMutedInternal","dispatchEvent","applyConstraints","clone","getCapabilities","getConstraints","getSettings","release","mediaStreamTrackRelease"],"mappings":";;AACA,SAASA,uBAAT,EAAkCC,KAAlC,QAA+C,mBAA/C;AACA,SAASC,aAAT,QAA8B,cAA9B;AAEA,SAASC,SAAT,QAA0B,WAA1B;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAmBF,aAAzB;AAEA,MAAMG,yBAAyB,GAAG,CAAE,OAAF,EAAW,MAAX,EAAmB,QAAnB,CAAlC;;AAIA,MAAMC,gBAAN,SAA+BN,uBAAuB,CAAC,GAAGK,yBAAJ,CAAtD,CAAqF;AAajFE,EAAAA,WAAW,CAACC,IAAD,EAAO;AACd;;AADc;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA,mCAJO,EAIP;;AAAA;;AAAA;;AAGd,SAAKC,YAAL,GAAoBD,IAAI,CAACE,WAAL,IAAoB,EAAxC;AACA,SAAKC,QAAL,GAAgBH,IAAI,CAACI,OAArB;AACA,SAAKC,SAA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AACH;;AAEDY,EAAAA,eAAe,CAACC,IAAD,EAAc;AACzB,QAAI,KAAKX,MAAT,EAAiB;AACb,YAAM,IAAIQ,KAAJ,CAAU,mCAAV,CAAN;AACH;;AAED,QAAI,KAAKT,IAAL,KAAc,OAAlB,EAA2B;AACvB,YAAM,IAAIS,KAAJ,CAAU,mCAAV,CAAN;AACH;;AAEDxB,IAAAA,YAAY,CAAC4B,8BAAb,CAA4C,KAAKd,EAAjD,EAAqDa,IAArD;AACH;AAED;AACJ;AACA;AACA;AACA;AACA;;;AACIE,EAAAA,iBAAiB,CAACR,KAAD,EAAiB;AAC9B,QAAI,CAAC,KAAKL,MAAV,EAAkB;AACd,YAAM,IAAIQ,KAAJ,CAAU,sBAAV,CAAN;AACH;;AAED,SAAKb,MAAL,GAAcU,KAAd;AACA,SAAKS,aAAL,CAAmB,IAAIjC,KAAJ,CAAUwB,KAAK,GAAG,MAAH,GAAY,QAA3B,CAAnB;AACH;;AAEDU,EAAAA,gBAAgB,GAAU;AACtB,UAAM,IAAIP,KAAJ,CAAU,kBAAV,CAAN;AACH;;AAEDQ,EAAAA,KAAK,GAAU;AACX,UAAM,IAAIR,KAAJ,CAAU,kBAAV,CAAN;AACH;;AAEDS,EAAAA,eAAe,GAAU;AACrB,UAAM,IAAIT,KAAJ,CAAU,kBAAV,CAAN;AACH;;AAEDU,EAAAA,cAAc,GAAG;AACb,WAAOnC,SAAS,CAAC,KAAKM,YAAN,CAAhB;AACH;;AAED8B,EAAAA,WAAW,GAAG;AACV,WAAOpC,SAAS,CAAC,KAAKU,SAAN,CAAhB;AACH;;AAED2B,EAAAA,OAAO,GAAS;AACZpC,IAAAA,YAAY,CAACqC,uBAAb,CAAqC,KAAKvB,EAA1C;AACH;;AA1HgF;;AA6HrF,eAAeZ,gBAAf","sourcesContent":["\nimport { defineCustomEventTarget, Event } from 'event-target-shim';\nimport { NativeModules } from 'react-native';\n\nimport { deepClone } from './RTCUtil';\n\nconst { WebRTCModule } = NativeModules;\n\nconst MEDIA_STREAM_TRACK_EVENTS = [ 'ended', 'mute', 'unmute' ];\n\ntype MediaStreamTrackState = 'live' | 'ended';\n\nclass MediaStreamTrack extends defineCustomEventTarget(...MEDIA_STREAM_TRACK_EVENTS) {\n _constraints: object;\n _enabled: boolean;\n _settings: object;\n _muted: boolean;\n _peerConnectionId: number;\n\n readonly id: string;\n readonly kind: string;\n readonly label: string = '';\n readyState: MediaStreamTrackState;\n readonly remote: boolean;\n\n constructor(info) {\n super();\n\n this._constraints = info.constraints || {};\n this._enabled = info.enabled;\n this._settings = info.settings || {};\n this._muted = false;\n this._peerConnectionId = info.peerConnectionId;\n\n this.id = info.id;\n this.kind = info.kind;\n this.remote = info.remote;\n\n const _readyState = info.readyState.toLowerCase();\n\n this.readyState = _readyState === 'initializing' || _readyState === 'live' ? 'live' : 'ended';\n }\n\n get enabled(): boolean {\n return this._enabled;\n }\n\n set enabled(enabled: boolean) {\n if (enabled === this._enabled) {\n return;\n }\n\n WebRTCModule.mediaStreamTrackSetEnabled(this.id, !this._enabled);\n this._enabled = !this._enabled;\n }\n\n get muted(): boolean {\n return this._muted;\n }\n\n stop(): void {\n WebRTCModule.mediaStreamTrackSetEnabled(this.id, false);\n this.readyState = 'ended';\n // TODO: save some stopped flag?\n }\n\n /**\n * Private / custom API for switching the cameras on the fly, without the\n * need for adding / removing tracks or doing any SDP renegotiation.\n *\n * This is how the reference application (AppRTCMobile) implements camera\n * switching.\n */\n _switchCamera(): void {\n if (this.remote) {\n throw new Error('Not implemented for remote tracks');\n }\n\n if (this.kind !== 'video') {\n throw new Error('Only implemented for video tracks');\n }\n\n WebRTCModule.mediaStreamTrackSwitchCamera(this.id);\n }\n\n _setVideoEffect(name:string) {\n if (this.remote) {\n throw new Error('Not implemented for remote tracks');\n }\n\n if (this.kind !== 'video') {\n throw new Error('Only implemented for video tracks');\n }\n\n WebRTCModule.mediaStreamTrackSetVideoEffect(this.id, name);\n }\n\n /**\n * Internal function which is used to set the muted state on remote tracks and\n * emit the mute / unmute event.\n *\n * @param muted Whether the track should be marked as muted / unmuted.\n */\n _setMutedInternal(muted: boolean) {\n if (!this.remote) {\n throw new Error('Track is not remote!');\n }\n\n this._muted = muted;\n this.dispatchEvent(new Event(muted ? 'mute' : 'unmute'));\n }\n\n applyConstraints(): never {\n throw new Error('Not implemented.');\n }\n\n clone(): never {\n throw new Error('Not implemented.');\n }\n\n getCapabilities(): never {\n throw new Error('Not implemented.');\n }\n\n getConstraints() {\n return deepClone(this._constraints);\n }\n\n getSettings() {\n return deepClone(this._settings);\n }\n\n release(): void {\n WebRTCModule.mediaStreamTrackRelease(this.id);\n }\n}\n\nexport default MediaStreamTrack;\n"]}
1
+ {"version":3,"sources":["MediaStreamTrack.ts"],"names":["defineCustomEventTarget","Event","NativeModules","deepClone","WebRTCModule","MEDIA_STREAM_TRACK_EVENTS","MediaStreamTrack","constructor","info","_constraints","constraints","_enabled","enabled","_settings","settings","_muted","_peerConnectionId","peerConnectionId","_readyState","readyState","id","kind","remote","mediaStreamTrackSetEnabled","muted","stop","_switchCamera","Error","mediaStreamTrackSwitchCamera","_setVideoEffect","name","mediaStreamTrackSetVideoEffect","_setMutedInternal","dispatchEvent","applyConstraints","clone","getCapabilities","getConstraints","getSettings","release","mediaStreamTrackRelease"],"mappings":";;AACA,SAASA,uBAAT,EAAkCC,KAAlC,QAA+C,mBAA/C;AACA,SAASC,aAAT,QAA8B,cAA9B;AAEA,SAASC,SAAT,QAA0B,WAA1B;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAmBF,aAAzB;AAEA,MAAMG,yBAAyB,GAAG,CAAE,OAAF,EAAW,MAAX,EAAmB,QAAnB,CAAlC;;AAIA,MAAMC,gBAAN,SAA+BN,uBAAuB,CAAC,GAAGK,yBAAJ,CAAtD,CAAqF;AAajFE,EAAAA,WAAW,CAACC,IAAD,EAAO;AACd;;AADc;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA,mCAHO,EAGP;;AA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AAEDvB,IAAAA,YAAY,CAACwB,4BAAb,CAA0C,KAAKR,EAA/C;AACH;;AAEDS,EAAAA,eAAe,CAACC,IAAD,EAAc;AACzB,QAAI,KAAKR,MAAT,EAAiB;AACb,YAAM,IAAIK,KAAJ,CAAU,mCAAV,CAAN;AACH;;AAED,QAAI,KAAKN,IAAL,KAAc,OAAlB,EAA2B;AACvB,YAAM,IAAIM,KAAJ,CAAU,mCAAV,CAAN;AACH;;AAEDvB,IAAAA,YAAY,CAAC2B,8BAAb,CAA4C,KAAKX,EAAjD,EAAqDU,IAArD;AACH;AAED;AACJ;AACA;AACA;AACA;AACA;;;AACIE,EAAAA,iBAAiB,CAACR,KAAD,EAAiB;AAC9B,QAAI,CAAC,KAAKF,MAAV,EAAkB;AACd,YAAM,IAAIK,KAAJ,CAAU,sBAAV,CAAN;AACH;;AAED,SAAKZ,MAAL,GAAcS,KAAd;AACA,SAAKS,aAAL,CAAmB,IAAIhC,KAAJ,CAAUuB,KAAK,GAAG,MAAH,GAAY,QAA3B,CAAnB;AACH;;AAEDU,EAAAA,gBAAgB,GAAU;AACtB,UAAM,IAAIP,KAAJ,CAAU,kBAAV,CAAN;AACH;;AAEDQ,EAAAA,KAAK,GAAU;AACX,UAAM,IAAIR,KAAJ,CAAU,kBAAV,CAAN;AACH;;AAEDS,EAAAA,eAAe,GAAU;AACrB,UAAM,IAAIT,KAAJ,CAAU,kBAAV,CAAN;AACH;;AAEDU,EAAAA,cAAc,GAAG;AACb,WAAOlC,SAAS,CAAC,KAAKM,YAAN,CAAhB;AACH;;AAED6B,EAAAA,WAAW,GAAG;AACV,WAAOnC,SAAS,CAAC,KAAKU,SAAN,CAAhB;AACH;;AAED0B,EAAAA,OAAO,GAAS;AACZnC,IAAAA,YAAY,CAACoC,uBAAb,CAAqC,KAAKpB,EAA1C;AACH;;AA3HgF;;AA8HrF,eAAed,gBAAf","sourcesContent":["\nimport { defineCustomEventTarget, Event } from 'event-target-shim';\nimport { NativeModules } from 'react-native';\n\nimport { deepClone } from './RTCUtil';\n\nconst { WebRTCModule } = NativeModules;\n\nconst MEDIA_STREAM_TRACK_EVENTS = [ 'ended', 'mute', 'unmute' ];\n\ntype MediaStreamTrackState = 'live' | 'ended';\n\nclass MediaStreamTrack extends defineCustomEventTarget(...MEDIA_STREAM_TRACK_EVENTS) {\n _constraints: object;\n _enabled: boolean;\n _settings: object;\n _muted: boolean;\n _peerConnectionId: number;\n _readyState: MediaStreamTrackState;\n\n readonly id: string;\n readonly kind: string;\n readonly label: string = '';\n readonly remote: boolean;\n\n constructor(info) {\n super();\n\n this._constraints = info.constraints || {};\n this._enabled = info.enabled;\n this._settings = info.settings || {};\n this._muted = false;\n this._peerConnectionId = info.peerConnectionId;\n this._readyState = info.readyState;\n\n this.id = info.id;\n this.kind = info.kind;\n this.remote = info.remote;\n }\n\n get enabled(): boolean {\n return this._enabled;\n }\n\n set enabled(enabled: boolean) {\n if (enabled === this._enabled) {\n return;\n }\n\n WebRTCModule.mediaStreamTrackSetEnabled(this.id, !this._enabled);\n this._enabled = !this._enabled;\n }\n\n get muted(): boolean {\n return this._muted;\n }\n\n get readyState(): string {\n return this._readyState;\n }\n\n stop(): void {\n WebRTCModule.mediaStreamTrackSetEnabled(this.id, false);\n this._readyState = 'ended';\n // TODO: save some stopped flag?\n }\n\n /**\n * Private / custom API for switching the cameras on the fly, without the\n * need for adding / removing tracks or doing any SDP renegotiation.\n *\n * This is how the reference application (AppRTCMobile) implements camera\n * switching.\n */\n _switchCamera(): void {\n if (this.remote) {\n throw new Error('Not implemented for remote tracks');\n }\n\n if (this.kind !== 'video') {\n throw new Error('Only implemented for video tracks');\n }\n\n WebRTCModule.mediaStreamTrackSwitchCamera(this.id);\n }\n\n _setVideoEffect(name:string) {\n if (this.remote) {\n throw new Error('Not implemented for remote tracks');\n }\n\n if (this.kind !== 'video') {\n throw new Error('Only implemented for video tracks');\n }\n\n WebRTCModule.mediaStreamTrackSetVideoEffect(this.id, name);\n }\n\n /**\n * Internal function which is used to set the muted state on remote tracks and\n * emit the mute / unmute event.\n *\n * @param muted Whether the track should be marked as muted / unmuted.\n */\n _setMutedInternal(muted: boolean) {\n if (!this.remote) {\n throw new Error('Track is not remote!');\n }\n\n this._muted = muted;\n this.dispatchEvent(new Event(muted ? 'mute' : 'unmute'));\n }\n\n applyConstraints(): never {\n throw new Error('Not implemented.');\n }\n\n clone(): never {\n throw new Error('Not implemented.');\n }\n\n getCapabilities(): never {\n throw new Error('Not implemented.');\n }\n\n getConstraints() {\n return deepClone(this._constraints);\n }\n\n getSettings() {\n return deepClone(this._settings);\n }\n\n release(): void {\n WebRTCModule.mediaStreamTrackRelease(this.id);\n }\n}\n\nexport default MediaStreamTrack;\n"]}
@@ -1,16 +1,26 @@
1
1
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
2
 
3
3
  export default class RTCIceCandidate {
4
- constructor(info) {
4
+ constructor(_ref) {
5
+ let {
6
+ candidate = '',
7
+ sdpMLineIndex = null,
8
+ sdpMid = null
9
+ } = _ref;
10
+
5
11
  _defineProperty(this, "candidate", void 0);
6
12
 
7
13
  _defineProperty(this, "sdpMLineIndex", void 0);
8
14
 
9
15
  _defineProperty(this, "sdpMid", void 0);
10
16
 
11
- this.candidate = info.candidate;
12
- this.sdpMLineIndex = info.sdpMLineIndex;
13
- this.sdpMid = info.sdpMid;
17
+ if (sdpMLineIndex === null || sdpMid === null) {
18
+ throw new TypeError('`sdpMLineIndex` and `sdpMid` must not null');
19
+ }
20
+
21
+ this.candidate = candidate;
22
+ this.sdpMLineIndex = sdpMLineIndex;
23
+ this.sdpMid = sdpMid;
14
24
  }
15
25
 
16
26
  toJSON() {
@@ -1 +1 @@
1
- {"version":3,"sources":["RTCIceCandidate.ts"],"names":["RTCIceCandidate","constructor","info","candidate","sdpMLineIndex","sdpMid","toJSON"],"mappings":";;AACA,eAAe,MAAMA,eAAN,CAAsB;AAKjCC,EAAAA,WAAW,CAACC,IAAD,EAAO;AAAA;;AAAA;;AAAA;;AACd,SAAKC,SAAL,GAAiBD,IAAI,CAACC,SAAtB;AACA,SAAKC,aAAL,GAAqBF,IAAI,CAACE,aAA1B;AACA,SAAKC,MAAL,GAAcH,IAAI,CAACG,MAAnB;AACH;;AAEDC,EAAAA,MAAM,GAAG;AACL,WAAO;AACHH,MAAAA,SAAS,EAAE,KAAKA,SADb;AAEHC,MAAAA,aAAa,EAAE,KAAKA,aAFjB;AAGHC,MAAAA,MAAM,EAAE,KAAKA;AAHV,KAAP;AAKH;;AAjBgC","sourcesContent":["\nexport default class RTCIceCandidate {\n candidate: string;\n sdpMLineIndex: number;\n sdpMid: string;\n\n constructor(info) {\n this.candidate = info.candidate;\n this.sdpMLineIndex = info.sdpMLineIndex;\n this.sdpMid = info.sdpMid;\n }\n\n toJSON() {\n return {\n candidate: this.candidate,\n sdpMLineIndex: this.sdpMLineIndex,\n sdpMid: this.sdpMid\n };\n }\n}\n"]}
1
+ {"version":3,"sources":["RTCIceCandidate.ts"],"names":["RTCIceCandidate","constructor","candidate","sdpMLineIndex","sdpMid","TypeError","toJSON"],"mappings":";;AAAA,eAAe,MAAMA,eAAN,CAAsB;AAKjCC,EAAAA,WAAW,OAA0D;AAAA,QAAzD;AAAEC,MAAAA,SAAS,GAAG,EAAd;AAAkBC,MAAAA,aAAa,GAAG,IAAlC;AAAwCC,MAAAA,MAAM,GAAG;AAAjD,KAAyD;;AAAA;;AAAA;;AAAA;;AACjE,QAAID,aAAa,KAAK,IAAlB,IAA0BC,MAAM,KAAK,IAAzC,EAA+C;AAC3C,YAAM,IAAIC,SAAJ,CAAc,4CAAd,CAAN;AACH;;AAED,SAAKH,SAAL,GAAiBA,SAAjB;AACA,SAAKC,aAAL,GAAqBA,aAArB;AACA,SAAKC,MAAL,GAAcA,MAAd;AACH;;AAEDE,EAAAA,MAAM,GAAG;AACL,WAAO;AACHJ,MAAAA,SAAS,EAAE,KAAKA,SADb;AAEHC,MAAAA,aAAa,EAAE,KAAKA,aAFjB;AAGHC,MAAAA,MAAM,EAAE,KAAKA;AAHV,KAAP;AAKH;;AArBgC","sourcesContent":["export default class RTCIceCandidate {\n candidate: string;\n sdpMLineIndex: number;\n sdpMid: string;\n\n constructor({ candidate = '', sdpMLineIndex = null, sdpMid = null }) {\n if (sdpMLineIndex === null || sdpMid === null) {\n throw new TypeError('`sdpMLineIndex` and `sdpMid` must not null');\n }\n\n this.candidate = candidate;\n this.sdpMLineIndex = sdpMLineIndex;\n this.sdpMid = sdpMid;\n }\n\n toJSON() {\n return {\n candidate: this.candidate,\n sdpMLineIndex: this.sdpMLineIndex,\n sdpMid: this.sdpMid\n };\n }\n}\n"]}
@@ -118,7 +118,12 @@ export default class RTCPeerConnection extends defineCustomEventTarget(...PEER_C
118
118
  sdpInfo,
119
119
  transceiversInfo
120
120
  } = await WebRTCModule.peerConnectionSetLocalDescription(this._pcId, desc);
121
- this.localDescription = new RTCSessionDescription(sdpInfo);
121
+
122
+ if (sdpInfo.type && sdpInfo.sdp) {
123
+ this.localDescription = new RTCSessionDescription(sdpInfo);
124
+ } else {
125
+ this.localDescription = null;
126
+ }
122
127
 
123
128
  this._updateTransceivers(transceiversInfo);
124
129
 
@@ -146,17 +151,31 @@ export default class RTCPeerConnection extends defineCustomEventTarget(...PEER_C
146
151
  return new Promise((resolve, reject) => {
147
152
  WebRTCModule.peerConnectionSetRemoteDescription(desc, this._pcId, (successful, data) => {
148
153
  if (successful) {
149
- var _data$newTransceivers;
150
-
151
154
  log.debug(`${this._pcId} setRemoteDescription OK`);
152
- this.remoteDescription = new RTCSessionDescription(data.sdpInfo);
153
- (_data$newTransceivers = data.newTransceivers) === null || _data$newTransceivers === void 0 ? void 0 : _data$newTransceivers.forEach(t => {
155
+ const {
156
+ sdpInfo,
157
+ newTransceivers,
158
+ transceiversInfo
159
+ } = data;
160
+
161
+ if (sdpInfo.type && sdpInfo.sdp) {
162
+ this.remoteDescription = new RTCSessionDescription(sdpInfo);
163
+ } else {
164
+ this.remoteDescription = null;
165
+ }
166
+
167
+ newTransceivers === null || newTransceivers === void 0 ? void 0 : newTransceivers.forEach(t => {
154
168
  const {
155
169
  transceiverOrder,
156
170
  transceiver
157
171
  } = t;
158
- const newSender = new RTCRtpSender(transceiver.sender);
159
- const newReceiver = new RTCRtpReceiver(transceiver.receiver);
172
+ const newSender = new RTCRtpSender({ ...transceiver.sender,
173
+ track: null
174
+ });
175
+ const remoteTrack = transceiver.receiver.track ? new MediaStreamTrack(transceiver.receiver.track) : null;
176
+ const newReceiver = new RTCRtpReceiver({ ...transceiver.receiver,
177
+ track: remoteTrack
178
+ });
160
179
  const newTransceiver = new RTCRtpTransceiver({ ...transceiver,
161
180
  sender: newSender,
162
181
  receiver: newReceiver
@@ -165,7 +184,7 @@ export default class RTCPeerConnection extends defineCustomEventTarget(...PEER_C
165
184
  this._insertTransceiverSorted(transceiverOrder, newTransceiver);
166
185
  });
167
186
 
168
- this._updateTransceivers(data.transceiversInfo);
187
+ this._updateTransceivers(transceiversInfo);
169
188
 
170
189
  resolve();
171
190
  } else {
@@ -179,10 +198,14 @@ export default class RTCPeerConnection extends defineCustomEventTarget(...PEER_C
179
198
  log.debug(`${this._pcId} addIceCandidate`);
180
199
 
181
200
  if (!candidate || !candidate.candidate) {
182
- // XXX end-of cantidates is not implemented: https://bugs.chromium.org/p/webrtc/issues/detail?id=9218
201
+ // XXX end-of candidates is not implemented: https://bugs.chromium.org/p/webrtc/issues/detail?id=9218
183
202
  return;
184
203
  }
185
204
 
205
+ if (candidate.sdpMLineIndex === null || candidate.sdpMLineIndex === undefined || candidate.sdpMid === null || candidate.sdpMid === undefined) {
206
+ throw new TypeError('`sdpMLineIndex` and `sdpMid` must not null or undefined');
207
+ }
208
+
186
209
  const newSdp = await WebRTCModule.peerConnectionAddICECandidate(this._pcId, candidate.toJSON ? candidate.toJSON() : candidate);
187
210
  this.remoteDescription = new RTCSessionDescription(newSdp);
188
211
  }
@@ -447,32 +470,23 @@ export default class RTCPeerConnection extends defineCustomEventTarget(...PEER_C
447
470
 
448
471
  log.debug(`${this._pcId} ontrack`);
449
472
  let track;
450
- let transceiver; // Make sure transceivers are stored in timestamp order. Also, we have to make
451
- // sure we do not add a transceiver if it exists.
452
-
453
- const [{
454
- transceiver: oldTransceiver
455
- } = {
456
- transceiver: null
457
- }] = this._transceivers.filter(_ref2 => {
458
- let {
459
- transceiver
460
- } = _ref2;
461
- return transceiver.id === ev.transceiver.id;
462
- }); // We need to fire this event for an existing track sometimes, like
473
+ let transceiver;
474
+ const [oldTransceiver] = this.getTransceivers().filter(t => t.receiver.id === ev.receiver.id); // We need to fire this event for an existing track sometimes, like
463
475
  // when the transceiver direction (on the sending side) switches from
464
476
  // sendrecv to recvonly and then back.
465
477
 
466
-
467
478
  if (oldTransceiver) {
468
479
  transceiver = oldTransceiver;
469
- track = transceiver._receiver._track;
480
+ track = transceiver.receiver.track;
470
481
  transceiver._mid = ev.transceiver.mid;
471
482
  transceiver._currentDirection = ev.transceiver.currentDirection;
472
483
  transceiver._direction = ev.transceiver.direction;
473
484
  } else {
485
+ // TODO: re-evaluate if we need this branch at all. Since we now add new transceivers
486
+ // in sRD, we should always find them when this handler runs.
474
487
  track = new MediaStreamTrack(ev.receiver.track);
475
- const sender = new RTCRtpSender({ ...ev.transceiver.sender
488
+ const sender = new RTCRtpSender({ ...ev.transceiver,
489
+ track: null
476
490
  });
477
491
  const receiver = new RTCRtpReceiver({ ...ev.receiver,
478
492
  track
@@ -646,7 +660,7 @@ export default class RTCPeerConnection extends defineCustomEventTarget(...PEER_C
646
660
 
647
661
  _updateTransceivers(transceiverUpdates) {
648
662
  for (const update of transceiverUpdates) {
649
- const [transceiver] = this.getTransceivers().filter(t => t.id === update.transceiverId);
663
+ const [transceiver] = this.getTransceivers().filter(t => t.sender.id === update.transceiverId);
650
664
 
651
665
  if (!transceiver) {
652
666
  continue;