expo-libvlc-player 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -24,6 +24,14 @@ No additional configuration necessary.
24
24
 
25
25
  Run `npx pod-install` after installing the npm package.
26
26
 
27
+ #### NSLocalNetworkUsageDescription
28
+
29
+ Starting from iOS 14, you are required to provide a message for the `NSLocalNetworkUsageDescription` key in Info.plist if your app uses the local network directly or indirectly.
30
+
31
+ It seems the `MobileVLCKit` library powering the VLC Player on iOS makes use of this feature when playing external media from sources such as RTSP streams.
32
+
33
+ Provide a custom message specifying how your app will make use of the network so your App Store submission is not rejected for this reason, read more about this [here](https://developer.apple.com/documentation/technotes/tn3179-understanding-local-network-privacy).
34
+
27
35
  ### Configuration in app config
28
36
 
29
37
  You can configure `expo-libvlc-player` using its built-in config plugin if you use config plugins in your project.
@@ -37,6 +45,7 @@ You can configure `expo-libvlc-player` using its built-in config plugin if you u
37
45
  [
38
46
  "expo-libvlc-player",
39
47
  {
48
+ "localNetworkPermission": "Allow $(PRODUCT_NAME) to access your local network",
40
49
  "supportsBackgroundPlayback": true
41
50
  }
42
51
  ]
@@ -47,9 +56,10 @@ You can configure `expo-libvlc-player` using its built-in config plugin if you u
47
56
 
48
57
  #### Configurable properties
49
58
 
50
- | Name | Description | Default |
51
- | ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
52
- | `supportsBackgroundPlayback` | A boolean value to enable background playback on iOS. If `true`, the `audio` key is added to the `UIBackgroundModes` array in the **Info.plist** file. If `false`, the key is removed. When `undefined`, the key is not modified | `undefined` |
59
+ | Name | Description | Default |
60
+ | ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ |
61
+ | `localNetworkPermission` | A string to set the `NSLocalNetworkUsageDescription` permission message on iOS | `"Allow $(PRODUCT_NAME) to access your local network"` |
62
+ | `supportsBackgroundPlayback` | A boolean value to enable background playback on iOS. If `true`, the `audio` key is added to the `UIBackgroundModes` array in the Info.plist file. If `false`, the key is removed. When `undefined`, the key is not modified | `undefined` |
53
63
 
54
64
  ## Usage
55
65
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-libvlc-player",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "LibVLC Player for Expo",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -18,7 +18,7 @@
18
18
  "lint-staged": {
19
19
  "**/*.{ts,tsx,d.ts}": [
20
20
  "eslint --fix",
21
- "tsc --noEmit --skipLibCheck"
21
+ "tsc --noEmit --skipLibCheck --jsx preserve"
22
22
  ]
23
23
  },
24
24
  "keywords": [
@@ -1,5 +1,6 @@
1
1
  import { type ConfigPlugin } from "expo/config-plugins";
2
2
  type WithExpoLibVlcPlayerOptions = {
3
+ localNetworkPermission?: string | false;
3
4
  supportsBackgroundPlayback?: boolean;
4
5
  };
5
6
  declare const withExpoLibVlcPlayer: ConfigPlugin<WithExpoLibVlcPlayerOptions>;
@@ -1,18 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const config_plugins_1 = require("expo/config-plugins");
4
- const withExpoLibVlcPlayer = (config, { supportsBackgroundPlayback }) => {
4
+ const LOCAL_NETWORK_USAGE = "Allow $(PRODUCT_NAME) to access your local network";
5
+ const withExpoLibVlcPlayer = (config, { localNetworkPermission, supportsBackgroundPlayback } = {}) => {
6
+ config_plugins_1.IOSConfig.Permissions.createPermissionsPlugin({
7
+ NSLocalNetworkUsageDescription: LOCAL_NETWORK_USAGE,
8
+ })(config, {
9
+ NSLocalNetworkUsageDescription: localNetworkPermission,
10
+ });
5
11
  (0, config_plugins_1.withInfoPlist)(config, (config) => {
6
12
  const currentBackgroundModes = config.modResults.UIBackgroundModes ?? [];
7
13
  const shouldEnableBackgroundAudio = supportsBackgroundPlayback;
8
- if (typeof supportsBackgroundPlayback === 'undefined') {
14
+ if (typeof supportsBackgroundPlayback === "undefined") {
9
15
  return config;
10
16
  }
11
- if (shouldEnableBackgroundAudio && !currentBackgroundModes.includes('audio')) {
12
- config.modResults.UIBackgroundModes = [...currentBackgroundModes, 'audio'];
17
+ if (shouldEnableBackgroundAudio &&
18
+ !currentBackgroundModes.includes("audio")) {
19
+ config.modResults.UIBackgroundModes = [
20
+ ...currentBackgroundModes,
21
+ "audio",
22
+ ];
13
23
  }
14
24
  else if (!shouldEnableBackgroundAudio) {
15
- config.modResults.UIBackgroundModes = currentBackgroundModes.filter((mode) => mode !== 'audio');
25
+ config.modResults.UIBackgroundModes = currentBackgroundModes.filter((mode) => mode !== "audio");
16
26
  }
17
27
  return config;
18
28
  });
@@ -1,13 +1,27 @@
1
- import { type ConfigPlugin, withInfoPlist } from "expo/config-plugins";
1
+ import {
2
+ type ConfigPlugin,
3
+ IOSConfig,
4
+ withInfoPlist,
5
+ } from "expo/config-plugins";
6
+
7
+ const LOCAL_NETWORK_USAGE =
8
+ "Allow $(PRODUCT_NAME) to access your local network";
2
9
 
3
10
  type WithExpoLibVlcPlayerOptions = {
11
+ localNetworkPermission?: string | false;
4
12
  supportsBackgroundPlayback?: boolean;
5
13
  };
6
14
 
7
15
  const withExpoLibVlcPlayer: ConfigPlugin<WithExpoLibVlcPlayerOptions> = (
8
16
  config,
9
- { supportsBackgroundPlayback },
17
+ { localNetworkPermission, supportsBackgroundPlayback } = {},
10
18
  ) => {
19
+ IOSConfig.Permissions.createPermissionsPlugin({
20
+ NSLocalNetworkUsageDescription: LOCAL_NETWORK_USAGE,
21
+ })(config, {
22
+ NSLocalNetworkUsageDescription: localNetworkPermission,
23
+ });
24
+
11
25
  withInfoPlist(config, (config) => {
12
26
  const currentBackgroundModes = config.modResults.UIBackgroundModes ?? [];
13
27
  const shouldEnableBackgroundAudio = supportsBackgroundPlayback;
@@ -1,4 +1,3 @@
1
- import * as React from "react";
2
1
  import type { ViewProps } from "react-native";
3
2
 
4
3
  export interface VLCPlayerViewRef {
@@ -1,5 +1,5 @@
1
1
  import { requireNativeView } from "expo";
2
- import * as React from "react";
2
+ import { forwardRef, type ComponentType } from "react";
3
3
 
4
4
  import {
5
5
  VlcPlayerViewNativeProps,
@@ -13,12 +13,12 @@ import {
13
13
  } from "./VlcPlayer.types";
14
14
  import { convertNativeProps } from "./utils/props";
15
15
 
16
- const NativeView: React.ComponentType<VlcPlayerViewNativeProps> =
16
+ const NativeView: ComponentType<VlcPlayerViewNativeProps> =
17
17
  requireNativeView("ExpoLibVlcPlayer");
18
18
 
19
19
  let loggedRenderingChildrenWarning = false;
20
20
 
21
- const VlcPlayerView = React.forwardRef<VLCPlayerViewRef, VlcPlayerViewProps>(
21
+ const VlcPlayerView = forwardRef<VLCPlayerViewRef, VlcPlayerViewProps>(
22
22
  (props, ref) => {
23
23
  const nativeProps = convertNativeProps(props);
24
24
 
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Reexport the native module. On native platforms, it will be resolved to VlcPlayer.ts
1
+ // Reexport the native module. On native platforms, it will be resolved to VlcPlayerModule.ts
2
2
  export { default } from "./VlcPlayerModule";
3
3
  export { default as VLCPlayerView } from "./VlcPlayerView";
4
4
  export * from "./VlcPlayer.types";
@@ -13,7 +13,9 @@ export function convertNativeProps(
13
13
  const nativeProps: VlcPlayerViewNativeProps = {};
14
14
 
15
15
  for (const [key, value] of Object.entries(props)) {
16
- nativeProps[key as keyof VlcPlayerViewNativeProps] = value;
16
+ if (key in ({} as VlcPlayerViewNativeProps)) {
17
+ (nativeProps as any)[key] = value;
18
+ }
17
19
  }
18
20
 
19
21
  return nativeProps;
@@ -1,297 +0,0 @@
1
- import * as React from "react";
2
- import type { ViewProps } from "react-native";
3
- export interface VLCPlayerViewRef {
4
- /**
5
- * Starts playback for the current player
6
- *
7
- * @returns A promise which resolves to `void`
8
- */
9
- readonly play: () => Promise<void>;
10
- /**
11
- * Pauses playback for the current player
12
- *
13
- * @returns A promise which resolves to `void`
14
- */
15
- readonly pause: () => Promise<void>;
16
- /**
17
- * Stops playback for the current player
18
- *
19
- * @returns A promise which resolves to `void`
20
- */
21
- readonly stop: () => Promise<void>;
22
- /**
23
- * Sets position of the current player
24
- *
25
- * @param position - Must be a float number between `0` and `1`
26
- *
27
- * @returns void
28
- */
29
- readonly seek: (position: number) => Promise<void>;
30
- }
31
- /**
32
- * @hidden
33
- */
34
- export type BufferingListener = () => void;
35
- /**
36
- * @hidden
37
- */
38
- export type PlayingPausedListener = () => void;
39
- /**
40
- * @hidden
41
- */
42
- export type StoppedListener = () => void;
43
- /**
44
- * @hidden
45
- */
46
- export type EndedListener = () => void;
47
- /**
48
- * @hidden
49
- */
50
- export type RepeatListener = () => void;
51
- /**
52
- * @hidden
53
- */
54
- export type WarnListener = (event: {
55
- nativeEvent: Warn;
56
- }) => void;
57
- export type Warn = {
58
- warn: string;
59
- };
60
- /**
61
- * @hidden
62
- */
63
- export type ErrorListener = (event: {
64
- nativeEvent: Error;
65
- }) => void;
66
- export type Error = {
67
- error: string;
68
- };
69
- /**
70
- * @hidden
71
- */
72
- export type PositionChangedListener = (event: {
73
- nativeEvent: PositionChanged;
74
- }) => void;
75
- export type PositionChanged = {
76
- position: number;
77
- };
78
- /**
79
- * @hidden
80
- */
81
- export type LoadListener = (event: {
82
- nativeEvent: VideoInfo;
83
- }) => void;
84
- /**
85
- * @hidden
86
- */
87
- export type BackgroundListener = (event: {
88
- nativeEvent: Background;
89
- }) => void;
90
- export type Background = {
91
- background: boolean;
92
- };
93
- export interface Track {
94
- id: number;
95
- name: string;
96
- }
97
- export interface VideoTracks {
98
- audio: Track[];
99
- subtitle: Track[];
100
- }
101
- export interface VideoInfo {
102
- width: number;
103
- height: number;
104
- aspectRatio: string | null;
105
- duration: number;
106
- tracks: VideoTracks;
107
- seekable: boolean;
108
- }
109
- export interface Subtitle {
110
- uri: string;
111
- enable: boolean;
112
- }
113
- export interface TracksOptions {
114
- audio: number;
115
- subtitle: number;
116
- }
117
- /**
118
- * @hidden
119
- */
120
- export interface VlcPlayerViewNativeProps {
121
- ref?: React.Ref<VLCPlayerViewRef>;
122
- uri?: string;
123
- subtitle?: Subtitle;
124
- options?: string[];
125
- volume?: number;
126
- mute?: boolean;
127
- rate?: number;
128
- tracks?: TracksOptions;
129
- time?: number;
130
- repeat?: boolean;
131
- aspectRatio?: string;
132
- audioMixingMode?: AudioMixingMode;
133
- playInBackground?: boolean;
134
- autoplay?: boolean;
135
- onBuffering?: BufferingListener;
136
- onPlaying?: PlayingPausedListener;
137
- onPaused?: PlayingPausedListener;
138
- onStopped?: StoppedListener;
139
- onEnded?: EndedListener;
140
- onRepeat?: RepeatListener;
141
- onWarn?: WarnListener;
142
- onError?: ErrorListener;
143
- onPositionChanged?: PositionChangedListener;
144
- onLoad?: LoadListener;
145
- onBackground?: BackgroundListener;
146
- }
147
- export type AudioMixingMode = "mixWithOthers" | "duckOthers" | "auto" | "doNotMix";
148
- export interface VlcPlayerViewProps extends ViewProps {
149
- /**
150
- * Sets the URI of the media to be played
151
- */
152
- uri: string;
153
- /**
154
- * Sets subtitle URI and enabled state
155
- *
156
- * @example
157
- * ```tsx
158
- * <VLCPlayerView
159
- * subtitle={{
160
- * uri: "file://",
161
- * enable: false,
162
- * }}
163
- * />
164
- * ```
165
- */
166
- subtitle?: Subtitle;
167
- /**
168
- * https://wiki.videolan.org/VLC_command-line_help/
169
- *
170
- * Sets the VLC options to initialize the player with
171
- *
172
- * @example ["--network-caching=1000"]
173
- *
174
- * @default []
175
- *
176
- */
177
- options?: string[];
178
- /**
179
- * Controls the player volume. Must be an integer number between `0` and `100`
180
- *
181
- * @default 100
182
- *
183
- */
184
- volume?: number;
185
- /**
186
- * Sets the player volume to `0`
187
- *
188
- * @default false
189
- *
190
- */
191
- mute?: boolean;
192
- /**
193
- * Controls the player rate. Must be a float number
194
- *
195
- * @default 1
196
- *
197
- */
198
- rate?: number;
199
- /**
200
- * Sets the player audio and subtitle tracks, see `VideoInfo` for tracks type
201
- *
202
- * @example
203
- * ```tsx
204
- * <VLCPlayerView
205
- * tracks={{
206
- * audio: 1,
207
- * subtitle: 2,
208
- * }}
209
- * />
210
- * ```
211
- */
212
- tracks?: TracksOptions;
213
- /**
214
- * Controls the player time once created. Must be an integer number in milliseconds
215
- *
216
- * @default 0
217
- *
218
- */
219
- time?: number;
220
- /**
221
- * Repeats media once playback is ended
222
- *
223
- * @default false
224
- *
225
- */
226
- repeat?: boolean;
227
- /**
228
- * Sets the player aspect ratio. Must be a valid string
229
- *
230
- * @example "16:9"
231
- */
232
- aspectRatio?: string;
233
- /**
234
- * Determines how the player will interact with other audio playing in the system
235
- *
236
- * @default "auto"
237
- */
238
- audioMixingMode?: AudioMixingMode;
239
- /**
240
- * Determines whether the player should continue playing after the app enters the background
241
- *
242
- * @default false
243
- */
244
- playInBackground?: boolean;
245
- /**
246
- * Autoplays media once player is created
247
- *
248
- * @default true
249
- *
250
- */
251
- autoplay?: boolean;
252
- /**
253
- * Event that fires when player buffers
254
- */
255
- onBuffering?: () => void;
256
- /**
257
- * Event that fires when player plays
258
- */
259
- onPlaying?: () => void;
260
- /**
261
- * Event that fires when player pauses
262
- */
263
- onPaused?: () => void;
264
- /**
265
- * Event that fires when player stops
266
- */
267
- onStopped?: () => void;
268
- /**
269
- * Event that fires when player reaches an end
270
- */
271
- onEnded?: () => void;
272
- /**
273
- * Event that fires when player repeats
274
- */
275
- onRepeat?: () => void;
276
- /**
277
- * Event that fires when player emits a warning
278
- */
279
- onWarn?: (event: Warn) => void;
280
- /**
281
- * Event that fires when player encounters an error
282
- */
283
- onError?: (event: Error) => void;
284
- /**
285
- * Event that fires when player position changes
286
- */
287
- onPositionChanged?: (event: PositionChanged) => void;
288
- /**
289
- * Event that fires when player loads
290
- */
291
- onLoad?: (event: VideoInfo) => void;
292
- /**
293
- * Event that fires when player enters the background
294
- */
295
- onBackground?: (event: Background) => void;
296
- }
297
- //# sourceMappingURL=VlcPlayer.types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+0,0 @@
1
- export {};
2
- //# sourceMappingURL=VlcPlayer.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VlcPlayer.types.js","sourceRoot":"","sources":["../src/VlcPlayer.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from \"react\";\nimport type { ViewProps } from \"react-native\";\n\nexport interface VLCPlayerViewRef {\n /**\n * Starts playback for the current player\n *\n * @returns A promise which resolves to `void`\n */\n readonly play: () => Promise<void>;\n /**\n * Pauses playback for the current player\n *\n * @returns A promise which resolves to `void`\n */\n readonly pause: () => Promise<void>;\n /**\n * Stops playback for the current player\n *\n * @returns A promise which resolves to `void`\n */\n readonly stop: () => Promise<void>;\n /**\n * Sets position of the current player\n *\n * @param position - Must be a float number between `0` and `1`\n *\n * @returns void\n */\n readonly seek: (position: number) => Promise<void>;\n}\n\n/**\n * @hidden\n */\nexport type BufferingListener = () => void;\n\n/**\n * @hidden\n */\nexport type PlayingPausedListener = () => void;\n\n/**\n * @hidden\n */\nexport type StoppedListener = () => void;\n\n/**\n * @hidden\n */\nexport type EndedListener = () => void;\n\n/**\n * @hidden\n */\nexport type RepeatListener = () => void;\n\n/**\n * @hidden\n */\nexport type WarnListener = (event: { nativeEvent: Warn }) => void;\n\nexport type Warn = { warn: string };\n\n/**\n * @hidden\n */\nexport type ErrorListener = (event: { nativeEvent: Error }) => void;\n\nexport type Error = { error: string };\n\n/**\n * @hidden\n */\nexport type PositionChangedListener = (event: {\n nativeEvent: PositionChanged;\n}) => void;\n\nexport type PositionChanged = { position: number };\n\n/**\n * @hidden\n */\nexport type LoadListener = (event: { nativeEvent: VideoInfo }) => void;\n\n/**\n * @hidden\n */\nexport type BackgroundListener = (event: { nativeEvent: Background }) => void;\n\nexport type Background = { background: boolean };\n\nexport interface Track {\n id: number;\n name: string;\n}\n\nexport interface VideoTracks {\n audio: Track[];\n subtitle: Track[];\n}\n\nexport interface VideoInfo {\n width: number;\n height: number;\n aspectRatio: string | null;\n duration: number;\n tracks: VideoTracks;\n seekable: boolean;\n}\n\nexport interface Subtitle {\n uri: string;\n enable: boolean;\n}\n\nexport interface TracksOptions {\n audio: number;\n subtitle: number;\n}\n\n/**\n * @hidden\n */\nexport interface VlcPlayerViewNativeProps {\n ref?: React.Ref<VLCPlayerViewRef>;\n uri?: string;\n subtitle?: Subtitle;\n options?: string[];\n volume?: number;\n mute?: boolean;\n rate?: number;\n tracks?: TracksOptions;\n time?: number;\n repeat?: boolean;\n aspectRatio?: string;\n audioMixingMode?: AudioMixingMode;\n playInBackground?: boolean;\n autoplay?: boolean;\n onBuffering?: BufferingListener;\n onPlaying?: PlayingPausedListener;\n onPaused?: PlayingPausedListener;\n onStopped?: StoppedListener;\n onEnded?: EndedListener;\n onRepeat?: RepeatListener;\n onWarn?: WarnListener;\n onError?: ErrorListener;\n onPositionChanged?: PositionChangedListener;\n onLoad?: LoadListener;\n onBackground?: BackgroundListener;\n}\n\nexport type AudioMixingMode =\n | \"mixWithOthers\"\n | \"duckOthers\"\n | \"auto\"\n | \"doNotMix\";\n\nexport interface VlcPlayerViewProps extends ViewProps {\n /**\n * Sets the URI of the media to be played\n */\n uri: string;\n /**\n * Sets subtitle URI and enabled state\n *\n * @example\n * ```tsx\n * <VLCPlayerView\n * subtitle={{\n * uri: \"file://\",\n * enable: false,\n * }}\n * />\n * ```\n */\n subtitle?: Subtitle;\n /**\n * https://wiki.videolan.org/VLC_command-line_help/\n *\n * Sets the VLC options to initialize the player with\n *\n * @example [\"--network-caching=1000\"]\n *\n * @default []\n *\n */\n options?: string[];\n /**\n * Controls the player volume. Must be an integer number between `0` and `100`\n *\n * @default 100\n *\n */\n volume?: number;\n /**\n * Sets the player volume to `0`\n *\n * @default false\n *\n */\n mute?: boolean;\n /**\n * Controls the player rate. Must be a float number\n *\n * @default 1\n *\n */\n rate?: number;\n /**\n * Sets the player audio and subtitle tracks, see `VideoInfo` for tracks type\n *\n * @example\n * ```tsx\n * <VLCPlayerView\n * tracks={{\n * audio: 1,\n * subtitle: 2,\n * }}\n * />\n * ```\n */\n tracks?: TracksOptions;\n /**\n * Controls the player time once created. Must be an integer number in milliseconds\n *\n * @default 0\n *\n */\n time?: number;\n /**\n * Repeats media once playback is ended\n *\n * @default false\n *\n */\n repeat?: boolean;\n /**\n * Sets the player aspect ratio. Must be a valid string\n *\n * @example \"16:9\"\n */\n aspectRatio?: string;\n /**\n * Determines how the player will interact with other audio playing in the system\n *\n * @default \"auto\"\n */\n audioMixingMode?: AudioMixingMode;\n /**\n * Determines whether the player should continue playing after the app enters the background\n *\n * @default false\n */\n playInBackground?: boolean;\n /**\n * Autoplays media once player is created\n *\n * @default true\n *\n */\n autoplay?: boolean;\n /**\n * Event that fires when player buffers\n */\n onBuffering?: () => void;\n /**\n * Event that fires when player plays\n */\n onPlaying?: () => void;\n /**\n * Event that fires when player pauses\n */\n onPaused?: () => void;\n /**\n * Event that fires when player stops\n */\n onStopped?: () => void;\n /**\n * Event that fires when player reaches an end\n */\n onEnded?: () => void;\n /**\n * Event that fires when player repeats\n */\n onRepeat?: () => void;\n /**\n * Event that fires when player emits a warning\n */\n onWarn?: (event: Warn) => void;\n /**\n * Event that fires when player encounters an error\n */\n onError?: (event: Error) => void;\n /**\n * Event that fires when player position changes\n */\n onPositionChanged?: (event: PositionChanged) => void;\n /**\n * Event that fires when player loads\n */\n onLoad?: (event: VideoInfo) => void;\n /**\n * Event that fires when player enters the background\n */\n onBackground?: (event: Background) => void;\n}\n"]}
@@ -1,6 +0,0 @@
1
- import { NativeModule } from "expo";
2
- declare class VlcPlayerModule extends NativeModule<{}> {
3
- }
4
- declare const _default: VlcPlayerModule;
5
- export default _default;
6
- //# sourceMappingURL=VlcPlayerModule.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VlcPlayerModule.d.ts","sourceRoot":"","sources":["../src/VlcPlayerModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,MAAM,CAAC;AAGzD,OAAO,OAAO,eAAgB,SAAQ,YAAY,CAAC,EAAE,CAAC;CAAG;;AAGzD,wBAAwE"}
@@ -1,4 +0,0 @@
1
- import { requireNativeModule } from "expo";
2
- // This call loads the native module object from the JSI.
3
- export default requireNativeModule("ExpoLibVlcPlayer");
4
- //# sourceMappingURL=VlcPlayerModule.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VlcPlayerModule.js","sourceRoot":"","sources":["../src/VlcPlayerModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAKzD,yDAAyD;AACzD,eAAe,mBAAmB,CAAkB,kBAAkB,CAAC,CAAC","sourcesContent":["import { NativeModule, requireNativeModule } from \"expo\";\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\ndeclare class VlcPlayerModule extends NativeModule<{}> {}\n\n// This call loads the native module object from the JSI.\nexport default requireNativeModule<VlcPlayerModule>(\"ExpoLibVlcPlayer\");\n"]}
@@ -1,5 +0,0 @@
1
- import * as React from "react";
2
- import { VlcPlayerViewProps, VLCPlayerViewRef } from "./VlcPlayer.types";
3
- declare const VlcPlayerView: React.ForwardRefExoticComponent<VlcPlayerViewProps & React.RefAttributes<VLCPlayerViewRef>>;
4
- export default VlcPlayerView;
5
- //# sourceMappingURL=VlcPlayerView.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VlcPlayerView.d.ts","sourceRoot":"","sources":["../src/VlcPlayerView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAEL,kBAAkB,EAClB,gBAAgB,EAMjB,MAAM,mBAAmB,CAAC;AAQ3B,QAAA,MAAM,aAAa,6FA0DlB,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -1,41 +0,0 @@
1
- import { requireNativeView } from "expo";
2
- import * as React from "react";
3
- import { convertNativeProps } from "./utils/props";
4
- const NativeView = requireNativeView("ExpoLibVlcPlayer");
5
- let loggedRenderingChildrenWarning = false;
6
- const VlcPlayerView = React.forwardRef((props, ref) => {
7
- const nativeProps = convertNativeProps(props);
8
- // @ts-expect-error
9
- if (nativeProps.children && !loggedRenderingChildrenWarning) {
10
- console.warn("The <VLCPlayerView> component does not support children. This may lead to inconsistent behaviour or crashes. If you want to render content on top of the VLCPlayer, consider using absolute positioning.");
11
- loggedRenderingChildrenWarning = true;
12
- }
13
- const onWarn = ({ nativeEvent }) => {
14
- if (props.onWarn) {
15
- props.onWarn(nativeEvent);
16
- }
17
- };
18
- const onError = ({ nativeEvent }) => {
19
- if (props.onError) {
20
- props.onError(nativeEvent);
21
- }
22
- };
23
- const onPositionChanged = ({ nativeEvent, }) => {
24
- if (props.onPositionChanged) {
25
- props.onPositionChanged(nativeEvent);
26
- }
27
- };
28
- const onLoad = ({ nativeEvent }) => {
29
- if (props.onLoad) {
30
- props.onLoad(nativeEvent);
31
- }
32
- };
33
- const onBackground = ({ nativeEvent }) => {
34
- if (props.onBackground) {
35
- props.onBackground(nativeEvent);
36
- }
37
- };
38
- return (<NativeView {...nativeProps} ref={ref} onWarn={onWarn} onError={onError} onPositionChanged={onPositionChanged} onLoad={onLoad} onBackground={onBackground}/>);
39
- });
40
- export default VlcPlayerView;
41
- //# sourceMappingURL=VlcPlayerView.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VlcPlayerView.js","sourceRoot":"","sources":["../src/VlcPlayerView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAY/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,MAAM,UAAU,GACd,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;AAExC,IAAI,8BAA8B,GAAG,KAAK,CAAC;AAE3C,MAAM,aAAa,GAAG,KAAK,CAAC,UAAU,CACpC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACb,MAAM,WAAW,GAAG,kBAAkB,CAAC,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f,OAAO,CAAC,CAAC,OAAO,CAAC,CACjB,iBAAiB,CAAC,CAAC,iBAAiB,CAAC,CACrC,MAAM,CAAC,CAAC,MAAM,CAAC,CACf,YAAY,CAAC,CAAC,YAAY,CAAC,EAC3B,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { requireNativeView } from \"expo\";\nimport * as React from \"react\";\n\nimport {\n VlcPlayerViewNativeProps,\n VlcPlayerViewProps,\n VLCPlayerViewRef,\n type Warn,\n type Error,\n type PositionChanged,\n type VideoInfo,\n type Background,\n} from \"./VlcPlayer.types\";\nimport { convertNativeProps } from \"./utils/props\";\n\nconst NativeView: React.ComponentType<VlcPlayerViewNativeProps> =\n requireNativeView(\"ExpoLibVlcPlayer\");\n\nlet loggedRenderingChildrenWarning = false;\n\nconst VlcPlayerView = React.forwardRef<VLCPlayerViewRef, VlcPlayerViewProps>(\n (props, ref) => {\n const nativeProps = convertNativeProps(props);\n\n // @ts-expect-error\n if (nativeProps.children && !loggedRenderingChildrenWarning) {\n console.warn(\n \"The <VLCPlayerView> component does not support children. This may lead to inconsistent behaviour or crashes. If you want to render content on top of the VLCPlayer, consider using absolute positioning.\",\n );\n loggedRenderingChildrenWarning = true;\n }\n\n const onWarn = ({ nativeEvent }: { nativeEvent: Warn }) => {\n if (props.onWarn) {\n props.onWarn(nativeEvent);\n }\n };\n\n const onError = ({ nativeEvent }: { nativeEvent: Error }) => {\n if (props.onError) {\n props.onError(nativeEvent);\n }\n };\n\n const onPositionChanged = ({\n nativeEvent,\n }: {\n nativeEvent: PositionChanged;\n }) => {\n if (props.onPositionChanged) {\n props.onPositionChanged(nativeEvent);\n }\n };\n\n const onLoad = ({ nativeEvent }: { nativeEvent: VideoInfo }) => {\n if (props.onLoad) {\n props.onLoad(nativeEvent);\n }\n };\n\n const onBackground = ({ nativeEvent }: { nativeEvent: Background }) => {\n if (props.onBackground) {\n props.onBackground(nativeEvent);\n }\n };\n\n return (\n <NativeView\n {...nativeProps}\n ref={ref}\n onWarn={onWarn}\n onError={onError}\n onPositionChanged={onPositionChanged}\n onLoad={onLoad}\n onBackground={onBackground}\n />\n );\n },\n);\n\nexport default VlcPlayerView;\n"]}
package/build/index.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export { default } from "./VlcPlayerModule";
2
- export { default as VLCPlayerView } from "./VlcPlayerView";
3
- export * from "./VlcPlayer.types";
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,cAAc,mBAAmB,CAAC"}
package/build/index.js DELETED
@@ -1,5 +0,0 @@
1
- // Reexport the native module. On native platforms, it will be resolved to VlcPlayer.ts
2
- export { default } from "./VlcPlayerModule";
3
- export { default as VLCPlayerView } from "./VlcPlayerView";
4
- export * from "./VlcPlayer.types";
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,cAAc,mBAAmB,CAAC","sourcesContent":["// Reexport the native module. On native platforms, it will be resolved to VlcPlayer.ts\nexport { default } from \"./VlcPlayerModule\";\nexport { default as VLCPlayerView } from \"./VlcPlayerView\";\nexport * from \"./VlcPlayer.types\";\n"]}
@@ -1,3 +0,0 @@
1
- import { VlcPlayerViewNativeProps, VlcPlayerViewProps } from "../VlcPlayer.types";
2
- export declare function convertNativeProps(props?: VlcPlayerViewProps): VlcPlayerViewNativeProps;
3
- //# sourceMappingURL=props.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/utils/props.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAE5B,wBAAgB,kBAAkB,CAChC,KAAK,CAAC,EAAE,kBAAkB,GACzB,wBAAwB,CAY1B"}
@@ -1,11 +0,0 @@
1
- export function convertNativeProps(props) {
2
- if (!props || typeof props !== "object") {
3
- return {};
4
- }
5
- const nativeProps = {};
6
- for (const [key, value] of Object.entries(props)) {
7
- nativeProps[key] = value;
8
- }
9
- return nativeProps;
10
- }
11
- //# sourceMappingURL=props.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"props.js","sourceRoot":"","sources":["../../src/utils/props.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,kBAAkB,CAChC,KAA0B;IAE1B,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACxC,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,WAAW,GAA6B,EAAE,CAAC;IAEjD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACjD,WAAW,CAAC,GAAqC,CAAC,GAAG,KAAK,CAAC;IAC7D,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC","sourcesContent":["import {\n VlcPlayerViewNativeProps,\n VlcPlayerViewProps,\n} from \"../VlcPlayer.types\";\n\nexport function convertNativeProps(\n props?: VlcPlayerViewProps,\n): VlcPlayerViewNativeProps {\n if (!props || typeof props !== \"object\") {\n return {};\n }\n\n const nativeProps: VlcPlayerViewNativeProps = {};\n\n for (const [key, value] of Object.entries(props)) {\n nativeProps[key as keyof VlcPlayerViewNativeProps] = value;\n }\n\n return nativeProps;\n}\n"]}