@livekit/react-native 2.2.0 → 2.3.0
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 +14 -5
- package/android/build.gradle +1 -1
- package/android/gradle/wrapper/gradle-wrapper.properties +3 -1
- package/android/gradlew +29 -14
- package/android/gradlew.bat +19 -16
- package/android/src/main/java/com/livekit/reactnative/video/SimulcastVideoEncoderFactoryWrapper.kt +2 -2
- package/lib/commonjs/audio/AudioManager.js +4 -27
- package/lib/commonjs/audio/AudioManager.js.map +1 -1
- package/lib/commonjs/audio/AudioSession.js +55 -21
- package/lib/commonjs/audio/AudioSession.js.map +1 -1
- package/lib/commonjs/components/LiveKitRoom.js +3 -6
- package/lib/commonjs/components/LiveKitRoom.js.map +1 -1
- package/lib/commonjs/components/VideoTrack.js +30 -66
- package/lib/commonjs/components/VideoTrack.js.map +1 -1
- package/lib/commonjs/components/VideoView.js +32 -63
- package/lib/commonjs/components/VideoView.js.map +1 -1
- package/lib/commonjs/components/ViewPortDetector.js +15 -62
- package/lib/commonjs/components/ViewPortDetector.js.map +1 -1
- package/lib/commonjs/hooks.js +0 -63
- package/lib/commonjs/hooks.js.map +1 -1
- package/lib/commonjs/index.js +9 -84
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/logger.js +4 -14
- package/lib/commonjs/logger.js.map +1 -1
- package/lib/commonjs/polyfills/EncoderDecoderTogether.min.js +16 -42
- package/lib/commonjs/polyfills/EncoderDecoderTogether.min.js.map +1 -1
- package/lib/commonjs/useParticipant.js +5 -13
- package/lib/commonjs/useParticipant.js.map +1 -1
- package/lib/commonjs/useRoom.js +17 -33
- package/lib/commonjs/useRoom.js.map +1 -1
- package/lib/module/audio/AudioManager.js +3 -17
- package/lib/module/audio/AudioManager.js.map +1 -1
- package/lib/module/audio/AudioSession.js +54 -14
- package/lib/module/audio/AudioSession.js.map +1 -1
- package/lib/module/components/LiveKitRoom.js +1 -0
- package/lib/module/components/LiveKitRoom.js.map +1 -1
- package/lib/module/components/VideoTrack.js +18 -44
- package/lib/module/components/VideoTrack.js.map +1 -1
- package/lib/module/components/VideoView.js +18 -42
- package/lib/module/components/VideoView.js.map +1 -1
- package/lib/module/components/ViewPortDetector.js +13 -54
- package/lib/module/components/ViewPortDetector.js.map +1 -1
- package/lib/module/hooks.js +1 -2
- package/lib/module/hooks.js.map +1 -1
- package/lib/module/index.js +5 -23
- package/lib/module/index.js.map +1 -1
- package/lib/module/logger.js +2 -6
- package/lib/module/logger.js.map +1 -1
- package/lib/module/polyfills/EncoderDecoderTogether.min.js +16 -42
- package/lib/module/polyfills/EncoderDecoderTogether.min.js.map +1 -1
- package/lib/module/useParticipant.js +5 -11
- package/lib/module/useParticipant.js.map +1 -1
- package/lib/module/useRoom.js +17 -30
- package/lib/module/useRoom.js.map +1 -1
- package/lib/typescript/babel.config.d.ts +1 -0
- package/lib/typescript/docs/assets/icons.d.ts +0 -0
- package/lib/typescript/docs/assets/main.d.ts +0 -0
- package/lib/typescript/docs/assets/navigation.d.ts +0 -0
- package/lib/typescript/docs/assets/search.d.ts +0 -0
- package/lib/typescript/lib/commonjs/audio/AudioManager.d.ts +10 -0
- package/lib/typescript/lib/commonjs/audio/AudioSession.d.ts +33 -0
- package/lib/typescript/lib/commonjs/components/LiveKitRoom.d.ts +20 -0
- package/lib/typescript/lib/commonjs/components/VideoTrack.d.ts +8 -0
- package/lib/typescript/lib/commonjs/components/VideoView.d.ts +14 -0
- package/lib/typescript/lib/commonjs/components/ViewPortDetector.d.ts +30 -0
- package/lib/typescript/lib/commonjs/hooks.d.ts +29 -0
- package/lib/typescript/lib/commonjs/index.d.ts +10 -0
- package/lib/typescript/lib/commonjs/logger.d.ts +8 -0
- package/lib/typescript/lib/commonjs/useParticipant.d.ts +14 -0
- package/lib/typescript/lib/commonjs/useRoom.d.ts +16 -0
- package/lib/typescript/lib/module/audio/AudioManager.d.ts +9 -0
- package/lib/typescript/lib/module/audio/AudioSession.d.ts +31 -0
- package/lib/typescript/lib/module/components/LiveKitRoom.d.ts +22 -0
- package/lib/typescript/lib/module/components/VideoTrack.d.ts +9 -0
- package/lib/typescript/lib/module/components/VideoView.d.ts +9 -0
- package/lib/typescript/lib/module/components/ViewPortDetector.d.ts +29 -0
- package/lib/typescript/lib/module/hooks.d.ts +1 -0
- package/lib/typescript/lib/module/index.d.ts +18 -0
- package/lib/typescript/lib/module/logger.d.ts +8 -0
- package/lib/typescript/lib/module/polyfills/EncoderDecoderTogether.min.d.ts +0 -0
- package/lib/typescript/lib/module/useParticipant.d.ts +13 -0
- package/lib/typescript/lib/module/useRoom.d.ts +15 -0
- package/lib/typescript/scripts/bootstrap.d.ts +1 -0
- package/lib/typescript/{audio → src/audio}/AudioSession.d.ts +7 -7
- package/lib/typescript/{components → src/components}/LiveKitRoom.d.ts +1 -1
- package/lib/typescript/{components → src/components}/VideoTrack.d.ts +2 -2
- package/lib/typescript/{components → src/components}/VideoView.d.ts +3 -3
- package/lib/typescript/{components → src/components}/ViewPortDetector.d.ts +3 -3
- package/lib/typescript/src/hooks.d.ts +3 -0
- package/lib/typescript/{index.d.ts → src/index.d.ts} +3 -2
- package/lib/typescript/{logger.d.ts → src/logger.d.ts} +2 -2
- package/lib/typescript/src/polyfills/EncoderDecoderTogether.min.d.ts +0 -0
- package/lib/typescript/{useRoom.d.ts → src/useRoom.d.ts} +1 -1
- package/package.json +22 -18
- package/src/components/LiveKitRoom.tsx +1 -1
- package/src/components/VideoTrack.tsx +7 -2
- package/src/components/VideoView.tsx +8 -3
- package/src/components/ViewPortDetector.tsx +4 -4
- package/src/hooks.ts +11 -9
- package/src/index.tsx +10 -8
- package/src/useRoom.ts +1 -1
- package/lib/typescript/hooks.d.ts +0 -2
- /package/lib/typescript/{audio → src/audio}/AudioManager.d.ts +0 -0
- /package/lib/typescript/{useParticipant.d.ts → src/useParticipant.d.ts} +0 -0
|
@@ -4,179 +4,136 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
8
|
var _reactNative = require("react-native");
|
|
11
|
-
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
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; }
|
|
19
|
-
|
|
9
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
10
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
12
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
14
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
20
15
|
const DEFAULT_DELAY = 1000;
|
|
21
|
-
|
|
22
16
|
class TimeoutHandler {
|
|
23
17
|
constructor() {
|
|
24
18
|
_defineProperty(this, "handlerRef", {
|
|
25
19
|
id: -1
|
|
26
20
|
});
|
|
27
21
|
}
|
|
28
|
-
|
|
29
22
|
get handler() {
|
|
30
23
|
return this.handlerRef.id;
|
|
31
24
|
}
|
|
32
|
-
|
|
33
25
|
set handler(n) {
|
|
34
26
|
this.handlerRef.id = n;
|
|
35
27
|
}
|
|
36
|
-
|
|
37
28
|
clear() {
|
|
38
29
|
clearTimeout(this.handlerRef.id);
|
|
39
30
|
}
|
|
40
|
-
|
|
41
31
|
}
|
|
42
|
-
|
|
43
|
-
function setIntervalWithTimeout(callback, intervalMs) {
|
|
44
|
-
let handleWrapper = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new TimeoutHandler();
|
|
32
|
+
function setIntervalWithTimeout(callback, intervalMs, handleWrapper = new TimeoutHandler()) {
|
|
45
33
|
let cleared = false;
|
|
46
|
-
|
|
47
34
|
const timeout = () => {
|
|
48
35
|
handleWrapper.handler = setTimeout(() => {
|
|
49
36
|
callback(() => {
|
|
50
37
|
cleared = true;
|
|
51
38
|
handleWrapper.clear();
|
|
52
39
|
});
|
|
53
|
-
|
|
54
40
|
if (!cleared) {
|
|
55
41
|
timeout();
|
|
56
42
|
}
|
|
57
43
|
}, intervalMs);
|
|
58
44
|
};
|
|
59
|
-
|
|
60
45
|
timeout();
|
|
61
46
|
return handleWrapper;
|
|
62
47
|
}
|
|
48
|
+
|
|
63
49
|
/**
|
|
64
50
|
* Detects when this is in the viewport and visible.
|
|
65
51
|
*
|
|
66
52
|
* Will not fire visibility changes for zero width/height components.
|
|
67
53
|
*/
|
|
68
|
-
|
|
69
|
-
|
|
70
54
|
class ViewPortDetector extends _react.Component {
|
|
71
55
|
constructor(props) {
|
|
72
56
|
super(props);
|
|
73
|
-
|
|
74
57
|
_defineProperty(this, "lastValue", null);
|
|
75
|
-
|
|
76
58
|
_defineProperty(this, "interval", null);
|
|
77
|
-
|
|
78
59
|
_defineProperty(this, "view", null);
|
|
79
|
-
|
|
80
60
|
_defineProperty(this, "lastAppStateActive", false);
|
|
81
|
-
|
|
82
61
|
_defineProperty(this, "appStateSubscription", null);
|
|
83
|
-
|
|
84
62
|
_defineProperty(this, "hasValidTimeout", (disabled, delay) => {
|
|
85
|
-
let disabledValue = disabled
|
|
86
|
-
let delayValue = delay
|
|
63
|
+
let disabledValue = disabled ?? false;
|
|
64
|
+
let delayValue = delay ?? DEFAULT_DELAY;
|
|
87
65
|
return _reactNative.AppState.currentState === 'active' && !disabledValue && delayValue > 0;
|
|
88
66
|
});
|
|
89
|
-
|
|
90
67
|
_defineProperty(this, "handleAppStateChange", nextAppState => {
|
|
91
68
|
let nextAppStateActive = nextAppState === 'active';
|
|
92
|
-
|
|
93
69
|
if (this.lastAppStateActive !== nextAppStateActive) {
|
|
94
70
|
this.checkVisibility();
|
|
95
71
|
}
|
|
96
|
-
|
|
97
72
|
this.lastAppStateActive = nextAppStateActive;
|
|
98
|
-
|
|
99
73
|
if (!this.hasValidTimeout(this.props.disabled, this.props.delay)) {
|
|
100
74
|
this.stopWatching();
|
|
101
75
|
} else {
|
|
102
76
|
this.startWatching();
|
|
103
77
|
}
|
|
104
78
|
});
|
|
105
|
-
|
|
106
79
|
_defineProperty(this, "startWatching", () => {
|
|
107
80
|
if (this.interval) {
|
|
108
81
|
return;
|
|
109
82
|
}
|
|
110
|
-
|
|
111
83
|
this.interval = setIntervalWithTimeout(this.checkVisibility, this.props.delay || DEFAULT_DELAY);
|
|
112
84
|
});
|
|
113
|
-
|
|
114
85
|
_defineProperty(this, "stopWatching", () => {
|
|
115
86
|
var _this$interval;
|
|
116
|
-
|
|
117
|
-
(_this$interval = this.interval) === null || _this$interval === void 0 ? void 0 : _this$interval.clear();
|
|
87
|
+
(_this$interval = this.interval) === null || _this$interval === void 0 || _this$interval.clear();
|
|
118
88
|
this.interval = null;
|
|
119
89
|
});
|
|
120
|
-
|
|
121
90
|
_defineProperty(this, "checkVisibility", () => {
|
|
122
91
|
if (!this.view) {
|
|
123
92
|
return;
|
|
124
93
|
}
|
|
125
|
-
|
|
126
94
|
if (_reactNative.AppState.currentState !== 'active') {
|
|
127
95
|
this.updateVisibility(false);
|
|
128
96
|
return;
|
|
129
97
|
}
|
|
130
|
-
|
|
131
98
|
this.view.measure((_x, _y, width, height, _pageX, _pageY) => {
|
|
132
99
|
this.checkInViewPort(width, height);
|
|
133
100
|
});
|
|
134
101
|
});
|
|
135
|
-
|
|
136
102
|
_defineProperty(this, "checkInViewPort", (width, height) => {
|
|
137
|
-
let isVisible;
|
|
138
|
-
|
|
103
|
+
let isVisible;
|
|
104
|
+
// Not visible if any of these are missing.
|
|
139
105
|
if (!width || !height) {
|
|
140
106
|
isVisible = false;
|
|
141
107
|
} else {
|
|
142
108
|
isVisible = true;
|
|
143
109
|
}
|
|
144
|
-
|
|
145
110
|
this.updateVisibility(isVisible);
|
|
146
111
|
});
|
|
147
|
-
|
|
148
112
|
_defineProperty(this, "updateVisibility", isVisible => {
|
|
149
113
|
if (this.lastValue !== isVisible) {
|
|
150
114
|
var _this$props$onChange, _this$props;
|
|
151
|
-
|
|
152
115
|
this.lastValue = isVisible;
|
|
153
|
-
(_this$props$onChange = (_this$props = this.props).onChange) === null || _this$props$onChange === void 0
|
|
116
|
+
(_this$props$onChange = (_this$props = this.props).onChange) === null || _this$props$onChange === void 0 || _this$props$onChange.call(_this$props, isVisible);
|
|
154
117
|
}
|
|
155
118
|
});
|
|
156
|
-
|
|
157
119
|
this.state = {
|
|
158
120
|
rectTop: 0,
|
|
159
121
|
rectBottom: 0
|
|
160
122
|
};
|
|
161
123
|
}
|
|
162
|
-
|
|
163
124
|
componentDidMount() {
|
|
164
125
|
this.lastAppStateActive = _reactNative.AppState.currentState === 'active';
|
|
165
126
|
this.appStateSubscription = _reactNative.AppState.addEventListener('change', this.handleAppStateChange);
|
|
166
|
-
|
|
167
127
|
if (this.hasValidTimeout(this.props.disabled, this.props.delay)) {
|
|
168
128
|
this.startWatching();
|
|
169
129
|
}
|
|
170
130
|
}
|
|
171
|
-
|
|
172
131
|
componentWillUnmount() {
|
|
173
132
|
var _this$appStateSubscri;
|
|
174
|
-
|
|
175
|
-
(_this$appStateSubscri = this.appStateSubscription) === null || _this$appStateSubscri === void 0 ? void 0 : _this$appStateSubscri.remove();
|
|
133
|
+
(_this$appStateSubscri = this.appStateSubscription) === null || _this$appStateSubscri === void 0 || _this$appStateSubscri.remove();
|
|
176
134
|
this.appStateSubscription = null;
|
|
177
135
|
this.stopWatching();
|
|
178
136
|
}
|
|
179
|
-
|
|
180
137
|
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
181
138
|
if (!this.hasValidTimeout(nextProps.disabled, nextProps.delay)) {
|
|
182
139
|
this.stopWatching();
|
|
@@ -184,11 +141,9 @@ class ViewPortDetector extends _react.Component {
|
|
|
184
141
|
if (this.props.propKey !== nextProps.propKey) {
|
|
185
142
|
this.lastValue = null;
|
|
186
143
|
}
|
|
187
|
-
|
|
188
144
|
this.startWatching();
|
|
189
145
|
}
|
|
190
146
|
}
|
|
191
|
-
|
|
192
147
|
render() {
|
|
193
148
|
return /*#__PURE__*/_react.default.createElement(_reactNative.View, _extends({
|
|
194
149
|
collapsable: false,
|
|
@@ -197,8 +152,6 @@ class ViewPortDetector extends _react.Component {
|
|
|
197
152
|
}
|
|
198
153
|
}, this.props), this.props.children);
|
|
199
154
|
}
|
|
200
|
-
|
|
201
155
|
}
|
|
202
|
-
|
|
203
156
|
exports.default = ViewPortDetector;
|
|
204
157
|
//# sourceMappingURL=ViewPortDetector.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ViewPortDetector.tsx"],"names":["DEFAULT_DELAY","TimeoutHandler","id","handler","handlerRef","n","clear","clearTimeout","setIntervalWithTimeout","callback","intervalMs","handleWrapper","cleared","timeout","setTimeout","ViewPortDetector","Component","constructor","props","disabled","delay","disabledValue","delayValue","AppState","currentState","nextAppState","nextAppStateActive","lastAppStateActive","checkVisibility","hasValidTimeout","stopWatching","startWatching","interval","view","updateVisibility","measure","_x","_y","width","height","_pageX","_pageY","checkInViewPort","isVisible","lastValue","onChange","state","rectTop","rectBottom","componentDidMount","appStateSubscription","addEventListener","handleAppStateChange","componentWillUnmount","remove","UNSAFE_componentWillReceiveProps","nextProps","propKey","render","component","children"],"mappings":"AAAA;;;;;;;AAEA;;AACA;;;;;;;;;;AAQA,MAAMA,aAAa,GAAG,IAAtB;;AAUA,MAAMC,cAAN,CAAqB;AAAA;AAAA,wCACe;AAAEC,MAAAA,EAAE,EAAE,CAAC;AAAP,KADf;AAAA;;AAGR,MAAPC,OAAO,GAAQ;AACjB,WAAO,KAAKC,UAAL,CAAgBF,EAAvB;AACD;;AACU,MAAPC,OAAO,CAACE,CAAD,EAAS;AAClB,SAAKD,UAAL,CAAgBF,EAAhB,GAAqBG,CAArB;AACD;;AAEDC,EAAAA,KAAK,GAAG;AACNC,IAAAA,YAAY,CAAC,KAAKH,UAAL,CAAgBF,EAAjB,CAAZ;AACD;;AAZkB;;AAerB,SAASM,sBAAT,CACEC,QADF,EAEEC,UAFF,EAIkB;AAAA,MADhBC,aACgB,uEADA,IAAIV,cAAJ,EACA;AAChB,MAAIW,OAAO,GAAG,KAAd;;AAEA,QAAMC,OAAO,GAAG,MAAM;AACpBF,IAAAA,aAAa,CAACR,OAAd,GAAwBW,UAAU,CAAC,MAAM;AACvCL,MAAAA,QAAQ,CAAC,MAAM;AACbG,QAAAA,OAAO,GAAG,IAAV;AACAD,QAAAA,aAAa,CAACL,KAAd;AACD,OAHO,CAAR;;AAIA,UAAI,CAACM,OAAL,EAAc;AACZC,QAAAA,OAAO;AACR;AACF,KARiC,EAQ/BH,UAR+B,CAAlC;AASD,GAVD;;AAWA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AiE;AAC/D,WAAKW,aAAL;AACD;AACF;;AAEDsB,EAAAA,oBAAoB,GAAG;AAAA;;AACrB,kCAAKH,oBAAL,gFAA2BI,MAA3B;AACA,SAAKJ,oBAAL,GAA4B,IAA5B;AACA,SAAKpB,YAAL;AACD;;AAUDyB,EAAAA,gCAAgC,CAACC,SAAD,EAAmB;AACjD,QAAI,CAAC,KAAK3B,eAAL,CAAqB2B,SAAS,CAACrC,QAA/B,EAAyCqC,SAAS,CAACpC,KAAnD,CAAL,EAAgE;AAC9D,WAAKU,YAAL;AACD,KAFD,MAEO;AACL,UAAI,KAAKZ,KAAL,CAAWuC,OAAX,KAAuBD,SAAS,CAACC,OAArC,EAA8C;AAC5C,aAAKb,SAAL,GAAiB,IAAjB;AACD;;AACD,WAAKb,aAAL;AACD;AACF;;AA6DD2B,EAAAA,MAAM,GAAG;AACP,wBACE,6BAAC,iBAAD;AACE,MAAA,WAAW,EAAE,KADf;AAEE,MAAA,GAAG,EAAGC,SAAD,IAAe;AAClB,aAAK1B,IAAL,GAAY0B,SAAZ;AACD;AAJH,OAKM,KAAKzC,KALX,GAOG,KAAKA,KAAL,CAAW0C,QAPd,CADF;AAWD;;AAvHD","sourcesContent":["'use strict';\n\nimport React, { Component, PropsWithChildren } from 'react';\nimport {\n AppState,\n AppStateStatus,\n NativeEventSubscription,\n View,\n ViewStyle,\n} from 'react-native';\n\nconst DEFAULT_DELAY = 1000;\n\nexport type Props = {\n disabled?: boolean;\n style?: ViewStyle;\n onChange?: (isVisible: boolean) => void;\n delay?: number;\n propKey?: any;\n};\n\nclass TimeoutHandler {\n private handlerRef: { id: any } = { id: -1 };\n\n get handler(): any {\n return this.handlerRef.id;\n }\n set handler(n: any) {\n this.handlerRef.id = n;\n }\n\n clear() {\n clearTimeout(this.handlerRef.id as any);\n }\n}\n\nfunction setIntervalWithTimeout(\n callback: (clear: () => void) => any,\n intervalMs: number,\n handleWrapper = new TimeoutHandler()\n): TimeoutHandler {\n let cleared = false;\n\n const timeout = () => {\n handleWrapper.handler = setTimeout(() => {\n callback(() => {\n cleared = true;\n handleWrapper.clear();\n });\n if (!cleared) {\n timeout();\n }\n }, intervalMs);\n };\n timeout();\n return handleWrapper;\n}\n\n/**\n * Detects when this is in the viewport and visible.\n *\n * Will not fire visibility changes for zero width/height components.\n */\nexport default class ViewPortDetector extends Component<\n PropsWithChildren<Props>\n> {\n private lastValue: boolean | null = null;\n private interval: TimeoutHandler | null = null;\n private view: View | null = null;\n private lastAppStateActive = false;\n private appStateSubscription: NativeEventSubscription | null = null;\n\n constructor(props: Props) {\n super(props);\n this.state = { rectTop: 0, rectBottom: 0 };\n }\n\n componentDidMount() {\n this.lastAppStateActive = AppState.currentState === 'active';\n this.appStateSubscription = AppState.addEventListener(\n 'change',\n this.handleAppStateChange\n );\n if (this.hasValidTimeout(this.props.disabled, this.props.delay)) {\n this.startWatching();\n }\n }\n\n componentWillUnmount() {\n this.appStateSubscription?.remove();\n this.appStateSubscription = null;\n this.stopWatching();\n }\n\n hasValidTimeout = (disabled?: boolean, delay?: number): boolean => {\n let disabledValue = disabled ?? false;\n let delayValue = delay ?? DEFAULT_DELAY;\n return (\n AppState.currentState === 'active' && !disabledValue && delayValue > 0\n );\n };\n\n UNSAFE_componentWillReceiveProps(nextProps: Props) {\n if (!this.hasValidTimeout(nextProps.disabled, nextProps.delay)) {\n this.stopWatching();\n } else {\n if (this.props.propKey !== nextProps.propKey) {\n this.lastValue = null;\n }\n this.startWatching();\n }\n }\n handleAppStateChange = (nextAppState: AppStateStatus) => {\n let nextAppStateActive = nextAppState === 'active';\n if (this.lastAppStateActive !== nextAppStateActive) {\n this.checkVisibility();\n }\n this.lastAppStateActive = nextAppStateActive;\n\n if (!this.hasValidTimeout(this.props.disabled, this.props.delay)) {\n this.stopWatching();\n } else {\n this.startWatching();\n }\n };\n\n startWatching = () => {\n if (this.interval) {\n return;\n }\n this.interval = setIntervalWithTimeout(\n this.checkVisibility,\n this.props.delay || DEFAULT_DELAY\n );\n };\n\n stopWatching = () => {\n this.interval?.clear();\n this.interval = null;\n };\n\n checkVisibility = () => {\n if (!this.view) {\n return;\n }\n\n if (AppState.currentState !== 'active') {\n this.updateVisibility(false);\n return;\n }\n\n this.view.measure((_x, _y, width, height, _pageX, _pageY) => {\n this.checkInViewPort(width, height);\n });\n };\n checkInViewPort = (width?: number, height?: number) => {\n let isVisible: boolean;\n // Not visible if any of these are missing.\n if (!width || !height) {\n isVisible = false;\n } else {\n isVisible = true;\n }\n this.updateVisibility(isVisible);\n };\n\n updateVisibility = (isVisible: boolean) => {\n if (this.lastValue !== isVisible) {\n this.lastValue = isVisible;\n this.props.onChange?.(isVisible);\n }\n };\n render() {\n return (\n <View\n collapsable={false}\n ref={(component) => {\n this.view = component;\n }}\n {...this.props}\n >\n {this.props.children}\n </View>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"names":["Object","defineProperty","exports","value","default","_react","_interopRequireWildcard","require","_reactNative","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","has","get","n","__proto__","a","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","_defineProperty","_toPropertyKey","enumerable","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","DEFAULT_DELAY","TimeoutHandler","constructor","id","handler","handlerRef","clear","clearTimeout","setIntervalWithTimeout","callback","intervalMs","handleWrapper","cleared","timeout","setTimeout","ViewPortDetector","Component","props","disabled","delay","disabledValue","delayValue","AppState","currentState","nextAppState","nextAppStateActive","lastAppStateActive","checkVisibility","hasValidTimeout","stopWatching","startWatching","interval","_this$interval","view","updateVisibility","measure","_x","_y","width","height","_pageX","_pageY","checkInViewPort","isVisible","lastValue","_this$props$onChange","_this$props","onChange","state","rectTop","rectBottom","componentDidMount","appStateSubscription","addEventListener","handleAppStateChange","componentWillUnmount","_this$appStateSubscri","remove","UNSAFE_componentWillReceiveProps","nextProps","propKey","render","createElement","View","collapsable","ref","component","children"],"sources":["ViewPortDetector.tsx"],"sourcesContent":["'use strict';\n\nimport React, { Component, type PropsWithChildren } from 'react';\nimport {\n AppState,\n type AppStateStatus,\n type NativeEventSubscription,\n View,\n type ViewStyle,\n} from 'react-native';\n\nconst DEFAULT_DELAY = 1000;\n\nexport type Props = {\n disabled?: boolean;\n style?: ViewStyle;\n onChange?: (isVisible: boolean) => void;\n delay?: number;\n propKey?: any;\n};\n\nclass TimeoutHandler {\n private handlerRef: { id: any } = { id: -1 };\n\n get handler(): any {\n return this.handlerRef.id;\n }\n set handler(n: any) {\n this.handlerRef.id = n;\n }\n\n clear() {\n clearTimeout(this.handlerRef.id as any);\n }\n}\n\nfunction setIntervalWithTimeout(\n callback: (clear: () => void) => any,\n intervalMs: number,\n handleWrapper = new TimeoutHandler()\n): TimeoutHandler {\n let cleared = false;\n\n const timeout = () => {\n handleWrapper.handler = setTimeout(() => {\n callback(() => {\n cleared = true;\n handleWrapper.clear();\n });\n if (!cleared) {\n timeout();\n }\n }, intervalMs);\n };\n timeout();\n return handleWrapper;\n}\n\n/**\n * Detects when this is in the viewport and visible.\n *\n * Will not fire visibility changes for zero width/height components.\n */\nexport default class ViewPortDetector extends Component<\n PropsWithChildren<Props>\n> {\n private lastValue: boolean | null = null;\n private interval: TimeoutHandler | null = null;\n private view: View | null = null;\n private lastAppStateActive = false;\n private appStateSubscription: NativeEventSubscription | null = null;\n\n constructor(props: Props) {\n super(props);\n this.state = { rectTop: 0, rectBottom: 0 };\n }\n\n componentDidMount() {\n this.lastAppStateActive = AppState.currentState === 'active';\n this.appStateSubscription = AppState.addEventListener(\n 'change',\n this.handleAppStateChange\n );\n if (this.hasValidTimeout(this.props.disabled, this.props.delay)) {\n this.startWatching();\n }\n }\n\n componentWillUnmount() {\n this.appStateSubscription?.remove();\n this.appStateSubscription = null;\n this.stopWatching();\n }\n\n hasValidTimeout = (disabled?: boolean, delay?: number): boolean => {\n let disabledValue = disabled ?? false;\n let delayValue = delay ?? DEFAULT_DELAY;\n return (\n AppState.currentState === 'active' && !disabledValue && delayValue > 0\n );\n };\n\n UNSAFE_componentWillReceiveProps(nextProps: Props) {\n if (!this.hasValidTimeout(nextProps.disabled, nextProps.delay)) {\n this.stopWatching();\n } else {\n if (this.props.propKey !== nextProps.propKey) {\n this.lastValue = null;\n }\n this.startWatching();\n }\n }\n handleAppStateChange = (nextAppState: AppStateStatus) => {\n let nextAppStateActive = nextAppState === 'active';\n if (this.lastAppStateActive !== nextAppStateActive) {\n this.checkVisibility();\n }\n this.lastAppStateActive = nextAppStateActive;\n\n if (!this.hasValidTimeout(this.props.disabled, this.props.delay)) {\n this.stopWatching();\n } else {\n this.startWatching();\n }\n };\n\n startWatching = () => {\n if (this.interval) {\n return;\n }\n this.interval = setIntervalWithTimeout(\n this.checkVisibility,\n this.props.delay || DEFAULT_DELAY\n );\n };\n\n stopWatching = () => {\n this.interval?.clear();\n this.interval = null;\n };\n\n checkVisibility = () => {\n if (!this.view) {\n return;\n }\n\n if (AppState.currentState !== 'active') {\n this.updateVisibility(false);\n return;\n }\n\n this.view.measure((_x, _y, width, height, _pageX, _pageY) => {\n this.checkInViewPort(width, height);\n });\n };\n checkInViewPort = (width?: number, height?: number) => {\n let isVisible: boolean;\n // Not visible if any of these are missing.\n if (!width || !height) {\n isVisible = false;\n } else {\n isVisible = true;\n }\n this.updateVisibility(isVisible);\n };\n\n updateVisibility = (isVisible: boolean) => {\n if (this.lastValue !== isVisible) {\n this.lastValue = isVisible;\n this.props.onChange?.(isVisible);\n }\n };\n render() {\n return (\n <View\n collapsable={false}\n ref={(component) => {\n this.view = component;\n }}\n {...this.props}\n >\n {this.props.children}\n </View>\n );\n }\n}\n"],"mappings":"AAAA,YAAY;;AAACA,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,KAAA;AAAA;AAAAD,OAAA,CAAAE,OAAA;AAEb,IAAAC,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAMsB,SAAAE,yBAAAC,CAAA,6BA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C,IAAI,CAAC/B,eAAe,CAAC+B,SAAS,CAACzC,QAAQ,EAAEyC,SAAS,CAACxC,KAAK,CAAC,EAAE;MAC9D,IAAI,CAACU,YAAY,CAAC,CAAC;IACrB,CAAC,MAAM;MACL,IAAI,IAAI,CAACZ,KAAK,CAAC2C,OAAO,KAAKD,SAAS,CAACC,OAAO,EAAE;QAC5C,IAAI,CAAChB,SAAS,GAAG,IAAI;MACvB;MACA,IAAI,CAACd,aAAa,CAAC,CAAC;IACtB;EACF;EA6DA+B,MAAMA,CAAA,EAAG;IACP,oBACEnG,MAAA,CAAAD,OAAA,CAAAqG,aAAA,CAACjG,YAAA,CAAAkG,IAAI,EAAAhF,QAAA;MACHiF,WAAW,EAAE,KAAM;MACnBC,GAAG,EAAGC,SAAS,IAAK;QAClB,IAAI,CAACjC,IAAI,GAAGiC,SAAS;MACvB;IAAE,GACE,IAAI,CAACjD,KAAK,GAEb,IAAI,CAACA,KAAK,CAACkD,QACR,CAAC;EAEX;AACF;AAAC5G,OAAA,CAAAE,OAAA,GAAAsD,gBAAA","ignoreList":[]}
|
package/lib/commonjs/hooks.js
CHANGED
|
@@ -9,12 +9,6 @@ Object.defineProperty(exports, "ParticipantContext", {
|
|
|
9
9
|
return _componentsReact.ParticipantContext;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
Object.defineProperty(exports, "ReceivedDataMessage", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _componentsCore.ReceivedDataMessage;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
12
|
Object.defineProperty(exports, "RoomContext", {
|
|
19
13
|
enumerable: true,
|
|
20
14
|
get: function () {
|
|
@@ -27,60 +21,6 @@ Object.defineProperty(exports, "TrackRefContext", {
|
|
|
27
21
|
return _componentsReact.TrackRefContext;
|
|
28
22
|
}
|
|
29
23
|
});
|
|
30
|
-
Object.defineProperty(exports, "TrackReference", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function () {
|
|
33
|
-
return _componentsReact.TrackReference;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
Object.defineProperty(exports, "TrackReferenceOrPlaceholder", {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function () {
|
|
39
|
-
return _componentsReact.TrackReferenceOrPlaceholder;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
Object.defineProperty(exports, "UseLocalParticipantOptions", {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
get: function () {
|
|
45
|
-
return _componentsReact.UseLocalParticipantOptions;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
Object.defineProperty(exports, "UseParticipantInfoOptions", {
|
|
49
|
-
enumerable: true,
|
|
50
|
-
get: function () {
|
|
51
|
-
return _componentsReact.UseParticipantInfoOptions;
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
Object.defineProperty(exports, "UseParticipantsOptions", {
|
|
55
|
-
enumerable: true,
|
|
56
|
-
get: function () {
|
|
57
|
-
return _componentsReact.UseParticipantsOptions;
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
Object.defineProperty(exports, "UseRemoteParticipantOptions", {
|
|
61
|
-
enumerable: true,
|
|
62
|
-
get: function () {
|
|
63
|
-
return _componentsReact.UseRemoteParticipantOptions;
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
Object.defineProperty(exports, "UseRemoteParticipantsOptions", {
|
|
67
|
-
enumerable: true,
|
|
68
|
-
get: function () {
|
|
69
|
-
return _componentsReact.UseRemoteParticipantsOptions;
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
Object.defineProperty(exports, "UseTracksOptions", {
|
|
73
|
-
enumerable: true,
|
|
74
|
-
get: function () {
|
|
75
|
-
return _componentsReact.UseTracksOptions;
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
Object.defineProperty(exports, "UseVisualStableUpdateOptions", {
|
|
79
|
-
enumerable: true,
|
|
80
|
-
get: function () {
|
|
81
|
-
return _componentsReact.UseVisualStableUpdateOptions;
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
24
|
Object.defineProperty(exports, "isTrackReference", {
|
|
85
25
|
enumerable: true,
|
|
86
26
|
get: function () {
|
|
@@ -231,8 +171,5 @@ Object.defineProperty(exports, "useVisualStableUpdate", {
|
|
|
231
171
|
return _componentsReact.useVisualStableUpdate;
|
|
232
172
|
}
|
|
233
173
|
});
|
|
234
|
-
|
|
235
174
|
var _componentsReact = require("@livekit/components-react");
|
|
236
|
-
|
|
237
|
-
var _componentsCore = require("@livekit/components-core");
|
|
238
175
|
//# sourceMappingURL=hooks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["_componentsReact","require"],"sources":["hooks.ts"],"sourcesContent":["export {\n useConnectionState,\n useDataChannel,\n useIsSpeaking,\n useLocalParticipant,\n useLocalParticipantPermissions,\n useParticipantInfo,\n useParticipants,\n useRemoteParticipants,\n useRemoteParticipant,\n useSpeakingParticipants,\n useSortedParticipants,\n useChat,\n useIsEncrypted,\n useRoomInfo,\n useIsMuted,\n useParticipantTracks,\n useLiveKitRoom,\n RoomContext,\n useRoomContext,\n ParticipantContext,\n useParticipantContext,\n TrackRefContext,\n useTrackRefContext,\n useTracks,\n isTrackReference,\n useEnsureTrackRef,\n useTrackMutedIndicator,\n useVisualStableUpdate,\n} from '@livekit/components-react';\nexport type {\n UseLocalParticipantOptions,\n UseParticipantInfoOptions,\n UseParticipantsOptions,\n UseRemoteParticipantOptions,\n UseRemoteParticipantsOptions,\n UseTracksOptions,\n TrackReference,\n TrackReferenceOrPlaceholder,\n UseVisualStableUpdateOptions,\n} from '@livekit/components-react';\n\nexport type { ReceivedDataMessage } from '@livekit/components-core';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA","ignoreList":[]}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -7,62 +7,20 @@ var _exportNames = {
|
|
|
7
7
|
registerGlobals: true,
|
|
8
8
|
AudioSession: true,
|
|
9
9
|
AndroidAudioTypePresets: true,
|
|
10
|
-
AndroidAudioTypeOptions: true,
|
|
11
|
-
AppleAudioCategory: true,
|
|
12
|
-
AppleAudioCategoryOption: true,
|
|
13
|
-
AppleAudioConfiguration: true,
|
|
14
|
-
AppleAudioMode: true,
|
|
15
|
-
AudioTrackState: true,
|
|
16
10
|
getDefaultAppleAudioConfigurationForMode: true
|
|
17
11
|
};
|
|
18
|
-
Object.defineProperty(exports, "AndroidAudioTypeOptions", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _AudioSession.AndroidAudioTypeOptions;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
12
|
Object.defineProperty(exports, "AndroidAudioTypePresets", {
|
|
25
13
|
enumerable: true,
|
|
26
14
|
get: function () {
|
|
27
15
|
return _AudioSession.AndroidAudioTypePresets;
|
|
28
16
|
}
|
|
29
17
|
});
|
|
30
|
-
Object.defineProperty(exports, "AppleAudioCategory", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function () {
|
|
33
|
-
return _AudioSession.AppleAudioCategory;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
Object.defineProperty(exports, "AppleAudioCategoryOption", {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function () {
|
|
39
|
-
return _AudioSession.AppleAudioCategoryOption;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
Object.defineProperty(exports, "AppleAudioConfiguration", {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
get: function () {
|
|
45
|
-
return _AudioSession.AppleAudioConfiguration;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
Object.defineProperty(exports, "AppleAudioMode", {
|
|
49
|
-
enumerable: true,
|
|
50
|
-
get: function () {
|
|
51
|
-
return _AudioSession.AppleAudioMode;
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
18
|
Object.defineProperty(exports, "AudioSession", {
|
|
55
19
|
enumerable: true,
|
|
56
20
|
get: function () {
|
|
57
21
|
return _AudioSession.default;
|
|
58
22
|
}
|
|
59
23
|
});
|
|
60
|
-
Object.defineProperty(exports, "AudioTrackState", {
|
|
61
|
-
enumerable: true,
|
|
62
|
-
get: function () {
|
|
63
|
-
return _AudioSession.AudioTrackState;
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
24
|
Object.defineProperty(exports, "getDefaultAppleAudioConfigurationForMode", {
|
|
67
25
|
enumerable: true,
|
|
68
26
|
get: function () {
|
|
@@ -70,19 +28,12 @@ Object.defineProperty(exports, "getDefaultAppleAudioConfigurationForMode", {
|
|
|
70
28
|
}
|
|
71
29
|
});
|
|
72
30
|
exports.registerGlobals = registerGlobals;
|
|
73
|
-
|
|
74
31
|
var _reactNativeWebrtc = require("@livekit/react-native-webrtc");
|
|
75
|
-
|
|
76
32
|
var _reactNativeUrlPolyfill = require("react-native-url-polyfill");
|
|
77
|
-
|
|
78
33
|
require("./polyfills/EncoderDecoderTogether.min.js");
|
|
79
|
-
|
|
80
34
|
var _AudioSession = _interopRequireWildcard(require("./audio/AudioSession"));
|
|
81
|
-
|
|
82
35
|
var _reactNative = require("react-native");
|
|
83
|
-
|
|
84
36
|
var _hooks = require("./hooks");
|
|
85
|
-
|
|
86
37
|
Object.keys(_hooks).forEach(function (key) {
|
|
87
38
|
if (key === "default" || key === "__esModule") return;
|
|
88
39
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -94,9 +45,7 @@ Object.keys(_hooks).forEach(function (key) {
|
|
|
94
45
|
}
|
|
95
46
|
});
|
|
96
47
|
});
|
|
97
|
-
|
|
98
48
|
var _LiveKitRoom = require("./components/LiveKitRoom");
|
|
99
|
-
|
|
100
49
|
Object.keys(_LiveKitRoom).forEach(function (key) {
|
|
101
50
|
if (key === "default" || key === "__esModule") return;
|
|
102
51
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -108,9 +57,7 @@ Object.keys(_LiveKitRoom).forEach(function (key) {
|
|
|
108
57
|
}
|
|
109
58
|
});
|
|
110
59
|
});
|
|
111
|
-
|
|
112
60
|
var _VideoTrack = require("./components/VideoTrack");
|
|
113
|
-
|
|
114
61
|
Object.keys(_VideoTrack).forEach(function (key) {
|
|
115
62
|
if (key === "default" || key === "__esModule") return;
|
|
116
63
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -122,9 +69,7 @@ Object.keys(_VideoTrack).forEach(function (key) {
|
|
|
122
69
|
}
|
|
123
70
|
});
|
|
124
71
|
});
|
|
125
|
-
|
|
126
72
|
var _VideoView = require("./components/VideoView");
|
|
127
|
-
|
|
128
73
|
Object.keys(_VideoView).forEach(function (key) {
|
|
129
74
|
if (key === "default" || key === "__esModule") return;
|
|
130
75
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -136,9 +81,7 @@ Object.keys(_VideoView).forEach(function (key) {
|
|
|
136
81
|
}
|
|
137
82
|
});
|
|
138
83
|
});
|
|
139
|
-
|
|
140
84
|
var _useParticipant = require("./useParticipant");
|
|
141
|
-
|
|
142
85
|
Object.keys(_useParticipant).forEach(function (key) {
|
|
143
86
|
if (key === "default" || key === "__esModule") return;
|
|
144
87
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -150,9 +93,7 @@ Object.keys(_useParticipant).forEach(function (key) {
|
|
|
150
93
|
}
|
|
151
94
|
});
|
|
152
95
|
});
|
|
153
|
-
|
|
154
96
|
var _useRoom = require("./useRoom");
|
|
155
|
-
|
|
156
97
|
Object.keys(_useRoom).forEach(function (key) {
|
|
157
98
|
if (key === "default" || key === "__esModule") return;
|
|
158
99
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -164,9 +105,7 @@ Object.keys(_useRoom).forEach(function (key) {
|
|
|
164
105
|
}
|
|
165
106
|
});
|
|
166
107
|
});
|
|
167
|
-
|
|
168
108
|
var _logger = require("./logger");
|
|
169
|
-
|
|
170
109
|
Object.keys(_logger).forEach(function (key) {
|
|
171
110
|
if (key === "default" || key === "__esModule") return;
|
|
172
111
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -178,9 +117,7 @@ Object.keys(_logger).forEach(function (key) {
|
|
|
178
117
|
}
|
|
179
118
|
});
|
|
180
119
|
});
|
|
181
|
-
|
|
182
120
|
var _AudioManager = require("./audio/AudioManager");
|
|
183
|
-
|
|
184
121
|
Object.keys(_AudioManager).forEach(function (key) {
|
|
185
122
|
if (key === "default" || key === "__esModule") return;
|
|
186
123
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -192,11 +129,8 @@ Object.keys(_AudioManager).forEach(function (key) {
|
|
|
192
129
|
}
|
|
193
130
|
});
|
|
194
131
|
});
|
|
195
|
-
|
|
196
|
-
function
|
|
197
|
-
|
|
198
|
-
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; }
|
|
199
|
-
|
|
132
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
133
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
200
134
|
/**
|
|
201
135
|
* Registers the required globals needed for LiveKit to work.
|
|
202
136
|
*
|
|
@@ -212,58 +146,49 @@ function registerGlobals() {
|
|
|
212
146
|
shimAsyncIterator();
|
|
213
147
|
shimIterator();
|
|
214
148
|
}
|
|
215
|
-
|
|
216
149
|
function livekitRegisterGlobals() {
|
|
217
150
|
let lkGlobal = {
|
|
218
151
|
platform: _reactNative.Platform.OS,
|
|
219
152
|
devicePixelRatio: _reactNative.PixelRatio.get()
|
|
220
|
-
};
|
|
153
|
+
};
|
|
221
154
|
|
|
155
|
+
// @ts-ignore
|
|
222
156
|
global.LiveKitReactNativeGlobal = lkGlobal;
|
|
223
157
|
}
|
|
224
|
-
|
|
225
158
|
function fixWebrtcAdapter() {
|
|
226
159
|
var _window;
|
|
227
|
-
|
|
228
160
|
// @ts-ignore
|
|
229
161
|
if (((_window = window) === null || _window === void 0 ? void 0 : _window.navigator) !== undefined) {
|
|
230
162
|
// @ts-ignore
|
|
231
163
|
const {
|
|
232
164
|
navigator
|
|
233
165
|
} = window;
|
|
234
|
-
|
|
235
166
|
if (navigator.userAgent === undefined) {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
navigator.userAgent = (_navigator$product = navigator.product) !== null && _navigator$product !== void 0 ? _navigator$product : 'Unknown';
|
|
167
|
+
navigator.userAgent = navigator.product ?? 'Unknown';
|
|
239
168
|
}
|
|
240
169
|
}
|
|
241
170
|
}
|
|
242
|
-
|
|
243
171
|
function shimPromiseAllSettled() {
|
|
244
172
|
var allSettled = require('promise.allsettled');
|
|
245
|
-
|
|
246
173
|
allSettled.shim();
|
|
247
174
|
}
|
|
248
|
-
|
|
249
175
|
function shimArrayAt() {
|
|
250
176
|
// Some versions of RN don't have Array.prototype.at, which is used by sdp-transform
|
|
251
177
|
if (!Array.prototype.at) {
|
|
252
178
|
var at = require('array.prototype.at');
|
|
253
|
-
|
|
254
179
|
at.shim();
|
|
255
180
|
}
|
|
256
181
|
}
|
|
257
|
-
|
|
258
182
|
function shimAsyncIterator() {
|
|
259
183
|
var shim = require('well-known-symbols/Symbol.asyncIterator/shim');
|
|
260
|
-
|
|
261
184
|
shim();
|
|
262
185
|
}
|
|
263
|
-
|
|
264
186
|
function shimIterator() {
|
|
265
187
|
var shim = require('well-known-symbols/Symbol.iterator/shim');
|
|
266
|
-
|
|
267
188
|
shim();
|
|
268
189
|
}
|
|
190
|
+
|
|
191
|
+
// deprecated
|
|
192
|
+
// deprecated
|
|
193
|
+
// deprecated
|
|
269
194
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["_reactNativeWebrtc","require","_reactNativeUrlPolyfill","_AudioSession","_interopRequireWildcard","_reactNative","_hooks","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_LiveKitRoom","_VideoTrack","_VideoView","_useParticipant","_useRoom","_logger","_AudioManager","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","n","__proto__","a","getOwnPropertyDescriptor","u","i","set","registerGlobals","webrtcRegisterGlobals","livekitRegisterGlobals","setupURLPolyfill","fixWebrtcAdapter","shimPromiseAllSettled","shimArrayAt","shimAsyncIterator","shimIterator","lkGlobal","platform","Platform","OS","devicePixelRatio","PixelRatio","global","LiveKitReactNativeGlobal","_window","window","navigator","undefined","userAgent","product","allSettled","shim","Array","at"],"sources":["index.tsx"],"sourcesContent":["import { registerGlobals as webrtcRegisterGlobals } from '@livekit/react-native-webrtc';\nimport { setupURLPolyfill } from 'react-native-url-polyfill';\nimport './polyfills/EncoderDecoderTogether.min.js';\nimport AudioSession, {\n AndroidAudioTypePresets,\n type AndroidAudioTypeOptions,\n type AppleAudioCategory,\n type AppleAudioCategoryOption,\n type AppleAudioConfiguration,\n type AppleAudioMode,\n type AudioTrackState,\n getDefaultAppleAudioConfigurationForMode,\n} from './audio/AudioSession';\nimport type { AudioConfiguration } from './audio/AudioSession';\nimport { PixelRatio, Platform } from 'react-native';\nimport type { LiveKitReactNativeInfo } from 'livekit-client';\nimport type { LogLevel, SetLogLevelOptions } from './logger';\n\n/**\n * Registers the required globals needed for LiveKit to work.\n *\n * Must be called before using LiveKit.\n */\nexport function registerGlobals() {\n webrtcRegisterGlobals();\n livekitRegisterGlobals();\n setupURLPolyfill();\n fixWebrtcAdapter();\n shimPromiseAllSettled();\n shimArrayAt();\n shimAsyncIterator();\n shimIterator();\n}\nfunction livekitRegisterGlobals() {\n let lkGlobal: LiveKitReactNativeInfo = {\n platform: Platform.OS,\n devicePixelRatio: PixelRatio.get(),\n };\n\n // @ts-ignore\n global.LiveKitReactNativeGlobal = lkGlobal;\n}\n\nfunction fixWebrtcAdapter() {\n // @ts-ignore\n if (window?.navigator !== undefined) {\n // @ts-ignore\n const { navigator } = window;\n if (navigator.userAgent === undefined) {\n navigator.userAgent = navigator.product ?? 'Unknown';\n }\n }\n}\n\nfunction shimPromiseAllSettled() {\n var allSettled = require('promise.allsettled');\n allSettled.shim();\n}\n\nfunction shimArrayAt() {\n // Some versions of RN don't have Array.prototype.at, which is used by sdp-transform\n if (!Array.prototype.at) {\n var at = require('array.prototype.at');\n at.shim();\n }\n}\n\nfunction shimAsyncIterator() {\n var shim = require('well-known-symbols/Symbol.asyncIterator/shim');\n shim();\n}\n\nfunction shimIterator() {\n var shim = require('well-known-symbols/Symbol.iterator/shim');\n shim();\n}\nexport * from './hooks';\nexport * from './components/LiveKitRoom';\nexport * from './components/VideoTrack';\nexport * from './components/VideoView'; // deprecated\nexport * from './useParticipant'; // deprecated\nexport * from './useRoom'; // deprecated\nexport * from './logger';\nexport * from './audio/AudioManager';\n\nexport {\n AudioSession,\n AndroidAudioTypePresets,\n getDefaultAppleAudioConfigurationForMode,\n};\nexport type {\n AudioConfiguration,\n AndroidAudioTypeOptions,\n AppleAudioCategory,\n AppleAudioCategoryOption,\n AppleAudioConfiguration,\n AppleAudioMode,\n AudioTrackState,\n LogLevel,\n SetLogLevelOptions,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAD,OAAA;AACAA,OAAA;AACA,IAAAE,aAAA,GAAAC,uBAAA,CAAAH,OAAA;AAWA,IAAAI,YAAA,GAAAJ,OAAA;AA8DA,IAAAK,MAAA,GAAAL,OAAA;AAAAM,MAAA,CAAAC,IAAA,CAAAF,MAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,MAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,MAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,YAAA,GAAAlB,OAAA;AAAAM,MAAA,CAAAC,IAAA,CAAAW,YAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EA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