Skip to content

Commit

Permalink
fix: add Array.prototype.at polyfill to fix error during sdp munge (#65)
Browse files Browse the repository at this point in the history
* fix: add Array.prototype.at polyfill to fix error during sdp munge

* chore: lint fix
  • Loading branch information
davidliu committed May 2, 2023
1 parent fbfe707 commit acf96ff
Show file tree
Hide file tree
Showing 4 changed files with 221 additions and 8 deletions.
10 changes: 5 additions & 5 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ PODS:
- FlipperKit/FlipperKitNetworkPlugin
- fmt (6.2.1)
- glog (0.3.5)
- JitsiWebRTC (106.0.0)
- JitsiWebRTC (111.0.1)
- libevent (2.1.12)
- livekit-react-native (1.0.0):
- React-Core
Expand Down Expand Up @@ -282,8 +282,8 @@ PODS:
- RCTTypeSafety
- React
- ReactCommon/turbomodule/core
- react-native-webrtc (106.0.1):
- JitsiWebRTC (~> 106.0.0)
- react-native-webrtc (111.0.0):
- JitsiWebRTC (~> 111.0.0)
- React-Core
- React-perflogger (0.67.5)
- React-RCTActionSheet (0.67.5):
Expand Down Expand Up @@ -532,7 +532,7 @@ SPEC CHECKSUMS:
FlipperKit: d8d346844eca5d9120c17d441a2f38596e8ed2b9
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
glog: 85ecdd10ee8d8ec362ef519a6a45ff9aa27b2e85
JitsiWebRTC: f441eb0e2d67f0588bf24e21c5162e97342714fb
JitsiWebRTC: 9619c1f71cc16eeca76df68aa2d213c6d63274a8
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
livekit-react-native: b1fef6233f472517123a8fc525066a8ff2808e41
OpenSSL-Universal: 1aa4f6a6ee7256b83db99ec1ccdaa80d10f9af9b
Expand All @@ -549,7 +549,7 @@ SPEC CHECKSUMS:
React-jsinspector: ec4fe4f65ccf9d67c8429dda955d3412db8a25ef
React-logger: 85f4ef06b9723714b2dfa5b0e5502b673b271b58
react-native-safe-area-context: 4a7fbd72ff607377d4b3006705e757d6530912b7
react-native-webrtc: aa3a0fdc4c410813892b97d18947f223d3e50f0c
react-native-webrtc: a9d4d8ef61adb634e006ffd956c494ad8318d95c
React-perflogger: d32ee13196f4ae2e4098fb7f8e7ed4f864c6fb0f
React-RCTActionSheet: 81779c09e34a6a3d6b15783407ba9016a774f535
React-RCTAnimation: b778eaaa42a884abcc5719035a7a0b2f54672658
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"android"
],
"dependencies": {
"array.prototype.at": "^1.1.1",
"livekit-client": "^1.8.0",
"promise.allsettled": "^1.0.5",
"react-native-url-polyfill": "^1.3.0"
Expand Down
9 changes: 9 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export function registerGlobals() {
setupURLPolyfill();
fixWebrtcAdapter();
shimPromiseAllSettled();
shimArrayAt();
}
function livekitRegisterGlobals() {
let lkGlobal: LiveKitReactNativeInfo = {
Expand Down Expand Up @@ -43,6 +44,14 @@ function shimPromiseAllSettled() {
allSettled.shim();
}

function shimArrayAt() {
// Some versions of RN don't have Array.prototype.at, which is used by sdp-transform
if (!Array.prototype.at) {
var at = require('array.prototype.at');
at.shim();
}
}

export * from './components/VideoView';
export * from './useParticipant';
export * from './useRoom';
Expand Down
Loading

0 comments on commit acf96ff

Please sign in to comment.