@livekit/react-native 2.0.2 → 2.1.0-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/lib/commonjs/components/LiveKitRoom.js +43 -0
- package/lib/commonjs/components/LiveKitRoom.js.map +1 -0
- package/lib/commonjs/components/VideoTrack.js +171 -0
- package/lib/commonjs/components/VideoTrack.js.map +1 -0
- package/lib/commonjs/components/VideoView.js +3 -0
- package/lib/commonjs/components/VideoView.js.map +1 -1
- package/lib/commonjs/hooks.js +232 -0
- package/lib/commonjs/hooks.js.map +1 -0
- package/lib/commonjs/index.js +42 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/useParticipant.js +1 -0
- package/lib/commonjs/useParticipant.js.map +1 -1
- package/lib/commonjs/useRoom.js +1 -0
- package/lib/commonjs/useRoom.js.map +1 -1
- package/lib/module/components/LiveKitRoom.js +32 -0
- package/lib/module/components/LiveKitRoom.js.map +1 -0
- package/lib/module/components/VideoTrack.js +152 -0
- package/lib/module/components/VideoTrack.js.map +1 -0
- package/lib/module/components/VideoView.js +7 -0
- package/lib/module/components/VideoView.js.map +1 -1
- package/lib/module/hooks.js +3 -0
- package/lib/module/hooks.js.map +1 -0
- package/lib/module/index.js +9 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/useParticipant.js +3 -0
- package/lib/module/useParticipant.js.map +1 -1
- package/lib/module/useRoom.js +2 -0
- package/lib/module/useRoom.js.map +1 -1
- package/lib/typescript/components/LiveKitRoom.d.ts +90 -0
- package/lib/typescript/components/VideoTrack.d.ts +11 -0
- package/lib/typescript/components/VideoView.d.ts +6 -0
- package/lib/typescript/hooks.d.ts +2 -0
- package/lib/typescript/index.d.ts +3 -0
- package/lib/typescript/useParticipant.d.ts +2 -0
- package/lib/typescript/useRoom.d.ts +1 -0
- package/livekit-react-native.podspec +5 -0
- package/package.json +2 -1
- package/src/components/LiveKitRoom.tsx +118 -0
- package/src/components/VideoTrack.tsx +150 -0
- package/src/components/VideoView.tsx +6 -0
- package/src/hooks.ts +40 -0
- package/src/index.tsx +6 -4
- package/src/useParticipant.ts +2 -1
- package/src/useRoom.ts +1 -0
- package/android/local.properties +0 -8
- package/ios/LivekitReactNative.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- package/ios/LivekitReactNative.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/ios/LivekitReactNative.xcodeproj/project.xcworkspace/xcuserdata/davidliu.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/LivekitReactNative.xcodeproj/xcuserdata/davidliu.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.LiveKitRoom = LiveKitRoom;
|
|
7
|
+
|
|
8
|
+
var _componentsReact = require("@livekit/components-react");
|
|
9
|
+
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
+
|
|
14
|
+
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; }
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The `LiveKitRoom` component provides the room context to all its child components.
|
|
18
|
+
* It is generally the starting point of your LiveKit app and the root of the LiveKit component tree.
|
|
19
|
+
* It provides the room state as a React context to all child components, so you don't have to pass it yourself.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <LiveKitRoom
|
|
24
|
+
* token='<livekit-token>'
|
|
25
|
+
* serverUrl='<url-to-livekit-server>'
|
|
26
|
+
* connect={true}
|
|
27
|
+
* >
|
|
28
|
+
* ...
|
|
29
|
+
* </LiveKitRoom>
|
|
30
|
+
* ```
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
function LiveKitRoom(props) {
|
|
34
|
+
const {
|
|
35
|
+
room
|
|
36
|
+
} = (0, _componentsReact.useLiveKitRoom)(props);
|
|
37
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, room && /*#__PURE__*/React.createElement(_componentsReact.RoomContext.Provider, {
|
|
38
|
+
value: room
|
|
39
|
+
}, /*#__PURE__*/React.createElement(_componentsReact.LKFeatureContext.Provider, {
|
|
40
|
+
value: props.featureFlags
|
|
41
|
+
}, props.children)));
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=LiveKitRoom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["LiveKitRoom.tsx"],"names":["LiveKitRoom","props","room","featureFlags","children"],"mappings":";;;;;;;AAAA;;AAcA;;;;;;AAyEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,WAAT,CAAqBC,KAArB,EAAuE;AAC5E,QAAM;AAAEC,IAAAA;AAAF,MAAW,qCAAeD,KAAf,CAAjB;AACA,sBACE,0CACGC,IAAI,iBACH,oBAAC,4BAAD,CAAa,QAAb;AAAsB,IAAA,KAAK,EAAEA;AAA7B,kBACE,oBAAC,iCAAD,CAAkB,QAAlB;AAA2B,IAAA,KAAK,EAAED,KAAK,CAACE;AAAxC,KACGF,KAAK,CAACG,QADT,CADF,CAFJ,CADF;AAWD","sourcesContent":["import {\n FeatureFlags,\n LKFeatureContext,\n RoomContext,\n useLiveKitRoom,\n} from '@livekit/components-react';\nimport type {\n AudioCaptureOptions,\n RoomConnectOptions,\n RoomOptions,\n ScreenShareCaptureOptions,\n VideoCaptureOptions,\n} from 'livekit-client';\nimport type { MediaDeviceFailure, Room } from 'livekit-client';\nimport * as React from 'react';\n\n/** @public */\nexport interface LiveKitRoomProps {\n /**\n * URL to the LiveKit server.\n * For example: `wss://<domain>.livekit.cloud`\n * To simplify the implementation, `undefined` is also accepted as an intermediate value, but only with a valid string url can the connection be established.\n */\n serverUrl: string | undefined;\n /**\n * A user specific access token for a client to authenticate to the room.\n * This token is necessary to establish a connection to the room.\n * To simplify the implementation, `undefined` is also accepted as an intermediate value, but only with a valid string token can the connection be established.\n *\n * @see https://docs.livekit.io/cloud/project-management/keys-and-tokens/#generating-access-tokens\n */\n token: string | undefined;\n /**\n * Publish audio immediately after connecting to your LiveKit room.\n * @defaultValue `false`\n * @see https://docs.livekit.io/client-sdk-js/interfaces/AudioCaptureOptions.html\n */\n audio?: AudioCaptureOptions | boolean;\n /**\n * Publish video immediately after connecting to your LiveKit room.\n * @defaultValue `false`\n * @see https://docs.livekit.io/client-sdk-js/interfaces/VideoCaptureOptions.html\n */\n video?: VideoCaptureOptions | boolean;\n /**\n * Publish screen share immediately after connecting to your LiveKit room.\n * @defaultValue `false`\n * @see https://docs.livekit.io/client-sdk-js/interfaces/ScreenShareCaptureOptions.html\n */\n screen?: ScreenShareCaptureOptions | boolean;\n /**\n * If set to true a connection to LiveKit room is initiated.\n * @defaultValue `false`\n */\n connect?: boolean;\n /**\n * Options for when creating a new room.\n * When you pass your own room instance to this component, these options have no effect.\n * Instead, set the options directly in the room instance.\n *\n * @see https://docs.livekit.io/client-sdk-js/interfaces/RoomOptions.html\n */\n options?: RoomOptions;\n /**\n * Define options how to connect to the LiveKit server.\n *\n * @see https://docs.livekit.io/client-sdk-js/interfaces/RoomConnectOptions.html\n */\n connectOptions?: RoomConnectOptions;\n onConnected?: () => void;\n onDisconnected?: () => void;\n onError?: (error: Error) => void;\n onMediaDeviceFailure?: (failure?: MediaDeviceFailure) => void;\n onEncryptionError?: (error: Error) => void;\n /**\n * Optional room instance.\n * By passing your own room instance you overwrite the `options` parameter,\n * make sure to set the options directly on the room instance itself.\n */\n room?: Room;\n\n simulateParticipants?: number | undefined;\n\n /** @experimental */\n featureFlags?: FeatureFlags | undefined;\n}\n\n/**\n * The `LiveKitRoom` component provides the room context to all its child components.\n * It is generally the starting point of your LiveKit app and the root of the LiveKit component tree.\n * It provides the room state as a React context to all child components, so you don't have to pass it yourself.\n *\n * @example\n * ```tsx\n * <LiveKitRoom\n * token='<livekit-token>'\n * serverUrl='<url-to-livekit-server>'\n * connect={true}\n * >\n * ...\n * </LiveKitRoom>\n * ```\n * @public\n */\nexport function LiveKitRoom(props: React.PropsWithChildren<LiveKitRoomProps>) {\n const { room } = useLiveKitRoom(props);\n return (\n <>\n {room && (\n <RoomContext.Provider value={room}>\n <LKFeatureContext.Provider value={props.featureFlags}>\n {props.children}\n </LKFeatureContext.Provider>\n </RoomContext.Provider>\n )}\n </>\n );\n}\n"]}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.VideoTrack = void 0;
|
|
7
|
+
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _reactNative = require("react-native");
|
|
11
|
+
|
|
12
|
+
var _livekitClient = require("livekit-client");
|
|
13
|
+
|
|
14
|
+
var _reactNativeWebrtc = require("@livekit/react-native-webrtc");
|
|
15
|
+
|
|
16
|
+
var _ViewPortDetector = _interopRequireDefault(require("./ViewPortDetector"));
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
20
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
|
+
|
|
22
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
+
|
|
24
|
+
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; }
|
|
25
|
+
|
|
26
|
+
const VideoTrack = _ref => {
|
|
27
|
+
var _mediaStream$toURL;
|
|
28
|
+
|
|
29
|
+
let {
|
|
30
|
+
style = {},
|
|
31
|
+
trackRef,
|
|
32
|
+
objectFit = 'cover',
|
|
33
|
+
zOrder,
|
|
34
|
+
mirror
|
|
35
|
+
} = _ref;
|
|
36
|
+
const [elementInfo] = (0, React.useState)(() => {
|
|
37
|
+
var _trackRef$publication;
|
|
38
|
+
|
|
39
|
+
let info = new VideoTrackElementInfo();
|
|
40
|
+
info.id = trackRef === null || trackRef === void 0 ? void 0 : (_trackRef$publication = trackRef.publication) === null || _trackRef$publication === void 0 ? void 0 : _trackRef$publication.trackSid;
|
|
41
|
+
return info;
|
|
42
|
+
});
|
|
43
|
+
const layoutOnChange = (0, React.useCallback)(event => elementInfo.onLayout(event), [elementInfo]);
|
|
44
|
+
const visibilityOnChange = (0, React.useCallback)(isVisible => elementInfo.onVisibility(isVisible), [elementInfo]);
|
|
45
|
+
const videoTrack = trackRef === null || trackRef === void 0 ? void 0 : trackRef.publication.track;
|
|
46
|
+
const shouldObserveVisibility = (0, React.useMemo)(() => {
|
|
47
|
+
return videoTrack instanceof _livekitClient.RemoteVideoTrack && videoTrack.isAdaptiveStream;
|
|
48
|
+
}, [videoTrack]);
|
|
49
|
+
const [mediaStream, setMediaStream] = (0, React.useState)(videoTrack === null || videoTrack === void 0 ? void 0 : videoTrack.mediaStream);
|
|
50
|
+
(0, React.useEffect)(() => {
|
|
51
|
+
setMediaStream(videoTrack === null || videoTrack === void 0 ? void 0 : videoTrack.mediaStream);
|
|
52
|
+
|
|
53
|
+
if (videoTrack instanceof _livekitClient.LocalVideoTrack) {
|
|
54
|
+
const onRestarted = track => {
|
|
55
|
+
setMediaStream(track === null || track === void 0 ? void 0 : track.mediaStream);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
videoTrack.on(_livekitClient.TrackEvent.Restarted, onRestarted);
|
|
59
|
+
return () => {
|
|
60
|
+
videoTrack.off(_livekitClient.TrackEvent.Restarted, onRestarted);
|
|
61
|
+
};
|
|
62
|
+
} else {
|
|
63
|
+
return () => {};
|
|
64
|
+
}
|
|
65
|
+
}, [videoTrack]);
|
|
66
|
+
(0, React.useEffect)(() => {
|
|
67
|
+
if (videoTrack instanceof _livekitClient.RemoteVideoTrack && videoTrack.isAdaptiveStream) {
|
|
68
|
+
videoTrack === null || videoTrack === void 0 ? void 0 : videoTrack.observeElementInfo(elementInfo);
|
|
69
|
+
return () => {
|
|
70
|
+
videoTrack === null || videoTrack === void 0 ? void 0 : videoTrack.stopObservingElementInfo(elementInfo);
|
|
71
|
+
};
|
|
72
|
+
} else {
|
|
73
|
+
return () => {};
|
|
74
|
+
}
|
|
75
|
+
}, [videoTrack, elementInfo]);
|
|
76
|
+
return /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
77
|
+
style: { ...style,
|
|
78
|
+
...styles.container
|
|
79
|
+
},
|
|
80
|
+
onLayout: layoutOnChange
|
|
81
|
+
}, /*#__PURE__*/React.createElement(_ViewPortDetector.default, {
|
|
82
|
+
onChange: visibilityOnChange,
|
|
83
|
+
style: styles.videoTrack,
|
|
84
|
+
disabled: !shouldObserveVisibility,
|
|
85
|
+
propKey: videoTrack
|
|
86
|
+
}, /*#__PURE__*/React.createElement(_reactNativeWebrtc.RTCView, {
|
|
87
|
+
style: styles.videoTrack,
|
|
88
|
+
streamURL: (_mediaStream$toURL = mediaStream === null || mediaStream === void 0 ? void 0 : mediaStream.toURL()) !== null && _mediaStream$toURL !== void 0 ? _mediaStream$toURL : '',
|
|
89
|
+
objectFit: objectFit,
|
|
90
|
+
zOrder: zOrder,
|
|
91
|
+
mirror: mirror
|
|
92
|
+
})));
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
exports.VideoTrack = VideoTrack;
|
|
96
|
+
|
|
97
|
+
const styles = _reactNative.StyleSheet.create({
|
|
98
|
+
container: {},
|
|
99
|
+
videoTrack: {
|
|
100
|
+
flex: 1,
|
|
101
|
+
width: '100%'
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
class VideoTrackElementInfo {
|
|
106
|
+
constructor() {
|
|
107
|
+
_defineProperty(this, "element", {});
|
|
108
|
+
|
|
109
|
+
_defineProperty(this, "something", void 0);
|
|
110
|
+
|
|
111
|
+
_defineProperty(this, "id", void 0);
|
|
112
|
+
|
|
113
|
+
_defineProperty(this, "_width", 0);
|
|
114
|
+
|
|
115
|
+
_defineProperty(this, "_height", 0);
|
|
116
|
+
|
|
117
|
+
_defineProperty(this, "_observing", false);
|
|
118
|
+
|
|
119
|
+
_defineProperty(this, "visible", true);
|
|
120
|
+
|
|
121
|
+
_defineProperty(this, "visibilityChangedAt", void 0);
|
|
122
|
+
|
|
123
|
+
_defineProperty(this, "pictureInPicture", false);
|
|
124
|
+
|
|
125
|
+
_defineProperty(this, "handleResize", void 0);
|
|
126
|
+
|
|
127
|
+
_defineProperty(this, "handleVisibilityChanged", void 0);
|
|
128
|
+
|
|
129
|
+
_defineProperty(this, "width", () => this._width);
|
|
130
|
+
|
|
131
|
+
_defineProperty(this, "height", () => this._height);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
observe() {
|
|
135
|
+
this._observing = true;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
stopObserving() {
|
|
139
|
+
this._observing = false;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
onLayout(event) {
|
|
143
|
+
let {
|
|
144
|
+
width,
|
|
145
|
+
height
|
|
146
|
+
} = event.nativeEvent.layout;
|
|
147
|
+
this._width = width;
|
|
148
|
+
this._height = height;
|
|
149
|
+
|
|
150
|
+
if (this._observing) {
|
|
151
|
+
var _this$handleResize;
|
|
152
|
+
|
|
153
|
+
(_this$handleResize = this.handleResize) === null || _this$handleResize === void 0 ? void 0 : _this$handleResize.call(this);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
onVisibility(isVisible) {
|
|
158
|
+
if (this.visible !== isVisible) {
|
|
159
|
+
this.visible = isVisible;
|
|
160
|
+
this.visibilityChangedAt = Date.now();
|
|
161
|
+
|
|
162
|
+
if (this._observing) {
|
|
163
|
+
var _this$handleVisibilit;
|
|
164
|
+
|
|
165
|
+
(_this$handleVisibilit = this.handleVisibilityChanged) === null || _this$handleVisibilit === void 0 ? void 0 : _this$handleVisibilit.call(this);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=VideoTrack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["VideoTrack.tsx"],"names":["VideoTrack","style","trackRef","objectFit","zOrder","mirror","elementInfo","info","VideoTrackElementInfo","id","publication","trackSid","layoutOnChange","event","onLayout","visibilityOnChange","isVisible","onVisibility","videoTrack","track","shouldObserveVisibility","RemoteVideoTrack","isAdaptiveStream","mediaStream","setMediaStream","LocalVideoTrack","onRestarted","on","TrackEvent","Restarted","off","observeElementInfo","stopObservingElementInfo","styles","container","toURL","StyleSheet","create","flex","width","_width","_height","observe","_observing","stopObserving","height","nativeEvent","layout","handleResize","visible","visibilityChangedAt","Date","now","handleVisibilityChanged"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AAMA;;AAGA;;;;;;;;;;AAWO,MAAMA,UAAU,GAAG,QAMH;AAAA;;AAAA,MANI;AACzBC,IAAAA,KAAK,GAAG,EADiB;AAEzBC,IAAAA,QAFyB;AAGzBC,IAAAA,SAAS,GAAG,OAHa;AAIzBC,IAAAA,MAJyB;AAKzBC,IAAAA;AALyB,GAMJ;AACrB,QAAM,CAACC,WAAD,IAAgB,oBAAS,MAAM;AAAA;;AACnC,QAAIC,IAAI,GAAG,IAAIC,qBAAJ,EAAX;AACAD,IAAAA,IAAI,CAACE,EAAL,GAAUP,QAAV,aAAUA,QAAV,gDAAUA,QAAQ,CAAEQ,WAApB,0DAAU,sBAAuBC,QAAjC;AACA,WAAOJ,IAAP;AACD,GAJqB,CAAtB;AAMA,QAAMK,cAAc,GAAG,uBACpBC,KAAD,IAA8BP,WAAW,CAACQ,QAAZ,CAAqBD,KAArB,CADT,EAErB,CAACP,WAAD,CAFqB,CAAvB;AAIA,QAAMS,kBAAkB,GAAG,uBACxBC,SAAD,IAAwBV,WAAW,CAACW,YAAZ,CAAyBD,SAAzB,CADC,EAEzB,CAACV,WAAD,CAFyB,CAA3B;AAKA,QA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ACD;;AAED7B,EAAAA,QAAQ,CAACD,KAAD,EAA2B;AACjC,QAAI;AAAE0B,MAAAA,KAAF;AAASM,MAAAA;AAAT,QAAoBhC,KAAK,CAACiC,WAAN,CAAkBC,MAA1C;AACA,SAAKP,MAAL,GAAcD,KAAd;AACA,SAAKE,OAAL,GAAeI,MAAf;;AAEA,QAAI,KAAKF,UAAT,EAAqB;AAAA;;AACnB,iCAAKK,YAAL;AACD;AACF;;AACD/B,EAAAA,YAAY,CAACD,SAAD,EAAqB;AAC/B,QAAI,KAAKiC,OAAL,KAAiBjC,SAArB,EAAgC;AAC9B,WAAKiC,OAAL,GAAejC,SAAf;AACA,WAAKkC,mBAAL,GAA2BC,IAAI,CAACC,GAAL,EAA3B;;AACA,UAAI,KAAKT,UAAT,EAAqB;AAAA;;AACnB,sCAAKU,uBAAL;AACD;AACF;AACF;;AAvCgD","sourcesContent":["import * as React from 'react';\n\nimport { LayoutChangeEvent, StyleSheet, View, ViewStyle } from 'react-native';\nimport {\n ElementInfo,\n LocalVideoTrack,\n Track,\n TrackEvent,\n} from 'livekit-client';\nimport { RTCView } from '@livekit/react-native-webrtc';\nimport { useCallback, useEffect, useMemo, useState } from 'react';\nimport { RemoteVideoTrack } from 'livekit-client';\nimport ViewPortDetector from './ViewPortDetector';\nimport type { TrackReference } from '@livekit/components-react';\n\nexport type VideoTrackProps = {\n trackRef: TrackReference | undefined;\n style?: ViewStyle;\n objectFit?: 'cover' | 'contain' | undefined;\n mirror?: boolean;\n zOrder?: number;\n};\n\nexport const VideoTrack = ({\n style = {},\n trackRef,\n objectFit = 'cover',\n zOrder,\n mirror,\n}: VideoTrackProps) => {\n const [elementInfo] = useState(() => {\n let info = new VideoTrackElementInfo();\n info.id = trackRef?.publication?.trackSid;\n return info;\n });\n\n const layoutOnChange = useCallback(\n (event: LayoutChangeEvent) => elementInfo.onLayout(event),\n [elementInfo]\n );\n const visibilityOnChange = useCallback(\n (isVisible: boolean) => elementInfo.onVisibility(isVisible),\n [elementInfo]\n );\n\n const videoTrack = trackRef?.publication.track;\n\n const shouldObserveVisibility = useMemo(() => {\n return (\n videoTrack instanceof RemoteVideoTrack && videoTrack.isAdaptiveStream\n );\n }, [videoTrack]);\n\n const [mediaStream, setMediaStream] = useState(videoTrack?.mediaStream);\n useEffect(() => {\n setMediaStream(videoTrack?.mediaStream);\n if (videoTrack instanceof LocalVideoTrack) {\n const onRestarted = (track: Track | null) => {\n setMediaStream(track?.mediaStream);\n };\n videoTrack.on(TrackEvent.Restarted, onRestarted);\n\n return () => {\n videoTrack.off(TrackEvent.Restarted, onRestarted);\n };\n } else {\n return () => {};\n }\n }, [videoTrack]);\n\n useEffect(() => {\n if (videoTrack instanceof RemoteVideoTrack && videoTrack.isAdaptiveStream) {\n videoTrack?.observeElementInfo(elementInfo);\n return () => {\n videoTrack?.stopObservingElementInfo(elementInfo);\n };\n } else {\n return () => {};\n }\n }, [videoTrack, elementInfo]);\n\n return (\n <View style={{ ...style, ...styles.container }} onLayout={layoutOnChange}>\n <ViewPortDetector\n onChange={visibilityOnChange}\n style={styles.videoTrack}\n disabled={!shouldObserveVisibility}\n propKey={videoTrack}\n >\n <RTCView\n style={styles.videoTrack}\n streamURL={mediaStream?.toURL() ?? ''}\n objectFit={objectFit}\n zOrder={zOrder}\n mirror={mirror}\n />\n </ViewPortDetector>\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n container: {},\n videoTrack: {\n flex: 1,\n width: '100%',\n },\n});\n\nclass VideoTrackElementInfo implements ElementInfo {\n element: object = {};\n something?: any;\n id?: string;\n _width = 0;\n _height = 0;\n _observing = false;\n visible: boolean = true;\n visibilityChangedAt: number | undefined;\n pictureInPicture = false;\n handleResize?: (() => void) | undefined;\n handleVisibilityChanged?: (() => void) | undefined;\n width = () => this._width;\n height = () => this._height;\n\n observe(): void {\n this._observing = true;\n }\n stopObserving(): void {\n this._observing = false;\n }\n\n onLayout(event: LayoutChangeEvent) {\n let { width, height } = event.nativeEvent.layout;\n this._width = width;\n this._height = height;\n\n if (this._observing) {\n this.handleResize?.();\n }\n }\n onVisibility(isVisible: boolean) {\n if (this.visible !== isVisible) {\n this.visible = isVisible;\n this.visibilityChangedAt = Date.now();\n if (this._observing) {\n this.handleVisibilityChanged?.();\n }\n }\n }\n}\n"]}
|
|
@@ -23,6 +23,9 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
23
23
|
|
|
24
24
|
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; }
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated use `VideoTrack` and `VideoTrackProps` instead.
|
|
28
|
+
*/
|
|
26
29
|
const VideoView = _ref => {
|
|
27
30
|
var _mediaStream$toURL;
|
|
28
31
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["VideoView.tsx"],"names":["VideoView","style","videoTrack","objectFit","zOrder","mirror","elementInfo","info","VideoViewElementInfo","id","sid","something","layoutOnChange","event","onLayout","visibilityOnChange","isVisible","onVisibility","shouldObserveVisibility","RemoteVideoTrack","isAdaptiveStream","mediaStream","setMediaStream","LocalVideoTrack","onRestarted","track","on","TrackEvent","Restarted","off","observeElementInfo","stopObservingElementInfo","styles","container","videoView","toURL","StyleSheet","create","flex","width","_width","_height","observe","_observing","stopObserving","height","nativeEvent","layout","handleResize","visible","visibilityChangedAt","Date","now","handleVisibilityChanged"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AAOA;;AAGA;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["VideoView.tsx"],"names":["VideoView","style","videoTrack","objectFit","zOrder","mirror","elementInfo","info","VideoViewElementInfo","id","sid","something","layoutOnChange","event","onLayout","visibilityOnChange","isVisible","onVisibility","shouldObserveVisibility","RemoteVideoTrack","isAdaptiveStream","mediaStream","setMediaStream","LocalVideoTrack","onRestarted","track","on","TrackEvent","Restarted","off","observeElementInfo","stopObservingElementInfo","styles","container","videoView","toURL","StyleSheet","create","flex","width","_width","_height","observe","_observing","stopObserving","height","nativeEvent","layout","handleResize","visible","visibilityChangedAt","Date","now","handleVisibilityChanged"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AAOA;;AAGA;;;;;;;;;;AAaA;AACA;AACA;AACO,MAAMA,SAAS,GAAG,QAMZ;AAAA;;AAAA,MANa;AACxBC,IAAAA,KAAK,GAAG,EADgB;AAExBC,IAAAA,UAFwB;AAGxBC,IAAAA,SAAS,GAAG,OAHY;AAIxBC,IAAAA,MAJwB;AAKxBC,IAAAA;AALwB,GAMb;AACX,QAAM,CAACC,WAAD,IAAgB,oBAAS,MAAM;AACnC,QAAIC,IAAI,GAAG,IAAIC,oBAAJ,EAAX;AACAD,IAAAA,IAAI,CAACE,EAAL,GAAUP,UAAV,aAAUA,UAAV,uBAAUA,UAAU,CAAEQ,GAAtB;AACAH,IAAAA,IAAI,CAACI,SAAL,GAAiBT,UAAjB;AACA,WAAOK,IAAP;AACD,GALqB,CAAtB;AAOA,QAAMK,cAAc,GAAG,uBACpBC,KAAD,IAA8BP,WAAW,CAACQ,QAAZ,CAAqBD,KAArB,CADT,EAErB,CAACP,WAAD,CAFqB,CAAvB;AAIA,QAAMS,kBAAkB,GAAG,uBACxBC,SAAD,IAAwBV,WAAW,CAACW,YAAZ,CAAyBD,SAAzB,CADC,EAEzB,CAACV,WAAD,CAFyB,CAA3B;AAIA,QAAMY,uBAAuB,GAAG,mBAAQ,MAAM;AAC5C,WACEhB,UAAU,YAAYiB,+BAAtB,IAA0CjB,UAAU,CAACkB,gBADvD;AAGD,GAJ+B,EAI7B,CAAClB,UAAD,CAJ6B,CAAhC;AAMA,QAAM,CAACmB,WAAD,EAAcC,cAAd,IAAgC,oBAASpB,UAAT,aAASA,UAAT,uBAASA,UAAU,CAAEmB,WAArB,CAAtC;AACA,uBAAU,MAAM;AACdC,IAAAA,cAAc,CAACpB,UAAD,aAACA,UAAD,uBA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GAAejC,SAAf;AACA,WAAKkC,mBAAL,GAA2BC,IAAI,CAACC,GAAL,EAA3B;;AACA,UAAI,KAAKT,UAAT,EAAqB;AAAA;;AACnB,sCAAKU,uBAAL;AACD;AACF;AACF;;AAvC+C","sourcesContent":["import * as React from 'react';\n\nimport { LayoutChangeEvent, StyleSheet, View, ViewStyle } from 'react-native';\nimport {\n ElementInfo,\n LocalVideoTrack,\n Track,\n TrackEvent,\n VideoTrack,\n} from 'livekit-client';\nimport { RTCView } from '@livekit/react-native-webrtc';\nimport { useCallback, useEffect, useMemo, useState } from 'react';\nimport { RemoteVideoTrack } from 'livekit-client';\nimport ViewPortDetector from './ViewPortDetector';\n\n/**\n * @deprecated use `VideoTrack` and `VideoTrackProps` instead.\n */\nexport type Props = {\n videoTrack?: VideoTrack | undefined;\n style?: ViewStyle;\n objectFit?: 'cover' | 'contain' | undefined;\n mirror?: boolean;\n zOrder?: number;\n};\n\n/**\n * @deprecated use `VideoTrack` and `VideoTrackProps` instead.\n */\nexport const VideoView = ({\n style = {},\n videoTrack,\n objectFit = 'cover',\n zOrder,\n mirror,\n}: Props) => {\n const [elementInfo] = useState(() => {\n let info = new VideoViewElementInfo();\n info.id = videoTrack?.sid;\n info.something = videoTrack;\n return info;\n });\n\n const layoutOnChange = useCallback(\n (event: LayoutChangeEvent) => elementInfo.onLayout(event),\n [elementInfo]\n );\n const visibilityOnChange = useCallback(\n (isVisible: boolean) => elementInfo.onVisibility(isVisible),\n [elementInfo]\n );\n const shouldObserveVisibility = useMemo(() => {\n return (\n videoTrack instanceof RemoteVideoTrack && videoTrack.isAdaptiveStream\n );\n }, [videoTrack]);\n\n const [mediaStream, setMediaStream] = useState(videoTrack?.mediaStream);\n useEffect(() => {\n setMediaStream(videoTrack?.mediaStream);\n if (videoTrack instanceof LocalVideoTrack) {\n const onRestarted = (track: Track | null) => {\n setMediaStream(track?.mediaStream);\n };\n videoTrack.on(TrackEvent.Restarted, onRestarted);\n\n return () => {\n videoTrack.off(TrackEvent.Restarted, onRestarted);\n };\n } else {\n return () => {};\n }\n }, [videoTrack]);\n\n useEffect(() => {\n if (videoTrack instanceof RemoteVideoTrack && videoTrack.isAdaptiveStream) {\n videoTrack?.observeElementInfo(elementInfo);\n return () => {\n videoTrack?.stopObservingElementInfo(elementInfo);\n };\n } else {\n return () => {};\n }\n }, [videoTrack, elementInfo]);\n\n return (\n <View style={{ ...style, ...styles.container }} onLayout={layoutOnChange}>\n <ViewPortDetector\n onChange={visibilityOnChange}\n style={styles.videoView}\n disabled={!shouldObserveVisibility}\n propKey={videoTrack}\n >\n <RTCView\n style={styles.videoView}\n streamURL={mediaStream?.toURL() ?? ''}\n objectFit={objectFit}\n zOrder={zOrder}\n mirror={mirror}\n />\n </ViewPortDetector>\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n container: {},\n videoView: {\n flex: 1,\n width: '100%',\n },\n});\n\nclass VideoViewElementInfo implements ElementInfo {\n element: object = {};\n something?: any;\n id?: string;\n _width = 0;\n _height = 0;\n _observing = false;\n visible: boolean = true;\n visibilityChangedAt: number | undefined;\n pictureInPicture = false;\n handleResize?: (() => void) | undefined;\n handleVisibilityChanged?: (() => void) | undefined;\n width = () => this._width;\n height = () => this._height;\n\n observe(): void {\n this._observing = true;\n }\n stopObserving(): void {\n this._observing = false;\n }\n\n onLayout(event: LayoutChangeEvent) {\n let { width, height } = event.nativeEvent.layout;\n this._width = width;\n this._height = height;\n\n if (this._observing) {\n this.handleResize?.();\n }\n }\n onVisibility(isVisible: boolean) {\n if (this.visible !== isVisible) {\n this.visible = isVisible;\n this.visibilityChangedAt = Date.now();\n if (this._observing) {\n this.handleVisibilityChanged?.();\n }\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "ParticipantContext", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _componentsReact.ParticipantContext;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "ReceivedDataMessage", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _componentsCore.ReceivedDataMessage;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "RoomContext", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _componentsReact.RoomContext;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "TrackRefContext", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _componentsReact.TrackRefContext;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
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
|
+
Object.defineProperty(exports, "isTrackReference", {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function () {
|
|
87
|
+
return _componentsReact.isTrackReference;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
Object.defineProperty(exports, "useChat", {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function () {
|
|
93
|
+
return _componentsReact.useChat;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
Object.defineProperty(exports, "useConnectionState", {
|
|
97
|
+
enumerable: true,
|
|
98
|
+
get: function () {
|
|
99
|
+
return _componentsReact.useConnectionState;
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
Object.defineProperty(exports, "useDataChannel", {
|
|
103
|
+
enumerable: true,
|
|
104
|
+
get: function () {
|
|
105
|
+
return _componentsReact.useDataChannel;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
Object.defineProperty(exports, "useEnsureTrackRef", {
|
|
109
|
+
enumerable: true,
|
|
110
|
+
get: function () {
|
|
111
|
+
return _componentsReact.useEnsureTrackRef;
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
Object.defineProperty(exports, "useIsEncrypted", {
|
|
115
|
+
enumerable: true,
|
|
116
|
+
get: function () {
|
|
117
|
+
return _componentsReact.useIsEncrypted;
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
Object.defineProperty(exports, "useIsMuted", {
|
|
121
|
+
enumerable: true,
|
|
122
|
+
get: function () {
|
|
123
|
+
return _componentsReact.useIsMuted;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
Object.defineProperty(exports, "useIsSpeaking", {
|
|
127
|
+
enumerable: true,
|
|
128
|
+
get: function () {
|
|
129
|
+
return _componentsReact.useIsSpeaking;
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
Object.defineProperty(exports, "useLiveKitRoom", {
|
|
133
|
+
enumerable: true,
|
|
134
|
+
get: function () {
|
|
135
|
+
return _componentsReact.useLiveKitRoom;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
Object.defineProperty(exports, "useLocalParticipant", {
|
|
139
|
+
enumerable: true,
|
|
140
|
+
get: function () {
|
|
141
|
+
return _componentsReact.useLocalParticipant;
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
Object.defineProperty(exports, "useLocalParticipantPermissions", {
|
|
145
|
+
enumerable: true,
|
|
146
|
+
get: function () {
|
|
147
|
+
return _componentsReact.useLocalParticipantPermissions;
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
Object.defineProperty(exports, "useParticipantContext", {
|
|
151
|
+
enumerable: true,
|
|
152
|
+
get: function () {
|
|
153
|
+
return _componentsReact.useParticipantContext;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
Object.defineProperty(exports, "useParticipantInfo", {
|
|
157
|
+
enumerable: true,
|
|
158
|
+
get: function () {
|
|
159
|
+
return _componentsReact.useParticipantInfo;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
Object.defineProperty(exports, "useParticipantTracks", {
|
|
163
|
+
enumerable: true,
|
|
164
|
+
get: function () {
|
|
165
|
+
return _componentsReact.useParticipantTracks;
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
Object.defineProperty(exports, "useParticipants", {
|
|
169
|
+
enumerable: true,
|
|
170
|
+
get: function () {
|
|
171
|
+
return _componentsReact.useParticipants;
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
Object.defineProperty(exports, "useRemoteParticipant", {
|
|
175
|
+
enumerable: true,
|
|
176
|
+
get: function () {
|
|
177
|
+
return _componentsReact.useRemoteParticipant;
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
Object.defineProperty(exports, "useRemoteParticipants", {
|
|
181
|
+
enumerable: true,
|
|
182
|
+
get: function () {
|
|
183
|
+
return _componentsReact.useRemoteParticipants;
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
Object.defineProperty(exports, "useRoomContext", {
|
|
187
|
+
enumerable: true,
|
|
188
|
+
get: function () {
|
|
189
|
+
return _componentsReact.useRoomContext;
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
Object.defineProperty(exports, "useSortedParticipants", {
|
|
193
|
+
enumerable: true,
|
|
194
|
+
get: function () {
|
|
195
|
+
return _componentsReact.useSortedParticipants;
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
Object.defineProperty(exports, "useSpeakingParticipants", {
|
|
199
|
+
enumerable: true,
|
|
200
|
+
get: function () {
|
|
201
|
+
return _componentsReact.useSpeakingParticipants;
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
Object.defineProperty(exports, "useTrackMutedIndicator", {
|
|
205
|
+
enumerable: true,
|
|
206
|
+
get: function () {
|
|
207
|
+
return _componentsReact.useTrackMutedIndicator;
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
Object.defineProperty(exports, "useTrackRefContext", {
|
|
211
|
+
enumerable: true,
|
|
212
|
+
get: function () {
|
|
213
|
+
return _componentsReact.useTrackRefContext;
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
Object.defineProperty(exports, "useTracks", {
|
|
217
|
+
enumerable: true,
|
|
218
|
+
get: function () {
|
|
219
|
+
return _componentsReact.useTracks;
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
Object.defineProperty(exports, "useVisualStableUpdate", {
|
|
223
|
+
enumerable: true,
|
|
224
|
+
get: function () {
|
|
225
|
+
return _componentsReact.useVisualStableUpdate;
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
var _componentsReact = require("@livekit/components-react");
|
|
230
|
+
|
|
231
|
+
var _componentsCore = require("@livekit/components-core");
|
|
232
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["hooks.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAuCA","sourcesContent":["export {\n useConnectionState,\n useDataChannel,\n useIsSpeaking,\n useLocalParticipant,\n UseLocalParticipantOptions,\n useLocalParticipantPermissions,\n useParticipantInfo,\n UseParticipantInfoOptions,\n useParticipants,\n UseParticipantsOptions,\n useRemoteParticipants,\n UseRemoteParticipantOptions,\n useRemoteParticipant,\n UseRemoteParticipantsOptions,\n useSpeakingParticipants,\n useSortedParticipants,\n useChat,\n useIsEncrypted,\n useIsMuted,\n useParticipantTracks,\n useLiveKitRoom,\n RoomContext,\n useRoomContext,\n ParticipantContext,\n useParticipantContext,\n TrackRefContext,\n useTrackRefContext,\n useTracks,\n UseTracksOptions,\n TrackReference,\n TrackReferenceOrPlaceholder,\n isTrackReference,\n useEnsureTrackRef,\n useTrackMutedIndicator,\n useVisualStableUpdate,\n UseVisualStableUpdateOptions,\n} from '@livekit/components-react';\n\nexport { ReceivedDataMessage } from '@livekit/components-core';\n"]}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -81,6 +81,48 @@ var _AudioSession = _interopRequireWildcard(require("./audio/AudioSession"));
|
|
|
81
81
|
|
|
82
82
|
var _reactNative = require("react-native");
|
|
83
83
|
|
|
84
|
+
var _hooks = require("./hooks");
|
|
85
|
+
|
|
86
|
+
Object.keys(_hooks).forEach(function (key) {
|
|
87
|
+
if (key === "default" || key === "__esModule") return;
|
|
88
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
89
|
+
if (key in exports && exports[key] === _hooks[key]) return;
|
|
90
|
+
Object.defineProperty(exports, key, {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function () {
|
|
93
|
+
return _hooks[key];
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
var _LiveKitRoom = require("./components/LiveKitRoom");
|
|
99
|
+
|
|
100
|
+
Object.keys(_LiveKitRoom).forEach(function (key) {
|
|
101
|
+
if (key === "default" || key === "__esModule") return;
|
|
102
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
103
|
+
if (key in exports && exports[key] === _LiveKitRoom[key]) return;
|
|
104
|
+
Object.defineProperty(exports, key, {
|
|
105
|
+
enumerable: true,
|
|
106
|
+
get: function () {
|
|
107
|
+
return _LiveKitRoom[key];
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
var _VideoTrack = require("./components/VideoTrack");
|
|
113
|
+
|
|
114
|
+
Object.keys(_VideoTrack).forEach(function (key) {
|
|
115
|
+
if (key === "default" || key === "__esModule") return;
|
|
116
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
117
|
+
if (key in exports && exports[key] === _VideoTrack[key]) return;
|
|
118
|
+
Object.defineProperty(exports, key, {
|
|
119
|
+
enumerable: true,
|
|
120
|
+
get: function () {
|
|
121
|
+
return _VideoTrack[key];
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
|
|
84
126
|
var _VideoView = require("./components/VideoView");
|
|
85
127
|
|
|
86
128
|
Object.keys(_VideoView).forEach(function (key) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["registerGlobals","livekitRegisterGlobals","fixWebrtcAdapter","shimPromiseAllSettled","shimArrayAt","shimAsyncIterator","shimIterator","lkGlobal","platform","Platform","OS","devicePixelRatio","PixelRatio","get","global","LiveKitReactNativeGlobal","window","navigator","undefined","userAgent","product","allSettled","require","shim","Array","prototype","at"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAWA;;
|
|
1
|
+
{"version":3,"sources":["index.tsx"],"names":["registerGlobals","livekitRegisterGlobals","fixWebrtcAdapter","shimPromiseAllSettled","shimArrayAt","shimAsyncIterator","shimIterator","lkGlobal","platform","Platform","OS","devicePixelRatio","PixelRatio","get","global","LiveKitReactNativeGlobal","window","navigator","undefined","userAgent","product","allSettled","require","shim","Array","prototype","at"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAWA;;AA8DA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;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,CAAC,oBAAD,CAAxB;;AACAD,EAAAA,UAAU,CAACE,IAAX;AACD;;AAED,SAASnB,WAAT,GAAuB;AACrB;AACA,MAAI,CAACoB,KAAK,CAACC,SAAN,CAAgBC,EAArB,EAAyB;AACvB,QAAIA,EAAE,GAAGJ,OAAO,CAAC,oBAAD,CAAhB;;AACAI,IAAAA,EAAE,CAACH,IAAH;AACD;AACF;;AAED,SAASlB,iBAAT,GAA6B;AAC3B,MAAIkB,IAAI,GAAGD,OAAO,CAAC,8CAAD,CAAlB;;AACAC,EAAAA,IAAI;AACL;;AAED,SAASjB,YAAT,GAAwB;AACtB,MAAIiB,IAAI,GAAGD,OAAO,CAAC,yCAAD,CAAlB;;AACAC,EAAAA,IAAI;AACL","sourcesContent":["import { registerGlobals as webrtcRegisterGlobals } from '@livekit/react-native-webrtc';\nimport { setupURLPolyfill } from 'react-native-url-polyfill';\nimport 'fastestsmallesttextencoderdecoder';\nimport AudioSession, {\n AndroidAudioTypePresets,\n AndroidAudioTypeOptions,\n AppleAudioCategory,\n AppleAudioCategoryOption,\n AppleAudioConfiguration,\n AppleAudioMode,\n 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 AudioConfiguration,\n AndroidAudioTypeOptions,\n AndroidAudioTypePresets,\n AppleAudioCategory,\n AppleAudioCategoryOption,\n AppleAudioConfiguration,\n AppleAudioMode,\n AudioTrackState,\n getDefaultAppleAudioConfigurationForMode,\n LogLevel,\n SetLogLevelOptions,\n};\n"]}
|
|
@@ -9,6 +9,7 @@ var _livekitClient = require("livekit-client");
|
|
|
9
9
|
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
|
|
12
|
+
/** @deprecated use `useRemoteParticipant` or `useLocalParticipant` instead */
|
|
12
13
|
function useParticipant(participant) {
|
|
13
14
|
const [isAudioMuted, setAudioMuted] = (0, _react.useState)(false);
|
|
14
15
|
const [, setVideoMuted] = (0, _react.useState)(false);
|