expo-libvlc-player 6.2.0 → 6.2.1
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 +2 -1
- package/android/src/main/java/expo/modules/libvlcplayer/LibVlcPlayerView.kt +3 -0
- package/android/src/main/java/expo/modules/libvlcplayer/records/Dialog.kt +1 -0
- package/build/LibVlcPlayer.types.d.ts +1 -0
- package/build/LibVlcPlayer.types.d.ts.map +1 -1
- package/build/LibVlcPlayer.types.js.map +1 -1
- package/build/LibVlcPlayerView.d.ts.map +1 -1
- package/build/LibVlcPlayerView.js +2 -2
- package/build/LibVlcPlayerView.js.map +1 -1
- package/build/utils/aspect.d.ts.map +1 -1
- package/build/utils/aspect.js.map +1 -1
- package/expo-module.config.json +4 -11
- package/ios/LibVlcPlayerView.swift +5 -2
- package/ios/Records/Dialog.swift +3 -0
- package/package.json +2 -2
- package/plugin/src/withExpoLibVlcPlayer.ts +3 -6
- package/src/LibVlcPlayer.types.ts +3 -10
- package/src/LibVlcPlayerView.tsx +99 -101
- package/src/utils/aspect.ts +1 -3
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
<i>Screenshots taken from the <a href="example/App.tsx">Example App</a> on Android and iOS</i>
|
|
20
20
|
</p>
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
### Supported versions
|
|
23
23
|
|
|
24
24
|
| Platform | Version |
|
|
25
25
|
| -------------------- | ------- |
|
|
@@ -205,6 +205,7 @@ The `LibVlcPlayerView` extends React Native `ViewProps` and implements the follo
|
|
|
205
205
|
{
|
|
206
206
|
title: string;
|
|
207
207
|
text: string;
|
|
208
|
+
type: "error" | "login" | "question";
|
|
208
209
|
cancelText?: string;
|
|
209
210
|
action1Text?: string;
|
|
210
211
|
action2Text?: string;
|
|
@@ -869,6 +869,7 @@ fun LibVlcPlayerView.setDialogCallbacks(ILibVLC: LibVLC?) {
|
|
|
869
869
|
Dialog(
|
|
870
870
|
title = dialog.getTitle(),
|
|
871
871
|
text = dialog.getText(),
|
|
872
|
+
type = "error",
|
|
872
873
|
)
|
|
873
874
|
|
|
874
875
|
onDialogDisplay(dialog)
|
|
@@ -881,6 +882,7 @@ fun LibVlcPlayerView.setDialogCallbacks(ILibVLC: LibVLC?) {
|
|
|
881
882
|
Dialog(
|
|
882
883
|
title = dialog.getTitle(),
|
|
883
884
|
text = dialog.getText(),
|
|
885
|
+
type = "login",
|
|
884
886
|
)
|
|
885
887
|
|
|
886
888
|
onDialogDisplay(dialog)
|
|
@@ -893,6 +895,7 @@ fun LibVlcPlayerView.setDialogCallbacks(ILibVLC: LibVLC?) {
|
|
|
893
895
|
Dialog(
|
|
894
896
|
title = dialog.getTitle(),
|
|
895
897
|
text = dialog.getText(),
|
|
898
|
+
type = "question",
|
|
896
899
|
cancelText = dialog.getCancelText(),
|
|
897
900
|
action1Text = dialog.getAction1Text(),
|
|
898
901
|
action2Text = dialog.getAction2Text(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LibVlcPlayer.types.d.ts","sourceRoot":"","sources":["../src/LibVlcPlayer.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C,MAAM,MAAM,wBAAwB,GAAG,EAAE,CAAC;AAE1C,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC;;;;;;;OAOG;IACH,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CA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e,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,KAAK,IAAI,CAAC;IACtC;;OAEG;IACH,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;IAC9C;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IACzC;;OAEG;IACH,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IAC7C;;OAEG;IACH,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;IAC5C;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IACzC;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B;;OAEG;IACH,uBAAuB,CAAC,EAAE,MAAM,IAAI,CAAC;IACrC;;OAEG;IACH,sBAAsB,CAAC,EAAE,MAAM,IAAI,CAAC;CACrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LibVlcPlayer.types.js","sourceRoot":"","sources":["../src/LibVlcPlayer.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ViewProps } from \"react-native\";\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport type LibVlcPlayerModuleEvents = {};\n\nexport interface LibVlcPlayerViewRef {\n /**\n * Starts playback of the current player\n *\n * @returns A promise which resolves to `void`\n */\n readonly play: () => Promise<void>;\n /**\n * Pauses playback of the current player\n *\n * @returns A promise which resolves to `void`\n */\n readonly pause: () => Promise<void>;\n /**\n * Stops playback of the current player\n *\n * @returns A promise which resolves to `void`\n */\n readonly stop: () => Promise<void>;\n /**\n * Sets the time or position of the current player\n *\n * @param value - Must be a number equal or greater than `0`\n * @param type - Defaults to `\"time\"`\n *\n * @returns A promise which resolves to `void`\n */\n readonly seek: (value: number, type?: \"time\" | \"position\") => Promise<void>;\n /**\n * Starts or stops recording the current media\n *\n * @param path - Must be a valid directory path string or `undefined` to stop recording\n *\n * @returns A promise which resolves to `void`\n */\n readonly record: (path?: string) => Promise<void>;\n /**\n * Takes a snapshot of the current media\n *\n * @param path - Must be a valid directory path string\n *\n * @returns A promise which resolves to `void`\n */\n readonly snapshot: (path: string) => Promise<void>;\n /**\n * Posts an answer to a `Dialog`\n *\n * @param action - Must be an integer of `1` or `2`\n *\n * @returns A promise which resolves to `void`\n */\n readonly postAction: (action: 1 | 2) => Promise<void>;\n /**\n * Posts a username and password to a login `Dialog`\n *\n * @param username - Must be a valid username, can't be empty\n * @param password - Must be a valid password, can be empty\n * @param store - If `true`, store the credentials\n *\n * @returns A promise which resolves to `void`\n */\n readonly postLogin: (\n username: string,\n password: string,\n store?: boolean,\n ) => Promise<void>;\n /**\n * Dismisses a `Dialog`\n *\n * @returns A promise which resolves to `void`\n */\n readonly dismiss: () => Promise<void>;\n /**\n * Enters Picture-in-Picture (PiP) mode\n *\n * @note Config plugin has to be configured for Picture-in-Picture (PiP) to work\n *\n * @returns A promise which resolves to `void`\n */\n readonly startPictureInPicture: () => Promise<void>;\n /**\n * Exits Picture-in-Picture (PiP) mode\n *\n * @platform ios\n *\n * @returns A promise which resolves to `void`\n */\n readonly stopPictureInPicture: () => Promise<void>;\n}\n\nexport type LibVlcSource = string | number | null;\n\nexport interface Tracks {\n audio?: number;\n video?: number;\n subtitle?: number;\n}\n\nexport interface Slave {\n source: NonNullable<LibVlcSource>;\n type: \"audio\" | \"subtitle\";\n selected?: boolean;\n}\n\nexport type VideoAspectRatio = \"auto\" | string | number;\n\nexport type VideoContentFit = \"contain\" | \"cover\" | \"fill\";\n\nexport type AudioMixingMode =\n | \"mixWithOthers\"\n | \"duckOthers\"\n | \"auto\"\n | \"doNotMix\";\n\nexport interface NativeEventProps {\n target: number;\n}\n\nexport interface NativeEvent<T> {\n nativeEvent: T & NativeEventProps;\n}\n\nexport type LibVlcEvent<T> = Omit<T & NativeEventProps, \"target\">;\n\nexport interface Dialog {\n title: string;\n text: string;\n cancelText?: string;\n action1Text?: string;\n action2Text?: string;\n}\n\nexport interface Recording {\n path: string | null;\n isRecording: boolean;\n}\n\nexport interface Track {\n id: number;\n name: string;\n}\n\nexport interface MediaTracks {\n audio: Track[];\n video: Track[];\n subtitle: Track[];\n}\n\nexport interface MediaInfo {\n width: number;\n height: number;\n length: number;\n seekable: boolean;\n}\n\n/**\n * @hidden\n */\ntype BufferingListener = () => void;\n\n/**\n * @hidden\n */\ntype PlayingListener = () => void;\n\n/**\n * @hidden\n */\ntype PausedListener = () => void;\n\n/**\n * @hidden\n */\ntype StoppedListener = () => void;\n\nexport type Error = { error: string };\n\n/**\n * @hidden\n */\ntype EncounteredErrorListener = (event: NativeEvent<Error>) => void;\n\nexport type Time = { time: number };\n\n/**\n * @hidden\n */\ntype TimeChangedListener = (event: NativeEvent<Time>) => void;\n\nexport type Position = { position: number };\n\n/**\n * @hidden\n */\ntype PositionChangedListener = (event: NativeEvent<Position>) => void;\n\n/**\n * @hidden\n */\ntype ESAddedListener = (event: NativeEvent<MediaTracks>) => void;\n\n/**\n * @hidden\n */\ntype RecordChangedListener = (event: NativeEvent<Recording>) => void;\n\nexport type Snapshot = { path: string };\n\n/**\n * @hidden\n */\ntype SnapshotTakenListener = (event: NativeEvent<Snapshot>) => void;\n\n/**\n * @hidden\n */\ntype DialogDisplayListener = (event: NativeEvent<Dialog>) => void;\n\n/**\n * @hidden\n */\ntype FirstPlayListener = (event: NativeEvent<MediaInfo>) => void;\n\n/**\n * @hidden\n */\ntype ForegroundListener = () => void;\n\n/**\n * @hidden\n */\ntype BackgroundListener = () => void;\n\n/**\n * @hidden\n */\ntype PictureInPictureStartListener = () => void;\n\n/**\n * @hidden\n */\ntype PictureInPictureStopListener = () => void;\n\n/**\n * @hidden\n */\nexport interface LibVlcPlayerViewNativeProps extends ViewProps {\n ref?: React.Ref<LibVlcPlayerViewRef>;\n source?: LibVlcSource;\n options?: string[];\n tracks?: Tracks;\n slaves?: Slave[];\n scale?: number;\n aspectRatio?: VideoAspectRatio;\n contentFit?: VideoContentFit;\n rate?: number;\n time?: number;\n volume?: number;\n mute?: boolean;\n audioMixingMode?: AudioMixingMode;\n repeat?: boolean;\n autoplay?: boolean;\n pictureInPicture?: boolean;\n onBuffering?: BufferingListener;\n onPlaying?: PlayingListener;\n onPaused?: PausedListener;\n onStopped?: StoppedListener;\n onEncounteredError?: EncounteredErrorListener;\n onDialogDisplay?: DialogDisplayListener;\n onTimeChanged?: TimeChangedListener;\n onPositionChanged?: PositionChangedListener;\n onESAdded?: ESAddedListener;\n onRecordChanged?: RecordChangedListener;\n onSnapshotTaken?: SnapshotTakenListener;\n onFirstPlay?: FirstPlayListener;\n onForeground?: ForegroundListener;\n onBackground?: BackgroundListener;\n onPictureInPictureStart?: PictureInPictureStartListener;\n onPictureInPictureStop?: PictureInPictureStopListener;\n}\n\nexport interface LibVlcPlayerViewProps extends ViewProps {\n /**\n * Sets the source of the media to be played. Set to `null` to release the player\n *\n * @example\n *\n * ```tsx\n * const BIG_BUCK_BUNNY =\n * \"https://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_720p_h264.mov\";\n *\n * <LibVlcPlayerView source={BIG_BUCK_BUNNY} />\n * ```\n */\n source: LibVlcSource;\n /**\n * Sets the VLC options to initialize the player with\n *\n * https://wiki.videolan.org/VLC_command-line_help/\n *\n * @example\n *\n * ```tsx\n * const options = [\"--network-caching=1000\"];\n *\n * <LibVlcPlayerView\n * source={BIG_BUCK_BUNNY}\n * options={options}\n * />\n * ```\n *\n * @default []\n */\n options?: string[];\n /**\n * Sets the player audio, video and subtitle tracks\n *\n * @example\n *\n * ```tsx\n * const tracks = {\n * audio: 3,\n * video: 2,\n * subtitle: 1,\n * };\n *\n * <LibVlcPlayerView\n * source={BIG_BUCK_BUNNY}\n * tracks={tracks}\n * />\n * ```\n *\n * @default undefined\n */\n tracks?: Tracks;\n /**\n * Sets the player audio and subtitle slaves\n *\n * @example\n *\n * ```tsx\n * const subtitles = [{\n * source: \"file://path/to/subtitle.srt\",\n * type: \"subtitle\",\n * selected: true,\n * }];\n *\n * <LibVlcPlayerView\n * source={BIG_BUCK_BUNNY}\n * slaves={subtitles}\n * />\n * ```\n *\n * @default []\n */\n slaves?: Slave[];\n /**\n * Sets the player scaling factor. Must be a float equal or greater than `0`\n *\n * @default 0\n */\n scale?: number;\n /**\n * Sets the container aspect ratio. Must be a valid ratio string or number\n *\n * @example \"16:9\"\n *\n * @default undefined\n */\n aspectRatio?: VideoAspectRatio;\n /**\n * Sets how the video should be scaled to fit in the container\n *\n * @example \"cover\"\n *\n * @default \"contain\"\n */\n contentFit?: VideoContentFit;\n /**\n * Sets the player rate. Must be a float equal or greater than `1`\n *\n * @default 1\n */\n rate?: number;\n /**\n * Sets the initial player time. Must be an integer in milliseconds\n *\n * @default 0\n */\n time?: number;\n /**\n * Sets the player volume. Must be an integer between `0` and `100`\n *\n * @default 100\n */\n volume?: number;\n /**\n * Sets the player volume to `0` when `true`. Previous value is set when `false`\n *\n * @default false\n */\n mute?: boolean;\n /**\n * Determines how the player will interact with other audio playing in the system\n *\n * @example \"doNotMix\"\n *\n * @default \"auto\"\n */\n audioMixingMode?: AudioMixingMode;\n /**\n * Determines whether the media should repeat once ended\n *\n * @default false\n */\n repeat?: boolean;\n /**\n * Determines whether the media should autoplay once created\n *\n * @default true\n */\n autoplay?: boolean;\n /**\n * Determines whether the player should allow Picture-in-Picture (PiP) mode\n *\n * @default false\n */\n pictureInPicture?: boolean;\n /**\n * Called after the `Buffering` player event\n */\n onBuffering?: () => void;\n /**\n * Called after the `Playing` player event\n */\n onPlaying?: () => void;\n /**\n * Called after the `Paused` player event\n */\n onPaused?: () => void;\n /**\n * Called after the `Stopped` player event\n */\n onStopped?: () => void;\n /**\n * Called after the `EncounteredError` player event\n */\n onEncounteredError?: (event: Error) => void;\n /**\n * Called after a `Dialog` needs to be displayed\n */\n onDialogDisplay?: (event: Dialog) => void;\n /**\n * Called after the `TimeChanged` player event\n */\n onTimeChanged?: (event: Time) => void;\n /**\n * Called after the `PositionChanged` player event\n */\n onPositionChanged?: (event: Position) => void;\n /**\n * Called after the `ESAdded` player event\n */\n onESAdded?: (event: MediaTracks) => void;\n /**\n * Called after the `RecordChanged` player event\n */\n onRecordChanged?: (event: Recording) => void;\n /**\n * Called after a media snapshot is taken\n */\n onSnapshotTaken?: (event: Snapshot) => void;\n /**\n * Called after the player first playing event\n */\n onFirstPlay?: (event: MediaInfo) => void;\n /**\n * Called after the player enters the foreground\n */\n onForeground?: () => void;\n /**\n * Called after the player enters the background\n */\n onBackground?: () => void;\n /**\n * Called after the player enters Picture-in-Picture (PiP) mode\n */\n onPictureInPictureStart?: () => void;\n /**\n * Called after the player exits Picture-in-Picture (PiP) mode\n */\n onPictureInPictureStop?: () => void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"LibVlcPlayer.types.js","sourceRoot":"","sources":["../src/LibVlcPlayer.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ViewProps } from \"react-native\";\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport type LibVlcPlayerModuleEvents = {};\n\nexport interface LibVlcPlayerViewRef {\n /**\n * Starts playback of the current player\n *\n * @returns A promise which resolves to `void`\n */\n readonly play: () => Promise<void>;\n /**\n * Pauses playback of the current player\n *\n * @returns A promise which resolves to `void`\n */\n readonly pause: () => Promise<void>;\n /**\n * Stops playback of the current player\n *\n * @returns A promise which resolves to `void`\n */\n readonly stop: () => Promise<void>;\n /**\n * Sets the time or position of the current player\n *\n * @param value - Must be a number equal or greater than `0`\n * @param type - Defaults to `\"time\"`\n *\n * @returns A promise which resolves to `void`\n */\n readonly seek: (value: number, type?: \"time\" | \"position\") => Promise<void>;\n /**\n * Starts or stops recording the current media\n *\n * @param path - Must be a valid directory path string or `undefined` to stop recording\n *\n * @returns A promise which resolves to `void`\n */\n readonly record: (path?: string) => Promise<void>;\n /**\n * Takes a snapshot of the current media\n *\n * @param path - Must be a valid directory path string\n *\n * @returns A promise which resolves to `void`\n */\n readonly snapshot: (path: string) => Promise<void>;\n /**\n * Posts an answer to a `Dialog`\n *\n * @param action - Must be an integer of `1` or `2`\n *\n * @returns A promise which resolves to `void`\n */\n readonly postAction: (action: 1 | 2) => Promise<void>;\n /**\n * Posts a username and password to a login `Dialog`\n *\n * @param username - Must be a valid username, can't be empty\n * @param password - Must be a valid password, can be empty\n * @param store - If `true`, store the credentials\n *\n * @returns A promise which resolves to `void`\n */\n readonly postLogin: (username: string, password: string, store?: boolean) => Promise<void>;\n /**\n * Dismisses a `Dialog`\n *\n * @returns A promise which resolves to `void`\n */\n readonly dismiss: () => Promise<void>;\n /**\n * Enters Picture-in-Picture (PiP) mode\n *\n * @note Config plugin has to be configured for Picture-in-Picture (PiP) to work\n *\n * @returns A promise which resolves to `void`\n */\n readonly startPictureInPicture: () => Promise<void>;\n /**\n * Exits Picture-in-Picture (PiP) mode\n *\n * @platform ios\n *\n * @returns A promise which resolves to `void`\n */\n readonly stopPictureInPicture: () => Promise<void>;\n}\n\nexport type LibVlcSource = string | number | null;\n\nexport interface Tracks {\n audio?: number;\n video?: number;\n subtitle?: number;\n}\n\nexport interface Slave {\n source: NonNullable<LibVlcSource>;\n type: \"audio\" | \"subtitle\";\n selected?: boolean;\n}\n\nexport type VideoAspectRatio = \"auto\" | string | number;\n\nexport type VideoContentFit = \"contain\" | \"cover\" | \"fill\";\n\nexport type AudioMixingMode = \"mixWithOthers\" | \"duckOthers\" | \"auto\" | \"doNotMix\";\n\nexport interface NativeEventProps {\n target: number;\n}\n\nexport interface NativeEvent<T> {\n nativeEvent: T & NativeEventProps;\n}\n\nexport type LibVlcEvent<T> = Omit<T & NativeEventProps, \"target\">;\n\nexport interface Dialog {\n title: string;\n text: string;\n type: \"error\" | \"login\" | \"question\";\n cancelText?: string;\n action1Text?: string;\n action2Text?: string;\n}\n\nexport interface Recording {\n path: string | null;\n isRecording: boolean;\n}\n\nexport interface Track {\n id: number;\n name: string;\n}\n\nexport interface MediaTracks {\n audio: Track[];\n video: Track[];\n subtitle: Track[];\n}\n\nexport interface MediaInfo {\n width: number;\n height: number;\n length: number;\n seekable: boolean;\n}\n\n/**\n * @hidden\n */\ntype BufferingListener = () => void;\n\n/**\n * @hidden\n */\ntype PlayingListener = () => void;\n\n/**\n * @hidden\n */\ntype PausedListener = () => void;\n\n/**\n * @hidden\n */\ntype StoppedListener = () => void;\n\nexport type Error = { error: string };\n\n/**\n * @hidden\n */\ntype EncounteredErrorListener = (event: NativeEvent<Error>) => void;\n\nexport type Time = { time: number };\n\n/**\n * @hidden\n */\ntype TimeChangedListener = (event: NativeEvent<Time>) => void;\n\nexport type Position = { position: number };\n\n/**\n * @hidden\n */\ntype PositionChangedListener = (event: NativeEvent<Position>) => void;\n\n/**\n * @hidden\n */\ntype ESAddedListener = (event: NativeEvent<MediaTracks>) => void;\n\n/**\n * @hidden\n */\ntype RecordChangedListener = (event: NativeEvent<Recording>) => void;\n\nexport type Snapshot = { path: string };\n\n/**\n * @hidden\n */\ntype SnapshotTakenListener = (event: NativeEvent<Snapshot>) => void;\n\n/**\n * @hidden\n */\ntype DialogDisplayListener = (event: NativeEvent<Dialog>) => void;\n\n/**\n * @hidden\n */\ntype FirstPlayListener = (event: NativeEvent<MediaInfo>) => void;\n\n/**\n * @hidden\n */\ntype ForegroundListener = () => void;\n\n/**\n * @hidden\n */\ntype BackgroundListener = () => void;\n\n/**\n * @hidden\n */\ntype PictureInPictureStartListener = () => void;\n\n/**\n * @hidden\n */\ntype PictureInPictureStopListener = () => void;\n\n/**\n * @hidden\n */\nexport interface LibVlcPlayerViewNativeProps extends ViewProps {\n ref?: React.Ref<LibVlcPlayerViewRef>;\n source?: LibVlcSource;\n options?: string[];\n tracks?: Tracks;\n slaves?: Slave[];\n scale?: number;\n aspectRatio?: VideoAspectRatio;\n contentFit?: VideoContentFit;\n rate?: number;\n time?: number;\n volume?: number;\n mute?: boolean;\n audioMixingMode?: AudioMixingMode;\n repeat?: boolean;\n autoplay?: boolean;\n pictureInPicture?: boolean;\n onBuffering?: BufferingListener;\n onPlaying?: PlayingListener;\n onPaused?: PausedListener;\n onStopped?: StoppedListener;\n onEncounteredError?: EncounteredErrorListener;\n onDialogDisplay?: DialogDisplayListener;\n onTimeChanged?: TimeChangedListener;\n onPositionChanged?: PositionChangedListener;\n onESAdded?: ESAddedListener;\n onRecordChanged?: RecordChangedListener;\n onSnapshotTaken?: SnapshotTakenListener;\n onFirstPlay?: FirstPlayListener;\n onForeground?: ForegroundListener;\n onBackground?: BackgroundListener;\n onPictureInPictureStart?: PictureInPictureStartListener;\n onPictureInPictureStop?: PictureInPictureStopListener;\n}\n\nexport interface LibVlcPlayerViewProps extends ViewProps {\n /**\n * Sets the source of the media to be played. Set to `null` to release the player\n *\n * @example\n *\n * ```tsx\n * const BIG_BUCK_BUNNY =\n * \"https://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_720p_h264.mov\";\n *\n * <LibVlcPlayerView source={BIG_BUCK_BUNNY} />\n * ```\n */\n source: LibVlcSource;\n /**\n * Sets the VLC options to initialize the player with\n *\n * https://wiki.videolan.org/VLC_command-line_help/\n *\n * @example\n *\n * ```tsx\n * const options = [\"--network-caching=1000\"];\n *\n * <LibVlcPlayerView\n * source={BIG_BUCK_BUNNY}\n * options={options}\n * />\n * ```\n *\n * @default []\n */\n options?: string[];\n /**\n * Sets the player audio, video and subtitle tracks\n *\n * @example\n *\n * ```tsx\n * const tracks = {\n * audio: 3,\n * video: 2,\n * subtitle: 1,\n * };\n *\n * <LibVlcPlayerView\n * source={BIG_BUCK_BUNNY}\n * tracks={tracks}\n * />\n * ```\n *\n * @default undefined\n */\n tracks?: Tracks;\n /**\n * Sets the player audio and subtitle slaves\n *\n * @example\n *\n * ```tsx\n * const subtitles = [{\n * source: \"file://path/to/subtitle.srt\",\n * type: \"subtitle\",\n * selected: true,\n * }];\n *\n * <LibVlcPlayerView\n * source={BIG_BUCK_BUNNY}\n * slaves={subtitles}\n * />\n * ```\n *\n * @default []\n */\n slaves?: Slave[];\n /**\n * Sets the player scaling factor. Must be a float equal or greater than `0`\n *\n * @default 0\n */\n scale?: number;\n /**\n * Sets the container aspect ratio. Must be a valid ratio string or number\n *\n * @example \"16:9\"\n *\n * @default undefined\n */\n aspectRatio?: VideoAspectRatio;\n /**\n * Sets how the video should be scaled to fit in the container\n *\n * @example \"cover\"\n *\n * @default \"contain\"\n */\n contentFit?: VideoContentFit;\n /**\n * Sets the player rate. Must be a float equal or greater than `1`\n *\n * @default 1\n */\n rate?: number;\n /**\n * Sets the initial player time. Must be an integer in milliseconds\n *\n * @default 0\n */\n time?: number;\n /**\n * Sets the player volume. Must be an integer between `0` and `100`\n *\n * @default 100\n */\n volume?: number;\n /**\n * Sets the player volume to `0` when `true`. Previous value is set when `false`\n *\n * @default false\n */\n mute?: boolean;\n /**\n * Determines how the player will interact with other audio playing in the system\n *\n * @example \"doNotMix\"\n *\n * @default \"auto\"\n */\n audioMixingMode?: AudioMixingMode;\n /**\n * Determines whether the media should repeat once ended\n *\n * @default false\n */\n repeat?: boolean;\n /**\n * Determines whether the media should autoplay once created\n *\n * @default true\n */\n autoplay?: boolean;\n /**\n * Determines whether the player should allow Picture-in-Picture (PiP) mode\n *\n * @default false\n */\n pictureInPicture?: boolean;\n /**\n * Called after the `Buffering` player event\n */\n onBuffering?: () => void;\n /**\n * Called after the `Playing` player event\n */\n onPlaying?: () => void;\n /**\n * Called after the `Paused` player event\n */\n onPaused?: () => void;\n /**\n * Called after the `Stopped` player event\n */\n onStopped?: () => void;\n /**\n * Called after the `EncounteredError` player event\n */\n onEncounteredError?: (event: Error) => void;\n /**\n * Called after a `Dialog` needs to be displayed\n */\n onDialogDisplay?: (event: Dialog) => void;\n /**\n * Called after the `TimeChanged` player event\n */\n onTimeChanged?: (event: Time) => void;\n /**\n * Called after the `PositionChanged` player event\n */\n onPositionChanged?: (event: Position) => void;\n /**\n * Called after the `ESAdded` player event\n */\n onESAdded?: (event: MediaTracks) => void;\n /**\n * Called after the `RecordChanged` player event\n */\n onRecordChanged?: (event: Recording) => void;\n /**\n * Called after a media snapshot is taken\n */\n onSnapshotTaken?: (event: Snapshot) => void;\n /**\n * Called after the player first playing event\n */\n onFirstPlay?: (event: MediaInfo) => void;\n /**\n * Called after the player enters the foreground\n */\n onForeground?: () => void;\n /**\n * Called after the player enters the background\n */\n onBackground?: () => void;\n /**\n * Called after the player enters Picture-in-Picture (PiP) mode\n */\n onPictureInPictureStart?: () => void;\n /**\n * Called after the player exits Picture-in-Picture (PiP) mode\n */\n onPictureInPictureStop?: () => void;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LibVlcPlayerView.d.ts","sourceRoot":"","sources":["../src/LibVlcPlayerView.tsx"],"names":[],"mappings":"AAIA,OAAO,EAEL,qBAAqB,EACrB,mBAAmB,EAWpB,MAAM,sBAAsB,CAAC;AAe9B,QAAA,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"LibVlcPlayerView.d.ts","sourceRoot":"","sources":["../src/LibVlcPlayerView.tsx"],"names":[],"mappings":"AAIA,OAAO,EAEL,qBAAqB,EACrB,mBAAmB,EAWpB,MAAM,sBAAsB,CAAC;AAe9B,QAAA,MAAM,gBAAgB,uHAqGpB,CAAC;AAEH,eAAe,gBAAgB,CAAC"}
|
|
@@ -68,11 +68,11 @@ const LibVlcPlayerView = forwardRef((props, ref) => {
|
|
|
68
68
|
const aspectRatio = propRatio === "auto" ? defaultRatio.current : propRatio;
|
|
69
69
|
const nativeRatio = convertAspectRatio(aspectRatio);
|
|
70
70
|
return (<View style={{ aspectRatio: nativeRatio }}>
|
|
71
|
-
|
|
71
|
+
<NativeView {...props} ref={ref} style={[props.style, { height: "100%" }]} source={parseNativeSource(props.source)} slaves={props.slaves?.map((slave) => ({
|
|
72
72
|
...slave,
|
|
73
73
|
source: parseNativeSource(slave.source),
|
|
74
74
|
}))} onEncounteredError={onEncounteredError} onDialogDisplay={onDialogDisplay} onTimeChanged={onTimeChanged} onPositionChanged={onPositionChanged} onESAdded={onESAdded} onRecordChanged={onRecordChanged} onSnapshotTaken={onSnapshotTaken} onFirstPlay={onFirstPlay}/>
|
|
75
|
-
|
|
75
|
+
</View>);
|
|
76
76
|
});
|
|
77
77
|
export default LibVlcPlayerView;
|
|
78
78
|
//# sourceMappingURL=LibVlcPlayerView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LibVlcPlayerView.js","sourceRoot":"","sources":["../src/LibVlcPlayerView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAsB,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAiBpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD,MAAM,UAAU,GACd,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;AAExC,MAAM,0BAA0B,GAC9B,gNAAgN,CAAC;AAEnN,IAAI,8BAA8B,GAAY,KAAK,CAAC;AAEpD,MAAM,cAAc,GAAG,EAAE,GAAG,CAAC,CAAC;AAE9B,MAAM,gBAAgB,GAAG,UAAU,
|
|
1
|
+
{"version":3,"file":"LibVlcPlayerView.js","sourceRoot":"","sources":["../src/LibVlcPlayerView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAsB,MAAM,OAAO,CAAC;AAC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B;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,gBAAgB,CAAC","sourcesContent":["import { requireNativeView } from \"expo\";\nimport { forwardRef, useRef, type ComponentType } from \"react\";\nimport { View } from \"react-native\";\n\nimport {\n LibVlcPlayerViewNativeProps,\n LibVlcPlayerViewProps,\n LibVlcPlayerViewRef,\n type Dialog,\n type Error,\n type MediaInfo,\n type MediaTracks,\n type NativeEvent,\n type Position,\n type Recording,\n type Snapshot,\n type Time,\n type VideoAspectRatio,\n} from \"./LibVlcPlayer.types\";\nimport { convertAspectRatio } from \"./utils/aspect\";\nimport { parseNativeSource } from \"./utils/assets\";\nimport { convertNativeEvent } from \"./utils/events\";\n\nconst NativeView: ComponentType<LibVlcPlayerViewNativeProps> =\n requireNativeView(\"ExpoLibVlcPlayer\");\n\nconst RENDERING_CHILDREN_WARNING =\n \"The <LibVlcPlayerView> component does not support children. This may lead to inconsistent behaviour or crashes. If you want to render content on top of the LibVlcPlayer, consider using absolute positioning.\";\n\nlet loggedRenderingChildrenWarning: boolean = false;\n\nconst FALLBACK_RATIO = 16 / 9;\n\nconst LibVlcPlayerView = forwardRef<LibVlcPlayerViewRef, LibVlcPlayerViewProps>((props, ref) => {\n const defaultRatio = useRef<VideoAspectRatio>(FALLBACK_RATIO);\n\n if (props.children && !loggedRenderingChildrenWarning) {\n console.warn(RENDERING_CHILDREN_WARNING);\n loggedRenderingChildrenWarning = true;\n }\n\n const onEncounteredError = (event: NativeEvent<Error>) => {\n const nativeEvent = convertNativeEvent(event);\n\n if (props.onEncounteredError) {\n props.onEncounteredError(nativeEvent);\n }\n };\n\n const onDialogDisplay = (event: NativeEvent<Dialog>) => {\n const nativeEvent = convertNativeEvent(event);\n\n if (props.onDialogDisplay) {\n props.onDialogDisplay(nativeEvent);\n }\n };\n\n const onTimeChanged = (event: NativeEvent<Time>) => {\n const nativeEvent = convertNativeEvent(event);\n\n if (props.onTimeChanged) {\n props.onTimeChanged(nativeEvent);\n }\n };\n\n const onPositionChanged = (event: NativeEvent<Position>) => {\n const nativeEvent = convertNativeEvent(event);\n\n if (props.onPositionChanged) {\n props.onPositionChanged(nativeEvent);\n }\n };\n\n const onESAdded = (event: NativeEvent<MediaTracks>) => {\n const nativeEvent = convertNativeEvent(event);\n\n if (props.onESAdded) {\n props.onESAdded(nativeEvent);\n }\n };\n\n const onRecordChanged = (event: NativeEvent<Recording>) => {\n const nativeEvent = convertNativeEvent(event);\n\n if (props.onRecordChanged) {\n props.onRecordChanged(nativeEvent);\n }\n };\n\n const onSnapshotTaken = (event: NativeEvent<Snapshot>) => {\n const nativeEvent = convertNativeEvent(event);\n\n if (props.onSnapshotTaken) {\n props.onSnapshotTaken(nativeEvent);\n }\n };\n\n const onFirstPlay = (event: NativeEvent<MediaInfo>) => {\n const nativeEvent = convertNativeEvent(event);\n const mediaRatio = nativeEvent.width / nativeEvent.height;\n\n if (props.onFirstPlay) {\n props.onFirstPlay(nativeEvent);\n }\n\n defaultRatio.current = mediaRatio || FALLBACK_RATIO;\n };\n\n const propRatio = props.aspectRatio;\n const aspectRatio = propRatio === \"auto\" ? defaultRatio.current : propRatio;\n const nativeRatio = convertAspectRatio(aspectRatio);\n\n return (\n <View style={{ aspectRatio: nativeRatio }}>\n <NativeView\n {...props}\n ref={ref}\n style={[props.style, { height: \"100%\" }]}\n source={parseNativeSource(props.source)}\n slaves={props.slaves?.map((slave) => ({\n ...slave,\n source: parseNativeSource(slave.source)!,\n }))}\n onEncounteredError={onEncounteredError}\n onDialogDisplay={onDialogDisplay}\n onTimeChanged={onTimeChanged}\n onPositionChanged={onPositionChanged}\n onESAdded={onESAdded}\n onRecordChanged={onRecordChanged}\n onSnapshotTaken={onSnapshotTaken}\n onFirstPlay={onFirstPlay}\n />\n </View>\n );\n});\n\nexport default LibVlcPlayerView;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aspect.d.ts","sourceRoot":"","sources":["../../src/utils/aspect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,wBAAgB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"aspect.d.ts","sourceRoot":"","sources":["../../src/utils/aspect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,EAAE,gBAAgB,GAAG,gBAAgB,GAAG,SAAS,CAgBzF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aspect.js","sourceRoot":"","sources":["../../src/utils/aspect.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,kBAAkB,
|
|
1
|
+
{"version":3,"file":"aspect.js","sourceRoot":"","sources":["../../src/utils/aspect.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,kBAAkB,CAAC,KAAwB;IACzD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAEjC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzB,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YAE5C,MAAM,YAAY,GAAG,KAAK,GAAG,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC;YAE7C,IAAI,YAAY,EAAE,CAAC;gBACjB,OAAO,KAAK,GAAG,MAAM,CAAC;YACxB,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { VideoAspectRatio } from \"../LibVlcPlayer.types\";\n\nexport function convertAspectRatio(ratio?: VideoAspectRatio): VideoAspectRatio | undefined {\n if (typeof ratio === \"string\") {\n const numbers = ratio.split(\":\");\n\n if (numbers.length === 2) {\n const [width, height] = numbers.map(Number);\n\n const hasVideoSize = width > 0 && height > 0;\n\n if (hasVideoSize) {\n return width / height;\n }\n }\n }\n\n return ratio;\n}\n"]}
|
package/expo-module.config.json
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"platforms": [
|
|
3
|
-
"apple",
|
|
4
|
-
"android"
|
|
5
|
-
],
|
|
2
|
+
"platforms": ["apple", "android"],
|
|
6
3
|
"apple": {
|
|
7
|
-
"modules": [
|
|
8
|
-
"LibVlcPlayerModule"
|
|
9
|
-
]
|
|
4
|
+
"modules": ["LibVlcPlayerModule"]
|
|
10
5
|
},
|
|
11
6
|
"android": {
|
|
12
|
-
"modules": [
|
|
13
|
-
"expo.modules.libvlcplayer.LibVlcPlayerModule"
|
|
14
|
-
]
|
|
7
|
+
"modules": ["expo.modules.libvlcplayer.LibVlcPlayerModule"]
|
|
15
8
|
}
|
|
16
|
-
}
|
|
9
|
+
}
|
|
@@ -703,7 +703,8 @@ extension LibVlcPlayerView: VLCCustomDialogRendererProtocol {
|
|
|
703
703
|
) {
|
|
704
704
|
let dialog = Dialog(
|
|
705
705
|
title: title,
|
|
706
|
-
text: message
|
|
706
|
+
text: message,
|
|
707
|
+
type: "error"
|
|
707
708
|
)
|
|
708
709
|
|
|
709
710
|
onDialogDisplay(dialog)
|
|
@@ -720,7 +721,8 @@ extension LibVlcPlayerView: VLCCustomDialogRendererProtocol {
|
|
|
720
721
|
|
|
721
722
|
let dialog = Dialog(
|
|
722
723
|
title: title,
|
|
723
|
-
text: message
|
|
724
|
+
text: message,
|
|
725
|
+
type: "login"
|
|
724
726
|
)
|
|
725
727
|
|
|
726
728
|
onDialogDisplay(dialog)
|
|
@@ -740,6 +742,7 @@ extension LibVlcPlayerView: VLCCustomDialogRendererProtocol {
|
|
|
740
742
|
let dialog = Dialog(
|
|
741
743
|
title: title,
|
|
742
744
|
text: message,
|
|
745
|
+
type: "question",
|
|
743
746
|
cancelText: cancel,
|
|
744
747
|
action1Text: action1String,
|
|
745
748
|
action2Text: action2String
|
package/ios/Records/Dialog.swift
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-libvlc-player",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.1",
|
|
4
4
|
"description": "LibVLC Player for Expo",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@eslint/js": "^9.39.4",
|
|
40
40
|
"@types/react": "~19.2.10",
|
|
41
41
|
"eslint": "^9.39.4",
|
|
42
|
-
"expo": "~55.0.
|
|
42
|
+
"expo": "~55.0.14",
|
|
43
43
|
"expo-module-scripts": "^55.0.2",
|
|
44
44
|
"globals": "^16.5.0",
|
|
45
45
|
"husky": "^9.1.7",
|
|
@@ -6,8 +6,7 @@ import {
|
|
|
6
6
|
type ConfigPlugin,
|
|
7
7
|
} from "expo/config-plugins";
|
|
8
8
|
|
|
9
|
-
const LOCAL_NETWORK_USAGE =
|
|
10
|
-
"Allow $(PRODUCT_NAME) to access your local network";
|
|
9
|
+
const LOCAL_NETWORK_USAGE = "Allow $(PRODUCT_NAME) to access your local network";
|
|
11
10
|
|
|
12
11
|
type WithExpoLibVlcPlayerOptions = {
|
|
13
12
|
localNetworkPermission?: string;
|
|
@@ -16,7 +15,7 @@ type WithExpoLibVlcPlayerOptions = {
|
|
|
16
15
|
|
|
17
16
|
const withExpoLibVlcPlayer: ConfigPlugin<WithExpoLibVlcPlayerOptions> = (
|
|
18
17
|
config,
|
|
19
|
-
{ localNetworkPermission, supportsPictureInPicture } = {}
|
|
18
|
+
{ localNetworkPermission, supportsPictureInPicture } = {}
|
|
20
19
|
) => {
|
|
21
20
|
IOSConfig.Permissions.createPermissionsPlugin({
|
|
22
21
|
NSLocalNetworkUsageDescription: LOCAL_NETWORK_USAGE,
|
|
@@ -45,9 +44,7 @@ const withExpoLibVlcPlayer: ConfigPlugin<WithExpoLibVlcPlayerOptions> = (
|
|
|
45
44
|
const needsConfigMod = typeof supportsPictureInPicture === "boolean";
|
|
46
45
|
|
|
47
46
|
if (needsConfigMod) {
|
|
48
|
-
const activity = AndroidConfig.Manifest.getMainActivityOrThrow(
|
|
49
|
-
config.modResults,
|
|
50
|
-
);
|
|
47
|
+
const activity = AndroidConfig.Manifest.getMainActivityOrThrow(config.modResults);
|
|
51
48
|
|
|
52
49
|
if (supportsPictureInPicture) {
|
|
53
50
|
activity.$["android:supportsPictureInPicture"] = "true";
|
|
@@ -64,11 +64,7 @@ export interface LibVlcPlayerViewRef {
|
|
|
64
64
|
*
|
|
65
65
|
* @returns A promise which resolves to `void`
|
|
66
66
|
*/
|
|
67
|
-
readonly postLogin: (
|
|
68
|
-
username: string,
|
|
69
|
-
password: string,
|
|
70
|
-
store?: boolean,
|
|
71
|
-
) => Promise<void>;
|
|
67
|
+
readonly postLogin: (username: string, password: string, store?: boolean) => Promise<void>;
|
|
72
68
|
/**
|
|
73
69
|
* Dismisses a `Dialog`
|
|
74
70
|
*
|
|
@@ -111,11 +107,7 @@ export type VideoAspectRatio = "auto" | string | number;
|
|
|
111
107
|
|
|
112
108
|
export type VideoContentFit = "contain" | "cover" | "fill";
|
|
113
109
|
|
|
114
|
-
export type AudioMixingMode =
|
|
115
|
-
| "mixWithOthers"
|
|
116
|
-
| "duckOthers"
|
|
117
|
-
| "auto"
|
|
118
|
-
| "doNotMix";
|
|
110
|
+
export type AudioMixingMode = "mixWithOthers" | "duckOthers" | "auto" | "doNotMix";
|
|
119
111
|
|
|
120
112
|
export interface NativeEventProps {
|
|
121
113
|
target: number;
|
|
@@ -130,6 +122,7 @@ export type LibVlcEvent<T> = Omit<T & NativeEventProps, "target">;
|
|
|
130
122
|
export interface Dialog {
|
|
131
123
|
title: string;
|
|
132
124
|
text: string;
|
|
125
|
+
type: "error" | "login" | "question";
|
|
133
126
|
cancelText?: string;
|
|
134
127
|
action1Text?: string;
|
|
135
128
|
action2Text?: string;
|
package/src/LibVlcPlayerView.tsx
CHANGED
|
@@ -31,109 +31,107 @@ let loggedRenderingChildrenWarning: boolean = false;
|
|
|
31
31
|
|
|
32
32
|
const FALLBACK_RATIO = 16 / 9;
|
|
33
33
|
|
|
34
|
-
const LibVlcPlayerView = forwardRef<LibVlcPlayerViewRef, LibVlcPlayerViewProps>(
|
|
35
|
-
|
|
36
|
-
const defaultRatio = useRef<VideoAspectRatio>(FALLBACK_RATIO);
|
|
34
|
+
const LibVlcPlayerView = forwardRef<LibVlcPlayerViewRef, LibVlcPlayerViewProps>((props, ref) => {
|
|
35
|
+
const defaultRatio = useRef<VideoAspectRatio>(FALLBACK_RATIO);
|
|
37
36
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
if (props.children && !loggedRenderingChildrenWarning) {
|
|
38
|
+
console.warn(RENDERING_CHILDREN_WARNING);
|
|
39
|
+
loggedRenderingChildrenWarning = true;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const onEncounteredError = (event: NativeEvent<Error>) => {
|
|
43
|
+
const nativeEvent = convertNativeEvent(event);
|
|
44
|
+
|
|
45
|
+
if (props.onEncounteredError) {
|
|
46
|
+
props.onEncounteredError(nativeEvent);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const onDialogDisplay = (event: NativeEvent<Dialog>) => {
|
|
51
|
+
const nativeEvent = convertNativeEvent(event);
|
|
52
|
+
|
|
53
|
+
if (props.onDialogDisplay) {
|
|
54
|
+
props.onDialogDisplay(nativeEvent);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const onTimeChanged = (event: NativeEvent<Time>) => {
|
|
59
|
+
const nativeEvent = convertNativeEvent(event);
|
|
60
|
+
|
|
61
|
+
if (props.onTimeChanged) {
|
|
62
|
+
props.onTimeChanged(nativeEvent);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const onPositionChanged = (event: NativeEvent<Position>) => {
|
|
67
|
+
const nativeEvent = convertNativeEvent(event);
|
|
68
|
+
|
|
69
|
+
if (props.onPositionChanged) {
|
|
70
|
+
props.onPositionChanged(nativeEvent);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const onESAdded = (event: NativeEvent<MediaTracks>) => {
|
|
75
|
+
const nativeEvent = convertNativeEvent(event);
|
|
76
|
+
|
|
77
|
+
if (props.onESAdded) {
|
|
78
|
+
props.onESAdded(nativeEvent);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const onRecordChanged = (event: NativeEvent<Recording>) => {
|
|
83
|
+
const nativeEvent = convertNativeEvent(event);
|
|
84
|
+
|
|
85
|
+
if (props.onRecordChanged) {
|
|
86
|
+
props.onRecordChanged(nativeEvent);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const onSnapshotTaken = (event: NativeEvent<Snapshot>) => {
|
|
91
|
+
const nativeEvent = convertNativeEvent(event);
|
|
92
|
+
|
|
93
|
+
if (props.onSnapshotTaken) {
|
|
94
|
+
props.onSnapshotTaken(nativeEvent);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const onFirstPlay = (event: NativeEvent<MediaInfo>) => {
|
|
99
|
+
const nativeEvent = convertNativeEvent(event);
|
|
100
|
+
const mediaRatio = nativeEvent.width / nativeEvent.height;
|
|
101
|
+
|
|
102
|
+
if (props.onFirstPlay) {
|
|
103
|
+
props.onFirstPlay(nativeEvent);
|
|
41
104
|
}
|
|
42
105
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
props.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
const onESAdded = (event: NativeEvent<MediaTracks>) => {
|
|
76
|
-
const nativeEvent = convertNativeEvent(event);
|
|
77
|
-
|
|
78
|
-
if (props.onESAdded) {
|
|
79
|
-
props.onESAdded(nativeEvent);
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
const onRecordChanged = (event: NativeEvent<Recording>) => {
|
|
84
|
-
const nativeEvent = convertNativeEvent(event);
|
|
85
|
-
|
|
86
|
-
if (props.onRecordChanged) {
|
|
87
|
-
props.onRecordChanged(nativeEvent);
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
const onSnapshotTaken = (event: NativeEvent<Snapshot>) => {
|
|
92
|
-
const nativeEvent = convertNativeEvent(event);
|
|
93
|
-
|
|
94
|
-
if (props.onSnapshotTaken) {
|
|
95
|
-
props.onSnapshotTaken(nativeEvent);
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
const onFirstPlay = (event: NativeEvent<MediaInfo>) => {
|
|
100
|
-
const nativeEvent = convertNativeEvent(event);
|
|
101
|
-
const mediaRatio = nativeEvent.width / nativeEvent.height;
|
|
102
|
-
|
|
103
|
-
if (props.onFirstPlay) {
|
|
104
|
-
props.onFirstPlay(nativeEvent);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
defaultRatio.current = mediaRatio || FALLBACK_RATIO;
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
const propRatio = props.aspectRatio;
|
|
111
|
-
const aspectRatio = propRatio === "auto" ? defaultRatio.current : propRatio;
|
|
112
|
-
const nativeRatio = convertAspectRatio(aspectRatio);
|
|
113
|
-
|
|
114
|
-
return (
|
|
115
|
-
<View style={{ aspectRatio: nativeRatio }}>
|
|
116
|
-
<NativeView
|
|
117
|
-
{...props}
|
|
118
|
-
ref={ref}
|
|
119
|
-
style={[props.style, { height: "100%" }]}
|
|
120
|
-
source={parseNativeSource(props.source)}
|
|
121
|
-
slaves={props.slaves?.map((slave) => ({
|
|
122
|
-
...slave,
|
|
123
|
-
source: parseNativeSource(slave.source)!,
|
|
124
|
-
}))}
|
|
125
|
-
onEncounteredError={onEncounteredError}
|
|
126
|
-
onDialogDisplay={onDialogDisplay}
|
|
127
|
-
onTimeChanged={onTimeChanged}
|
|
128
|
-
onPositionChanged={onPositionChanged}
|
|
129
|
-
onESAdded={onESAdded}
|
|
130
|
-
onRecordChanged={onRecordChanged}
|
|
131
|
-
onSnapshotTaken={onSnapshotTaken}
|
|
132
|
-
onFirstPlay={onFirstPlay}
|
|
133
|
-
/>
|
|
134
|
-
</View>
|
|
135
|
-
);
|
|
136
|
-
},
|
|
137
|
-
);
|
|
106
|
+
defaultRatio.current = mediaRatio || FALLBACK_RATIO;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const propRatio = props.aspectRatio;
|
|
110
|
+
const aspectRatio = propRatio === "auto" ? defaultRatio.current : propRatio;
|
|
111
|
+
const nativeRatio = convertAspectRatio(aspectRatio);
|
|
112
|
+
|
|
113
|
+
return (
|
|
114
|
+
<View style={{ aspectRatio: nativeRatio }}>
|
|
115
|
+
<NativeView
|
|
116
|
+
{...props}
|
|
117
|
+
ref={ref}
|
|
118
|
+
style={[props.style, { height: "100%" }]}
|
|
119
|
+
source={parseNativeSource(props.source)}
|
|
120
|
+
slaves={props.slaves?.map((slave) => ({
|
|
121
|
+
...slave,
|
|
122
|
+
source: parseNativeSource(slave.source)!,
|
|
123
|
+
}))}
|
|
124
|
+
onEncounteredError={onEncounteredError}
|
|
125
|
+
onDialogDisplay={onDialogDisplay}
|
|
126
|
+
onTimeChanged={onTimeChanged}
|
|
127
|
+
onPositionChanged={onPositionChanged}
|
|
128
|
+
onESAdded={onESAdded}
|
|
129
|
+
onRecordChanged={onRecordChanged}
|
|
130
|
+
onSnapshotTaken={onSnapshotTaken}
|
|
131
|
+
onFirstPlay={onFirstPlay}
|
|
132
|
+
/>
|
|
133
|
+
</View>
|
|
134
|
+
);
|
|
135
|
+
});
|
|
138
136
|
|
|
139
137
|
export default LibVlcPlayerView;
|
package/src/utils/aspect.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { VideoAspectRatio } from "../LibVlcPlayer.types";
|
|
2
2
|
|
|
3
|
-
export function convertAspectRatio(
|
|
4
|
-
ratio?: VideoAspectRatio,
|
|
5
|
-
): VideoAspectRatio | undefined {
|
|
3
|
+
export function convertAspectRatio(ratio?: VideoAspectRatio): VideoAspectRatio | undefined {
|
|
6
4
|
if (typeof ratio === "string") {
|
|
7
5
|
const numbers = ratio.split(":");
|
|
8
6
|
|