expo-libvlc-player 5.0.4 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -1
- package/android/src/main/java/expo/modules/libvlcplayer/LibVlcPlayerModule.kt +0 -1
- package/android/src/main/java/expo/modules/libvlcplayer/LibVlcPlayerView.kt +0 -3
- package/build/LibVlcPlayer.types.d.ts +0 -9
- package/build/LibVlcPlayer.types.d.ts.map +1 -1
- package/build/LibVlcPlayer.types.js.map +1 -1
- package/ios/ExpoLibVlcPlayer.podspec +1 -2
- package/ios/LibVlcPlayerModule.swift +0 -1
- package/ios/LibVlcPlayerView.swift +73 -58
- package/package.json +1 -1
- package/src/LibVlcPlayer.types.ts +0 -10
package/README.md
CHANGED
|
@@ -151,7 +151,6 @@ The `LibVlcPlayerView` extends React Native `ViewProps` and implements the follo
|
|
|
151
151
|
| `onPlaying` | Called after the `Playing` player event | |
|
|
152
152
|
| `onPaused` | Called after the `Paused` player event | |
|
|
153
153
|
| `onStopped` | Called after the `Stopped` player event | |
|
|
154
|
-
| `onEndReached` | Called after the `EndReached` player event | |
|
|
155
154
|
| `onEncounteredError` | Called after the `EncounteredError` player event | `{ error: string }` |
|
|
156
155
|
| `onDialogDisplay` | Called after a `Dialog` needs to be displayed | [`Dialog`](#dialog) |
|
|
157
156
|
| `onTimeChanged` | Called after the `TimeChanged` player event | `{ time: number }` |
|
|
@@ -62,7 +62,6 @@ class LibVlcPlayerView(
|
|
|
62
62
|
val onPlaying by EventDispatcher<Unit>()
|
|
63
63
|
val onPaused by EventDispatcher<Unit>()
|
|
64
64
|
val onStopped by EventDispatcher<Unit>()
|
|
65
|
-
val onEndReached by EventDispatcher<Unit>()
|
|
66
65
|
val onEncounteredError by EventDispatcher()
|
|
67
66
|
val onDialogDisplay by EventDispatcher<Dialog>()
|
|
68
67
|
val onTimeChanged by EventDispatcher()
|
|
@@ -665,8 +664,6 @@ fun LibVlcPlayerView.setPlayerListener(player: MediaPlayer) {
|
|
|
665
664
|
}
|
|
666
665
|
|
|
667
666
|
Event.EndReached -> {
|
|
668
|
-
onEndReached(Unit)
|
|
669
|
-
|
|
670
667
|
player.stop()
|
|
671
668
|
|
|
672
669
|
if (repeat) {
|
|
@@ -122,10 +122,6 @@ type PausedListener = () => void;
|
|
|
122
122
|
* @hidden
|
|
123
123
|
*/
|
|
124
124
|
type StoppedListener = () => void;
|
|
125
|
-
/**
|
|
126
|
-
* @hidden
|
|
127
|
-
*/
|
|
128
|
-
type EndReachedListener = () => void;
|
|
129
125
|
export type Error = {
|
|
130
126
|
error: string;
|
|
131
127
|
};
|
|
@@ -201,7 +197,6 @@ export interface LibVlcPlayerViewNativeProps extends ViewProps {
|
|
|
201
197
|
onPlaying?: PlayingListener;
|
|
202
198
|
onPaused?: PausedListener;
|
|
203
199
|
onStopped?: StoppedListener;
|
|
204
|
-
onEndReached?: EndReachedListener;
|
|
205
200
|
onEncounteredError?: EncounteredErrorListener;
|
|
206
201
|
onDialogDisplay?: DialogDisplayListener;
|
|
207
202
|
onTimeChanged?: TimeChangedListener;
|
|
@@ -370,10 +365,6 @@ export interface LibVlcPlayerViewProps extends ViewProps {
|
|
|
370
365
|
* Called after the `Stopped` player event
|
|
371
366
|
*/
|
|
372
367
|
onStopped?: () => void;
|
|
373
|
-
/**
|
|
374
|
-
* Called after the `EndReached` player event
|
|
375
|
-
*/
|
|
376
|
-
onEndReached?: () => void;
|
|
377
368
|
/**
|
|
378
369
|
* Called after the `EncounteredError` player event
|
|
379
370
|
*/
|
|
@@ -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,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AQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB;;OAEG;IACH,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAC5C;;OAEG;IACH,eAAe,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;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\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 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 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 * 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 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\n/**\n * @hidden\n */\ntype EndReachedListener = () => 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 */\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 onBuffering?: BufferingListener;\n onPlaying?: PlayingListener;\n onPaused?: PausedListener;\n onStopped?: StoppedListener;\n onEndReached?: EndReachedListener;\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}\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 * 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 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"]}
|
|
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 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 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 * 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 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 */\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 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}\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 * 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"]}
|
|
@@ -19,8 +19,7 @@ Pod::Spec.new do |s|
|
|
|
19
19
|
s.static_framework = true
|
|
20
20
|
|
|
21
21
|
s.dependency 'ExpoModulesCore'
|
|
22
|
-
s.
|
|
23
|
-
s.tvos.dependency 'TVVLCKit', '3.7.3'
|
|
22
|
+
s.dependency 'VLCKit', '4.0.0a18'
|
|
24
23
|
|
|
25
24
|
# Swift/Objective-C compatibility
|
|
26
25
|
s.pod_target_xcconfig = {
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import ExpoModulesCore
|
|
2
2
|
import UIKit
|
|
3
|
-
|
|
4
|
-
import TVVLCKit
|
|
5
|
-
#else
|
|
6
|
-
import MobileVLCKit
|
|
7
|
-
#endif
|
|
3
|
+
import VLCKit
|
|
8
4
|
|
|
9
5
|
private let dialogCustomUI: Bool = true
|
|
10
6
|
|
|
@@ -26,7 +22,6 @@ class LibVlcPlayerView: ExpoView {
|
|
|
26
22
|
let onPlaying = EventDispatcher()
|
|
27
23
|
let onPaused = EventDispatcher()
|
|
28
24
|
let onStopped = EventDispatcher()
|
|
29
|
-
let onEndReached = EventDispatcher()
|
|
30
25
|
let onEncounteredError = EventDispatcher()
|
|
31
26
|
let onDialogDisplay = EventDispatcher()
|
|
32
27
|
let onTimeChanged = EventDispatcher()
|
|
@@ -56,8 +51,8 @@ class LibVlcPlayerView: ExpoView {
|
|
|
56
51
|
|
|
57
52
|
override var bounds: CGRect {
|
|
58
53
|
didSet {
|
|
59
|
-
playerView.transform = .identity
|
|
60
54
|
playerView.frame = bounds
|
|
55
|
+
playerView.transform = .identity
|
|
61
56
|
setContentFit()
|
|
62
57
|
}
|
|
63
58
|
}
|
|
@@ -105,18 +100,48 @@ class LibVlcPlayerView: ExpoView {
|
|
|
105
100
|
vlcDialog = nil
|
|
106
101
|
}
|
|
107
102
|
|
|
108
|
-
func
|
|
103
|
+
func selectTrack(_ track: Int?, _ type: VLCMedia.TrackType) {
|
|
109
104
|
if let player = mediaPlayer {
|
|
110
|
-
let
|
|
111
|
-
|
|
112
|
-
|
|
105
|
+
let tracks: [VLCMediaPlayer.Track]? = switch type {
|
|
106
|
+
case .audio:
|
|
107
|
+
player.audioTracks
|
|
108
|
+
case .video:
|
|
109
|
+
player.videoTracks
|
|
110
|
+
case .text:
|
|
111
|
+
player.textTracks
|
|
112
|
+
default:
|
|
113
|
+
nil
|
|
114
|
+
}
|
|
113
115
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
116
|
+
let trackId = tracks?.first?.trackId
|
|
117
|
+
let firstId = trackId.map { id in (id as NSString).intValue }
|
|
118
|
+
let trackIndex = track ?? firstId.map { id in Int(id) }
|
|
119
|
+
|
|
120
|
+
if let index = trackIndex {
|
|
121
|
+
switch (type, index) {
|
|
122
|
+
case (.audio, -1):
|
|
123
|
+
player.deselectAllAudioTracks()
|
|
124
|
+
case (.video, -1):
|
|
125
|
+
player.deselectAllVideoTracks()
|
|
126
|
+
case (.text, -1):
|
|
127
|
+
player.deselectAllTextTracks()
|
|
128
|
+
default:
|
|
129
|
+
player.selectTrack(at: index, type: type)
|
|
130
|
+
}
|
|
131
|
+
}
|
|
117
132
|
}
|
|
118
133
|
}
|
|
119
134
|
|
|
135
|
+
func setPlayerTracks() {
|
|
136
|
+
let audioTrack = tracks?.audio
|
|
137
|
+
let videoTrack = tracks?.video
|
|
138
|
+
let textTrack = tracks?.subtitle
|
|
139
|
+
|
|
140
|
+
selectTrack(audioTrack, .audio)
|
|
141
|
+
selectTrack(videoTrack, .video)
|
|
142
|
+
selectTrack(textTrack, .text)
|
|
143
|
+
}
|
|
144
|
+
|
|
120
145
|
func addPlayerSlaves() {
|
|
121
146
|
for slave in slaves {
|
|
122
147
|
let source = slave.source
|
|
@@ -226,35 +251,32 @@ class LibVlcPlayerView: ExpoView {
|
|
|
226
251
|
if let player = mediaPlayer {
|
|
227
252
|
var audioTracks: [Track] = []
|
|
228
253
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
}
|
|
254
|
+
let audios = player.audioTracks
|
|
255
|
+
|
|
256
|
+
audioTracks = audios.map { audio in
|
|
257
|
+
let id = (audio.trackId as NSString).intValue
|
|
258
|
+
let name = audio.trackName
|
|
259
|
+
return Track(id: Int(id), name: name)
|
|
236
260
|
}
|
|
237
261
|
|
|
238
262
|
var videoTracks: [Track] = []
|
|
239
263
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}
|
|
264
|
+
let videos = player.videoTracks
|
|
265
|
+
|
|
266
|
+
videoTracks = videos.map { video in
|
|
267
|
+
let id = (video.trackId as NSString).intValue
|
|
268
|
+
let name = video.trackName
|
|
269
|
+
return Track(id: Int(id), name: name)
|
|
247
270
|
}
|
|
248
271
|
|
|
249
272
|
var subtitleTracks: [Track] = []
|
|
250
273
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
}
|
|
274
|
+
let subtitles = player.textTracks
|
|
275
|
+
|
|
276
|
+
subtitleTracks = subtitles.map { subtitle in
|
|
277
|
+
let id = (subtitle.trackId as NSString).intValue
|
|
278
|
+
let name = subtitle.trackName
|
|
279
|
+
return Track(id: Int(id), name: name)
|
|
258
280
|
}
|
|
259
281
|
|
|
260
282
|
mediaTracks = MediaTracks(
|
|
@@ -290,8 +312,8 @@ class LibVlcPlayerView: ExpoView {
|
|
|
290
312
|
let tracks = getMediaTracks()
|
|
291
313
|
let length = getMediaLength()
|
|
292
314
|
|
|
293
|
-
let hasAudio = tracks.audio.
|
|
294
|
-
let hasVideo = tracks.video.
|
|
315
|
+
let hasAudio = tracks.audio.count > 0
|
|
316
|
+
let hasVideo = tracks.video.count > 0
|
|
295
317
|
|
|
296
318
|
let hasAudioOnly = hasAudio && !hasVideo && length > 0
|
|
297
319
|
let hasAudioAndVideo = hasAudio && hasVideo && hasVideoSize() && length > 0
|
|
@@ -409,7 +431,7 @@ class LibVlcPlayerView: ExpoView {
|
|
|
409
431
|
if let player = mediaPlayer {
|
|
410
432
|
if player.isSeekable {
|
|
411
433
|
if type == "position" {
|
|
412
|
-
player.position =
|
|
434
|
+
player.position = value
|
|
413
435
|
} else {
|
|
414
436
|
player.time = VLCTime(int: Int32(value))
|
|
415
437
|
}
|
|
@@ -426,17 +448,12 @@ class LibVlcPlayerView: ExpoView {
|
|
|
426
448
|
func record(_ path: String?) {
|
|
427
449
|
if let player = mediaPlayer {
|
|
428
450
|
if let path {
|
|
429
|
-
|
|
430
|
-
let success = !player.startRecording(atPath: path)
|
|
431
|
-
|
|
432
|
-
if !success {
|
|
433
|
-
onEncounteredError(["error": "Media could not be recorded"])
|
|
434
|
-
|
|
435
|
-
player.stopRecording()
|
|
436
|
-
}
|
|
451
|
+
player.startRecording(atPath: path)
|
|
437
452
|
} else {
|
|
438
453
|
player.stopRecording()
|
|
439
454
|
}
|
|
455
|
+
} else {
|
|
456
|
+
onEncounteredError(["error": "Media could not be recorded"])
|
|
440
457
|
}
|
|
441
458
|
}
|
|
442
459
|
|
|
@@ -495,9 +512,9 @@ class LibVlcPlayerView: ExpoView {
|
|
|
495
512
|
}
|
|
496
513
|
|
|
497
514
|
extension LibVlcPlayerView: VLCMediaPlayerDelegate {
|
|
498
|
-
func mediaPlayerStateChanged(_:
|
|
515
|
+
func mediaPlayerStateChanged(_ newState: VLCMediaPlayerState) {
|
|
499
516
|
if let player = mediaPlayer {
|
|
500
|
-
switch
|
|
517
|
+
switch newState {
|
|
501
518
|
case .buffering:
|
|
502
519
|
onBuffering()
|
|
503
520
|
case .playing:
|
|
@@ -535,22 +552,16 @@ extension LibVlcPlayerView: VLCMediaPlayerDelegate {
|
|
|
535
552
|
case .stopped:
|
|
536
553
|
onStopped()
|
|
537
554
|
|
|
538
|
-
MediaPlayerManager.shared.keepAwakeManager.toggleKeepAwake()
|
|
539
|
-
MediaPlayerManager.shared.audioSessionManager.setAppropriateAudioSession()
|
|
540
|
-
case .ended:
|
|
541
|
-
onEndReached()
|
|
542
|
-
|
|
543
|
-
player.stop()
|
|
544
|
-
|
|
545
555
|
if shouldRepeat {
|
|
546
556
|
player.play()
|
|
547
557
|
}
|
|
558
|
+
|
|
559
|
+
MediaPlayerManager.shared.keepAwakeManager.toggleKeepAwake()
|
|
560
|
+
MediaPlayerManager.shared.audioSessionManager.setAppropriateAudioSession()
|
|
548
561
|
case .error:
|
|
549
562
|
onEncounteredError(["error": "Player encountered an error"])
|
|
550
563
|
|
|
551
564
|
player.stop()
|
|
552
|
-
case .esAdded:
|
|
553
|
-
onESAdded(getMediaTracks())
|
|
554
565
|
default:
|
|
555
566
|
break
|
|
556
567
|
}
|
|
@@ -565,6 +576,10 @@ extension LibVlcPlayerView: VLCMediaPlayerDelegate {
|
|
|
565
576
|
}
|
|
566
577
|
}
|
|
567
578
|
|
|
579
|
+
func mediaPlayerTrackAdded(_: String, with _: VLCMedia.TrackType) {
|
|
580
|
+
onESAdded(getMediaTracks())
|
|
581
|
+
}
|
|
582
|
+
|
|
568
583
|
func mediaPlayerStartedRecording(_: VLCMediaPlayer) {
|
|
569
584
|
let recording = Recording(
|
|
570
585
|
path: nil,
|
|
@@ -574,7 +589,7 @@ extension LibVlcPlayerView: VLCMediaPlayerDelegate {
|
|
|
574
589
|
onRecordChanged(recording)
|
|
575
590
|
}
|
|
576
591
|
|
|
577
|
-
func mediaPlayer(
|
|
592
|
+
func mediaPlayer(recordingStoppedAt path: String) {
|
|
578
593
|
let recording = Recording(
|
|
579
594
|
path: path,
|
|
580
595
|
isRecording: false,
|
package/package.json
CHANGED
|
@@ -148,11 +148,6 @@ type PausedListener = () => void;
|
|
|
148
148
|
*/
|
|
149
149
|
type StoppedListener = () => void;
|
|
150
150
|
|
|
151
|
-
/**
|
|
152
|
-
* @hidden
|
|
153
|
-
*/
|
|
154
|
-
type EndReachedListener = () => void;
|
|
155
|
-
|
|
156
151
|
export type Error = { error: string };
|
|
157
152
|
|
|
158
153
|
/**
|
|
@@ -234,7 +229,6 @@ export interface LibVlcPlayerViewNativeProps extends ViewProps {
|
|
|
234
229
|
onPlaying?: PlayingListener;
|
|
235
230
|
onPaused?: PausedListener;
|
|
236
231
|
onStopped?: StoppedListener;
|
|
237
|
-
onEndReached?: EndReachedListener;
|
|
238
232
|
onEncounteredError?: EncounteredErrorListener;
|
|
239
233
|
onDialogDisplay?: DialogDisplayListener;
|
|
240
234
|
onTimeChanged?: TimeChangedListener;
|
|
@@ -404,10 +398,6 @@ export interface LibVlcPlayerViewProps extends ViewProps {
|
|
|
404
398
|
* Called after the `Stopped` player event
|
|
405
399
|
*/
|
|
406
400
|
onStopped?: () => void;
|
|
407
|
-
/**
|
|
408
|
-
* Called after the `EndReached` player event
|
|
409
|
-
*/
|
|
410
|
-
onEndReached?: () => void;
|
|
411
401
|
/**
|
|
412
402
|
* Called after the `EncounteredError` player event
|
|
413
403
|
*/
|