expo-libvlc-player 2.2.2 → 2.2.3
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/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/libvlcplayer/MediaPlayerListener.kt +2 -4
- package/build/LibVlcPlayer.types.d.ts +5 -1
- 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 +13 -6
- package/build/LibVlcPlayerView.js.map +1 -1
- package/build/utils/events.d.ts +3 -0
- package/build/utils/events.d.ts.map +1 -0
- package/build/utils/events.js +5 -0
- package/build/utils/events.js.map +1 -0
- package/ios/MediaPlayerDelegate.swift +2 -4
- package/package.json +2 -2
- package/src/LibVlcPlayer.types.ts +7 -1
- package/src/LibVlcPlayerView.tsx +19 -6
- package/src/utils/events.ts +7 -0
package/android/build.gradle
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
apply plugin: "com.android.library"
|
|
2
2
|
|
|
3
3
|
group = "expo.modules.libvlcplayer"
|
|
4
|
-
version = "2.2.
|
|
4
|
+
version = "2.2.3"
|
|
5
5
|
|
|
6
6
|
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
7
7
|
apply from: expoModulesCorePlugin
|
|
@@ -27,7 +27,7 @@ android {
|
|
|
27
27
|
namespace "expo.modules.libvlcplayer"
|
|
28
28
|
defaultConfig {
|
|
29
29
|
versionCode 1
|
|
30
|
-
versionName "2.2.
|
|
30
|
+
versionName "2.2.3"
|
|
31
31
|
consumerProguardFiles("proguard-rules.pro")
|
|
32
32
|
}
|
|
33
33
|
lintOptions {
|
|
@@ -87,11 +87,9 @@ fun LibVlcPlayerView.setMediaPlayerListener() {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
Event.ESAdded -> {
|
|
90
|
-
|
|
91
|
-
val mediaTracks = getMediaTracks()
|
|
90
|
+
val mediaTracks = getMediaTracks()
|
|
92
91
|
|
|
93
|
-
|
|
94
|
-
}
|
|
92
|
+
onESAdded(mediaTracks)
|
|
95
93
|
}
|
|
96
94
|
}
|
|
97
95
|
},
|
|
@@ -54,9 +54,13 @@ export interface Slave {
|
|
|
54
54
|
selected?: boolean;
|
|
55
55
|
}
|
|
56
56
|
export type AudioMixingMode = "mixWithOthers" | "duckOthers" | "auto" | "doNotMix";
|
|
57
|
+
export interface NativeEventProps {
|
|
58
|
+
target: number;
|
|
59
|
+
}
|
|
57
60
|
export interface NativeEvent<T> {
|
|
58
|
-
nativeEvent: T;
|
|
61
|
+
nativeEvent: T & NativeEventProps;
|
|
59
62
|
}
|
|
63
|
+
export type LibVlcEvent<T> = Omit<T & NativeEventProps, "target">;
|
|
60
64
|
export interface Track {
|
|
61
65
|
id: number;
|
|
62
66
|
name: string;
|
|
@@ -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;AAE9C,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,UAAU,GAAG,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5E;;;;;;OAMG;IACH,QAAQ,CAAC,UAAU,EAAE,CAAC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AAa,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,MAAM,KAAK,IAAI,CAAC;IAC1C;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IACzC;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B"}
|
|
@@ -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\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 position or time of the current player\n *\n * @param value - Must be a number equal or greater than `0`\n * @param type - Defaults to `\"position\"`\n *\n * @returns A promise which resolves to `void`\n */\n readonly seek: (value: number, type?: \"position\" | \"time\") => 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 * Dismisses a `Dialog`\n *\n * @returns A promise which resolves to `void`\n */\n readonly dismiss: () => 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 AudioMixingMode =\n | \"mixWithOthers\"\n | \"duckOthers\"\n | \"auto\"\n | \"doNotMix\";\n\nexport interface NativeEvent<T> {\n nativeEvent: T;\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 tracks: MediaTracks;\n}\n\nexport interface Dialog {\n title: string;\n text: string;\n cancelText?: string;\n action1Text?: string;\n action2Text?: string;\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\n/**\n * @hidden\n */\ntype EndReachedListener = () => void;\n\n/**\n * @hidden\n */\ntype EncounteredErrorListener = (event: NativeEvent<Error>) => void;\n\nexport type Error = { error: string };\n\n/**\n * @hidden\n */\ntype TimeChangedListener = (event: NativeEvent<Time>) => void;\n\nexport type Time = { time: number };\n\n/**\n * @hidden\n */\ntype PositionChangedListener = (event: NativeEvent<Position>) => void;\n\nexport type Position = { position: number };\n\n/**\n * @hidden\n */\ntype ESAddedListener = (event: NativeEvent<MediaTracks>) => 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 BackgroundListener = () => void;\n\n/**\n * @hidden\n */\nexport interface LibVlcPlayerViewNativeProps {\n ref?: React.Ref<LibVlcPlayerViewRef>;\n source?: LibVlcSource;\n options?: string[];\n tracks?: Tracks;\n slaves?: Slave[];\n scale?: number;\n aspectRatio?: string | null;\n rate?: number;\n time?: number;\n volume?: number;\n mute?: boolean;\n audioMixingMode?: AudioMixingMode;\n repeat?: boolean;\n playInBackground?: boolean;\n autoplay?: boolean;\n onBuffering?: BufferingListener;\n onPlaying?: PlayingListener;\n onPaused?: PausedListener;\n onStopped?: StoppedListener;\n onEndReached?: EndReachedListener;\n onEncounteredError?: EncounteredErrorListener;\n onTimeChanged?: TimeChangedListener;\n onPositionChanged?: PositionChangedListener;\n onESAdded?: ESAddedListener;\n onDialogDisplay?: DialogDisplayListener;\n onFirstPlay?: FirstPlayListener;\n onBackground?: BackgroundListener;\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 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 [\"--network-caching=1000\"]\n *\n * @default []\n */\n options?: string[];\n /**\n * Sets the player audio, video and subtitle tracks\n *\n * @example\n * ```tsx\n * <LibVlcPlayerView\n * tracks={{\n * audio: 0,\n * video: 1,\n * subtitle: 2,\n * }}\n * />\n * ```\n *\n * @default undefined\n */\n tracks?: Tracks;\n /**\n * Sets the player audio and subtitle slaves\n *\n * @example\n * ```tsx\n * <LibVlcPlayerView\n * slaves={[\n * {\n * source: \"file://path/to/subtitle.srt\",\n * type: \"subtitle\",\n * selected: true\n * },\n * ]}\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 player aspect ratio. Must be a valid string or `null` for default\n *\n * @example \"16:9\"\n *\n * @default undefined\n */\n aspectRatio?: string | null;\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 * @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 continue playing in the background\n *\n * @default false\n */\n playInBackground?: boolean;\n /**\n * Determines whether the media should autoplay once created\n *\n * @default true\n */\n autoplay?: 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 `EndReached` player event\n */\n onEndReached?: () => void;\n /**\n * Called after the `EncounteredError` player event\n */\n onEncounteredError?: (event: Error) => 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 a `Dialog` needs to be displayed\n */\n onDialogDisplay?: (event: Dialog) => void;\n /**\n * Called after the player first playing event\n */\n onFirstPlay?: (event: MediaInfo) => void;\n /**\n * Called after the player enters the background\n */\n onBackground?: () => 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\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 position or time of the current player\n *\n * @param value - Must be a number equal or greater than `0`\n * @param type - Defaults to `\"position\"`\n *\n * @returns A promise which resolves to `void`\n */\n readonly seek: (value: number, type?: \"position\" | \"time\") => 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 * Dismisses a `Dialog`\n *\n * @returns A promise which resolves to `void`\n */\n readonly dismiss: () => 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 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 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 tracks: MediaTracks;\n}\n\nexport interface Dialog {\n title: string;\n text: string;\n cancelText?: string;\n action1Text?: string;\n action2Text?: string;\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\n/**\n * @hidden\n */\ntype EndReachedListener = () => void;\n\n/**\n * @hidden\n */\ntype EncounteredErrorListener = (event: NativeEvent<Error>) => void;\n\nexport type Error = { error: string };\n\n/**\n * @hidden\n */\ntype TimeChangedListener = (event: NativeEvent<Time>) => void;\n\nexport type Time = { time: number };\n\n/**\n * @hidden\n */\ntype PositionChangedListener = (event: NativeEvent<Position>) => void;\n\nexport type Position = { position: number };\n\n/**\n * @hidden\n */\ntype ESAddedListener = (event: NativeEvent<MediaTracks>) => 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 BackgroundListener = () => void;\n\n/**\n * @hidden\n */\nexport interface LibVlcPlayerViewNativeProps {\n ref?: React.Ref<LibVlcPlayerViewRef>;\n source?: LibVlcSource;\n options?: string[];\n tracks?: Tracks;\n slaves?: Slave[];\n scale?: number;\n aspectRatio?: string | null;\n rate?: number;\n time?: number;\n volume?: number;\n mute?: boolean;\n audioMixingMode?: AudioMixingMode;\n repeat?: boolean;\n playInBackground?: boolean;\n autoplay?: boolean;\n onBuffering?: BufferingListener;\n onPlaying?: PlayingListener;\n onPaused?: PausedListener;\n onStopped?: StoppedListener;\n onEndReached?: EndReachedListener;\n onEncounteredError?: EncounteredErrorListener;\n onTimeChanged?: TimeChangedListener;\n onPositionChanged?: PositionChangedListener;\n onESAdded?: ESAddedListener;\n onDialogDisplay?: DialogDisplayListener;\n onFirstPlay?: FirstPlayListener;\n onBackground?: BackgroundListener;\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 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 [\"--network-caching=1000\"]\n *\n * @default []\n */\n options?: string[];\n /**\n * Sets the player audio, video and subtitle tracks\n *\n * @example\n * ```tsx\n * <LibVlcPlayerView\n * tracks={{\n * audio: 0,\n * video: 1,\n * subtitle: 2,\n * }}\n * />\n * ```\n *\n * @default undefined\n */\n tracks?: Tracks;\n /**\n * Sets the player audio and subtitle slaves\n *\n * @example\n * ```tsx\n * <LibVlcPlayerView\n * slaves={[\n * {\n * source: \"file://path/to/subtitle.srt\",\n * type: \"subtitle\",\n * selected: true\n * },\n * ]}\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 player aspect ratio. Must be a valid string or `null` for default\n *\n * @example \"16:9\"\n *\n * @default undefined\n */\n aspectRatio?: string | null;\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 * @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 continue playing in the background\n *\n * @default false\n */\n playInBackground?: boolean;\n /**\n * Determines whether the media should autoplay once created\n *\n * @default true\n */\n autoplay?: 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 `EndReached` player event\n */\n onEndReached?: () => void;\n /**\n * Called after the `EncounteredError` player event\n */\n onEncounteredError?: (event: Error) => 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 a `Dialog` needs to be displayed\n */\n onDialogDisplay?: (event: Dialog) => void;\n /**\n * Called after the player first playing event\n */\n onFirstPlay?: (event: MediaInfo) => void;\n /**\n * Called after the player enters the background\n */\n onBackground?: () => void;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LibVlcPlayerView.d.ts","sourceRoot":"","sources":["../src/LibVlcPlayerView.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEL,qBAAqB,EACrB,mBAAmB,EAQpB,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"LibVlcPlayerView.d.ts","sourceRoot":"","sources":["../src/LibVlcPlayerView.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEL,qBAAqB,EACrB,mBAAmB,EAQpB,MAAM,sBAAsB,CAAC;AAU9B,QAAA,MAAM,gBAAgB,uHA8ErB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { requireNativeView } from "expo";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { parseSource } from "./utils/assets";
|
|
4
|
+
import { converNativeEvent } from "./utils/events";
|
|
4
5
|
import { convertNativeProps } from "./utils/props";
|
|
5
6
|
const NativeView = requireNativeView("ExpoLibVlcPlayer");
|
|
6
7
|
let loggedRenderingChildrenWarning = false;
|
|
@@ -11,33 +12,39 @@ const LibVlcPlayerView = forwardRef((props, ref) => {
|
|
|
11
12
|
console.warn("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.");
|
|
12
13
|
loggedRenderingChildrenWarning = true;
|
|
13
14
|
}
|
|
14
|
-
const onEncounteredError = (
|
|
15
|
+
const onEncounteredError = (event) => {
|
|
15
16
|
if (props.onEncounteredError) {
|
|
17
|
+
const nativeEvent = converNativeEvent(event);
|
|
16
18
|
props.onEncounteredError(nativeEvent);
|
|
17
19
|
}
|
|
18
20
|
};
|
|
19
|
-
const onTimeChanged = (
|
|
21
|
+
const onTimeChanged = (event) => {
|
|
20
22
|
if (props.onTimeChanged) {
|
|
23
|
+
const nativeEvent = converNativeEvent(event);
|
|
21
24
|
props.onTimeChanged(nativeEvent);
|
|
22
25
|
}
|
|
23
26
|
};
|
|
24
|
-
const onPositionChanged = (
|
|
27
|
+
const onPositionChanged = (event) => {
|
|
25
28
|
if (props.onPositionChanged) {
|
|
29
|
+
const nativeEvent = converNativeEvent(event);
|
|
26
30
|
props.onPositionChanged(nativeEvent);
|
|
27
31
|
}
|
|
28
32
|
};
|
|
29
|
-
const onESAdded = (
|
|
33
|
+
const onESAdded = (event) => {
|
|
30
34
|
if (props.onESAdded) {
|
|
35
|
+
const nativeEvent = converNativeEvent(event);
|
|
31
36
|
props.onESAdded(nativeEvent);
|
|
32
37
|
}
|
|
33
38
|
};
|
|
34
|
-
const onDialogDisplay = (
|
|
39
|
+
const onDialogDisplay = (event) => {
|
|
35
40
|
if (props.onDialogDisplay) {
|
|
41
|
+
const nativeEvent = converNativeEvent(event);
|
|
36
42
|
props.onDialogDisplay(nativeEvent);
|
|
37
43
|
}
|
|
38
44
|
};
|
|
39
|
-
const onFirstPlay = (
|
|
45
|
+
const onFirstPlay = (event) => {
|
|
40
46
|
if (props.onFirstPlay) {
|
|
47
|
+
const nativeEvent = converNativeEvent(event);
|
|
41
48
|
props.onFirstPlay(nativeEvent);
|
|
42
49
|
}
|
|
43
50
|
};
|
|
@@ -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,EAAsB,MAAM,OAAO,CAAC;AAcvD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,MAAM,UAAU,GACd,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;AAExC,IAAI,8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CAAC;IACH,CAAC,CAAC;IAEF,OAAO,CACL,CAAC,UAAU,CACT,IAAI,WAAW,CAAC,CAChB,GAAG,CAAC,CAAC,GAAG,CAAC,CACT,MAAM,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAClC,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YACpC,GAAG,KAAK;YACR,MAAM,EAAE,WAAW,CAAC,KAAK,CAAC,MAAM,CAAE;SACnC,CAAC,CAAC,CAAC,CACJ,kBAAkB,CAAC,CAAC,kBAAkB,CAAC,CACvC,aAAa,CAAC,CAAC,aAAa,CAAC,CAC7B,iBAAiB,CAAC,CAAC,iBAAiB,CAAC,CACrC,SAAS,CAAC,CAAC,SAAS,CAAC,CACrB,eAAe,CAAC,CAAC,eAAe,CAAC,CACjC,WAAW,CAAC,CAAC,WAAW,CAAC,EACzB,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["import { requireNativeView } from \"expo\";\nimport { forwardRef, type ComponentType } from \"react\";\n\nimport {\n LibVlcPlayerViewNativeProps,\n LibVlcPlayerViewProps,\n LibVlcPlayerViewRef,\n type NativeEvent,\n type Error,\n type Time,\n type Position,\n type MediaTracks,\n type MediaInfo,\n type Dialog,\n} from \"./LibVlcPlayer.types\";\nimport { parseSource } from \"./utils/assets\";\nimport { converNativeEvent } from \"./utils/events\";\nimport { convertNativeProps } from \"./utils/props\";\n\nconst NativeView: ComponentType<LibVlcPlayerViewNativeProps> =\n requireNativeView(\"ExpoLibVlcPlayer\");\n\nlet loggedRenderingChildrenWarning: boolean = false;\n\nconst LibVlcPlayerView = forwardRef<LibVlcPlayerViewRef, LibVlcPlayerViewProps>(\n (props, ref) => {\n const nativeProps = convertNativeProps(props);\n\n // @ts-expect-error\n if (nativeProps.children && !loggedRenderingChildrenWarning) {\n console.warn(\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 );\n loggedRenderingChildrenWarning = true;\n }\n\n const onEncounteredError = (event: NativeEvent<Error>) => {\n if (props.onEncounteredError) {\n const nativeEvent = converNativeEvent(event);\n\n props.onEncounteredError(nativeEvent);\n }\n };\n\n const onTimeChanged = (event: NativeEvent<Time>) => {\n if (props.onTimeChanged) {\n const nativeEvent = converNativeEvent(event);\n\n props.onTimeChanged(nativeEvent);\n }\n };\n\n const onPositionChanged = (event: NativeEvent<Position>) => {\n if (props.onPositionChanged) {\n const nativeEvent = converNativeEvent(event);\n\n props.onPositionChanged(nativeEvent);\n }\n };\n\n const onESAdded = (event: NativeEvent<MediaTracks>) => {\n if (props.onESAdded) {\n const nativeEvent = converNativeEvent(event);\n\n props.onESAdded(nativeEvent);\n }\n };\n\n const onDialogDisplay = (event: NativeEvent<Dialog>) => {\n if (props.onDialogDisplay) {\n const nativeEvent = converNativeEvent(event);\n\n props.onDialogDisplay(nativeEvent);\n }\n };\n\n const onFirstPlay = (event: NativeEvent<MediaInfo>) => {\n if (props.onFirstPlay) {\n const nativeEvent = converNativeEvent(event);\n\n props.onFirstPlay(nativeEvent);\n }\n };\n\n return (\n <NativeView\n {...nativeProps}\n ref={ref}\n source={parseSource(props.source)}\n slaves={props.slaves?.map((slave) => ({\n ...slave,\n source: parseSource(slave.source)!,\n }))}\n onEncounteredError={onEncounteredError}\n onTimeChanged={onTimeChanged}\n onPositionChanged={onPositionChanged}\n onESAdded={onESAdded}\n onDialogDisplay={onDialogDisplay}\n onFirstPlay={onFirstPlay}\n />\n );\n },\n);\n\nexport default LibVlcPlayerView;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/utils/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEjE,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAI1E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/utils/events.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,iBAAiB,CAAI,KAAqB;IACxD,MAAM,EAAE,MAAM,EAAE,GAAG,WAAW,EAAE,GAAG,KAAK,CAAC,WAAW,CAAC;IAErD,OAAO,WAAW,CAAC;AACrB,CAAC","sourcesContent":["import { LibVlcEvent, NativeEvent } from \"../LibVlcPlayer.types\";\n\nexport function converNativeEvent<T>(event: NativeEvent<T>): LibVlcEvent<T> {\n const { target, ...nativeEvent } = event.nativeEvent;\n\n return nativeEvent;\n}\n"]}
|
|
@@ -45,11 +45,9 @@ extension LibVlcPlayerView: VLCMediaPlayerDelegate {
|
|
|
45
45
|
firstPlay = true
|
|
46
46
|
firstPosition = true
|
|
47
47
|
case .esAdded:
|
|
48
|
-
|
|
49
|
-
let mediaTracks = getMediaTracks()
|
|
48
|
+
let mediaTracks = getMediaTracks()
|
|
50
49
|
|
|
51
|
-
|
|
52
|
-
}
|
|
50
|
+
onESAdded(mediaTracks)
|
|
53
51
|
default:
|
|
54
52
|
break
|
|
55
53
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-libvlc-player",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.3",
|
|
4
4
|
"description": "LibVLC Player for Expo",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"globals": "^16.2.0",
|
|
41
41
|
"husky": "^9.1.7",
|
|
42
42
|
"lint-staged": "^16.1.2",
|
|
43
|
-
"react-native": "0.79.
|
|
43
|
+
"react-native": "0.79.6"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"expo": "*",
|
|
@@ -64,10 +64,16 @@ export type AudioMixingMode =
|
|
|
64
64
|
| "auto"
|
|
65
65
|
| "doNotMix";
|
|
66
66
|
|
|
67
|
+
export interface NativeEventProps {
|
|
68
|
+
target: number;
|
|
69
|
+
}
|
|
70
|
+
|
|
67
71
|
export interface NativeEvent<T> {
|
|
68
|
-
nativeEvent: T;
|
|
72
|
+
nativeEvent: T & NativeEventProps;
|
|
69
73
|
}
|
|
70
74
|
|
|
75
|
+
export type LibVlcEvent<T> = Omit<T & NativeEventProps, "target">;
|
|
76
|
+
|
|
71
77
|
export interface Track {
|
|
72
78
|
id: number;
|
|
73
79
|
name: string;
|
package/src/LibVlcPlayerView.tsx
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
type Dialog,
|
|
15
15
|
} from "./LibVlcPlayer.types";
|
|
16
16
|
import { parseSource } from "./utils/assets";
|
|
17
|
+
import { converNativeEvent } from "./utils/events";
|
|
17
18
|
import { convertNativeProps } from "./utils/props";
|
|
18
19
|
|
|
19
20
|
const NativeView: ComponentType<LibVlcPlayerViewNativeProps> =
|
|
@@ -33,38 +34,50 @@ const LibVlcPlayerView = forwardRef<LibVlcPlayerViewRef, LibVlcPlayerViewProps>(
|
|
|
33
34
|
loggedRenderingChildrenWarning = true;
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
const onEncounteredError = (
|
|
37
|
+
const onEncounteredError = (event: NativeEvent<Error>) => {
|
|
37
38
|
if (props.onEncounteredError) {
|
|
39
|
+
const nativeEvent = converNativeEvent(event);
|
|
40
|
+
|
|
38
41
|
props.onEncounteredError(nativeEvent);
|
|
39
42
|
}
|
|
40
43
|
};
|
|
41
44
|
|
|
42
|
-
const onTimeChanged = (
|
|
45
|
+
const onTimeChanged = (event: NativeEvent<Time>) => {
|
|
43
46
|
if (props.onTimeChanged) {
|
|
47
|
+
const nativeEvent = converNativeEvent(event);
|
|
48
|
+
|
|
44
49
|
props.onTimeChanged(nativeEvent);
|
|
45
50
|
}
|
|
46
51
|
};
|
|
47
52
|
|
|
48
|
-
const onPositionChanged = (
|
|
53
|
+
const onPositionChanged = (event: NativeEvent<Position>) => {
|
|
49
54
|
if (props.onPositionChanged) {
|
|
55
|
+
const nativeEvent = converNativeEvent(event);
|
|
56
|
+
|
|
50
57
|
props.onPositionChanged(nativeEvent);
|
|
51
58
|
}
|
|
52
59
|
};
|
|
53
60
|
|
|
54
|
-
const onESAdded = (
|
|
61
|
+
const onESAdded = (event: NativeEvent<MediaTracks>) => {
|
|
55
62
|
if (props.onESAdded) {
|
|
63
|
+
const nativeEvent = converNativeEvent(event);
|
|
64
|
+
|
|
56
65
|
props.onESAdded(nativeEvent);
|
|
57
66
|
}
|
|
58
67
|
};
|
|
59
68
|
|
|
60
|
-
const onDialogDisplay = (
|
|
69
|
+
const onDialogDisplay = (event: NativeEvent<Dialog>) => {
|
|
61
70
|
if (props.onDialogDisplay) {
|
|
71
|
+
const nativeEvent = converNativeEvent(event);
|
|
72
|
+
|
|
62
73
|
props.onDialogDisplay(nativeEvent);
|
|
63
74
|
}
|
|
64
75
|
};
|
|
65
76
|
|
|
66
|
-
const onFirstPlay = (
|
|
77
|
+
const onFirstPlay = (event: NativeEvent<MediaInfo>) => {
|
|
67
78
|
if (props.onFirstPlay) {
|
|
79
|
+
const nativeEvent = converNativeEvent(event);
|
|
80
|
+
|
|
68
81
|
props.onFirstPlay(nativeEvent);
|
|
69
82
|
}
|
|
70
83
|
};
|