expo-libvlc-player 3.4.4 → 3.4.6
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 +1 -1
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/libvlcplayer/LibVlcPlayerModule.kt +0 -5
- package/android/src/main/java/expo/modules/libvlcplayer/LibVlcPlayerView.kt +26 -15
- package/android/src/main/java/expo/modules/libvlcplayer/MediaPlayerListener.kt +1 -1
- package/android/src/main/java/expo/modules/libvlcplayer/MediaPlayerManager.kt +1 -1
- package/build/LibVlcPlayer.types.d.ts +4 -3
- 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 -10
- package/build/LibVlcPlayerView.js.map +1 -1
- package/build/utils/aspect.d.ts +2 -1
- package/build/utils/aspect.d.ts.map +1 -1
- package/build/utils/aspect.js +2 -3
- package/build/utils/aspect.js.map +1 -1
- package/ios/LibVlcPlayerModule.swift +0 -6
- package/ios/LibVlcPlayerView.swift +14 -16
- package/ios/MediaPlayerDelegate.swift +1 -1
- package/package.json +1 -1
- package/src/LibVlcPlayer.types.ts +5 -3
- package/src/LibVlcPlayerView.tsx +24 -10
- package/src/utils/aspect.ts +6 -4
package/README.md
CHANGED
|
@@ -144,7 +144,7 @@ The `LibVlcPlayerView` extends React Native `ViewProps` and implements the follo
|
|
|
144
144
|
| `tracks` | Sets the player audio, video and subtitle tracks object. See [`Tracks`](#tracks) for more | `undefined` |
|
|
145
145
|
| `slaves` | Sets the player audio and subtitle slaves array. See [`Slave`](#slave) for more | `[]` |
|
|
146
146
|
| `scale` | Sets the player scaling factor. Must be a float equal or greater than `0` | `0` |
|
|
147
|
-
| `aspectRatio` | Sets the player aspect ratio. Must be a valid ratio string
|
|
147
|
+
| `aspectRatio` | Sets the player aspect ratio. Must be a valid ratio string or number | `undefined` |
|
|
148
148
|
| `contentFit` | Sets how the video should be scaled to fit in the container | `"contain"` |
|
|
149
149
|
| `rate` | Sets the player rate. Must be a float equal or greater than `1` | `1` |
|
|
150
150
|
| `time` | Sets the initial player time. Must be an integer in milliseconds | `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 = "3.4.
|
|
4
|
+
version = "3.4.6"
|
|
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 "3.4.
|
|
30
|
+
versionName "3.4.6"
|
|
31
31
|
consumerProguardFiles("proguard-rules.pro")
|
|
32
32
|
}
|
|
33
33
|
lintOptions {
|
|
@@ -99,10 +99,6 @@ class LibVlcPlayerModule : Module() {
|
|
|
99
99
|
view.scale = scale ?: DEFAULT_PLAYER_SCALE
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
Prop("aspectRatio") { view: LibVlcPlayerView, aspectRatio: String? ->
|
|
103
|
-
view.aspectRatio = aspectRatio
|
|
104
|
-
}
|
|
105
|
-
|
|
106
102
|
Prop("contentFit") { view: LibVlcPlayerView, contentFit: VideoContentFit? ->
|
|
107
103
|
view.contentFit = contentFit ?: VideoContentFit.CONTAIN
|
|
108
104
|
}
|
|
@@ -145,7 +141,6 @@ class LibVlcPlayerModule : Module() {
|
|
|
145
141
|
|
|
146
142
|
OnViewDestroys { view: LibVlcPlayerView ->
|
|
147
143
|
MediaPlayerManager.unregisterPlayerView(view)
|
|
148
|
-
|
|
149
144
|
view.destroyPlayer()
|
|
150
145
|
}
|
|
151
146
|
|
|
@@ -60,7 +60,7 @@ class LibVlcPlayerView(
|
|
|
60
60
|
private var media: Media? = null
|
|
61
61
|
var vlcDialog: VLCDialog? = null
|
|
62
62
|
|
|
63
|
-
var mediaLength: Long =
|
|
63
|
+
var mediaLength: Long? = null
|
|
64
64
|
|
|
65
65
|
private var shouldCreate: Boolean = false
|
|
66
66
|
var firstPlay: Boolean = false
|
|
@@ -98,6 +98,17 @@ class LibVlcPlayerView(
|
|
|
98
98
|
detachPlayer()
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
+
override fun onSizeChanged(
|
|
102
|
+
w: Int,
|
|
103
|
+
h: Int,
|
|
104
|
+
oldw: Int,
|
|
105
|
+
oldh: Int,
|
|
106
|
+
) {
|
|
107
|
+
super.onSizeChanged(w, h, oldw, oldh)
|
|
108
|
+
|
|
109
|
+
setContentFit()
|
|
110
|
+
}
|
|
111
|
+
|
|
101
112
|
fun getTextureView(): TextureView? = playerView.findViewById(org.videolan.R.id.texture_video)
|
|
102
113
|
|
|
103
114
|
fun createPlayer() {
|
|
@@ -204,12 +215,12 @@ class LibVlcPlayerView(
|
|
|
204
215
|
|
|
205
216
|
fun setContentFit() {
|
|
206
217
|
post {
|
|
207
|
-
|
|
208
|
-
val textureView = getTextureView() ?: return@post
|
|
218
|
+
val textureView = getTextureView() ?: return@post
|
|
209
219
|
|
|
210
|
-
|
|
220
|
+
val matrix = Matrix()
|
|
211
221
|
|
|
212
|
-
|
|
222
|
+
mediaPlayer?.let { player ->
|
|
223
|
+
val video = player.getCurrentVideoTrack()
|
|
213
224
|
|
|
214
225
|
if (video != null) {
|
|
215
226
|
val viewWidth = playerView.width.toFloat()
|
|
@@ -254,9 +265,9 @@ class LibVlcPlayerView(
|
|
|
254
265
|
}
|
|
255
266
|
}
|
|
256
267
|
}
|
|
257
|
-
|
|
258
|
-
textureView.setTransform(matrix)
|
|
259
268
|
}
|
|
269
|
+
|
|
270
|
+
textureView.setTransform(matrix)
|
|
260
271
|
}
|
|
261
272
|
}
|
|
262
273
|
|
|
@@ -323,7 +334,12 @@ class LibVlcPlayerView(
|
|
|
323
334
|
tracks = mediaTracks,
|
|
324
335
|
)
|
|
325
336
|
|
|
326
|
-
mediaLength =
|
|
337
|
+
mediaLength =
|
|
338
|
+
if (length > 0L) {
|
|
339
|
+
length
|
|
340
|
+
} else {
|
|
341
|
+
null
|
|
342
|
+
}
|
|
327
343
|
}
|
|
328
344
|
|
|
329
345
|
return mediaInfo
|
|
@@ -397,12 +413,6 @@ class LibVlcPlayerView(
|
|
|
397
413
|
mediaPlayer?.setScale(value)
|
|
398
414
|
}
|
|
399
415
|
|
|
400
|
-
var aspectRatio: String? = null
|
|
401
|
-
set(value) {
|
|
402
|
-
field = value
|
|
403
|
-
setContentFit()
|
|
404
|
-
}
|
|
405
|
-
|
|
406
416
|
var contentFit: VideoContentFit = VideoContentFit.CONTAIN
|
|
407
417
|
set(value) {
|
|
408
418
|
field = value
|
|
@@ -514,7 +524,8 @@ class LibVlcPlayerView(
|
|
|
514
524
|
}
|
|
515
525
|
} else {
|
|
516
526
|
if (type == "position") {
|
|
517
|
-
|
|
527
|
+
val length = mediaLength ?: 0L
|
|
528
|
+
time = (value * length.toDouble()).toInt()
|
|
518
529
|
} else {
|
|
519
530
|
time = value.toInt()
|
|
520
531
|
}
|
|
@@ -7,7 +7,7 @@ object MediaPlayerManager {
|
|
|
7
7
|
lateinit var audioFocusManager: AudioFocusManager
|
|
8
8
|
lateinit var keepAwakeManager: KeepAwakeManager
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
val playerViews: MutableList<WeakReference<LibVlcPlayerView>> = mutableListOf()
|
|
11
11
|
|
|
12
12
|
fun registerPlayerView(view: LibVlcPlayerView) {
|
|
13
13
|
playerViews.find { it.get() == view } ?: run { playerViews.add(WeakReference(view)) }
|
|
@@ -70,6 +70,7 @@ export interface Slave {
|
|
|
70
70
|
type: "audio" | "subtitle";
|
|
71
71
|
selected?: boolean;
|
|
72
72
|
}
|
|
73
|
+
export type VideoAspectRatio = string | number;
|
|
73
74
|
export type VideoContentFit = "contain" | "cover" | "fill";
|
|
74
75
|
export type AudioMixingMode = "mixWithOthers" | "duckOthers" | "auto" | "doNotMix";
|
|
75
76
|
export interface NativeEventProps {
|
|
@@ -188,7 +189,7 @@ export interface LibVlcPlayerViewNativeProps extends ViewProps {
|
|
|
188
189
|
tracks?: Tracks;
|
|
189
190
|
slaves?: Slave[];
|
|
190
191
|
scale?: number;
|
|
191
|
-
aspectRatio?:
|
|
192
|
+
aspectRatio?: VideoAspectRatio;
|
|
192
193
|
contentFit?: VideoContentFit;
|
|
193
194
|
rate?: number;
|
|
194
195
|
time?: number;
|
|
@@ -296,13 +297,13 @@ export interface LibVlcPlayerViewProps extends ViewProps {
|
|
|
296
297
|
*/
|
|
297
298
|
scale?: number;
|
|
298
299
|
/**
|
|
299
|
-
* Sets the player aspect ratio. Must be a valid ratio string
|
|
300
|
+
* Sets the player aspect ratio. Must be a valid ratio string or number
|
|
300
301
|
*
|
|
301
302
|
* @example "16:9"
|
|
302
303
|
*
|
|
303
304
|
* @default undefined
|
|
304
305
|
*/
|
|
305
|
-
aspectRatio?:
|
|
306
|
+
aspectRatio?: VideoAspectRatio;
|
|
306
307
|
/**
|
|
307
308
|
* Sets how the video should be scaled to fit in the container
|
|
308
309
|
*
|
|
@@ -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,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;;;;OAI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AEG;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 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 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 tracks: MediaTracks;\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?: string;\n contentFit?: VideoContentFit;\n rate?: number;\n time?: number;\n volume?: number;\n mute?: boolean;\n audioMixingMode?: AudioMixingMode;\n playInBackground?: boolean;\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 player aspect ratio. Must be a valid ratio string\n *\n * @example \"16:9\"\n *\n * @default undefined\n */\n aspectRatio?: string;\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 continue playing in the background\n *\n * @note Battery optimization must be disabled on Android\n *\n * @default false\n */\n playInBackground?: boolean;\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\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 = 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 tracks: MediaTracks;\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 playInBackground?: boolean;\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 player 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 continue playing in the background\n *\n * @note Battery optimization must be disabled on Android\n *\n * @default false\n */\n playInBackground?: boolean;\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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LibVlcPlayerView.d.ts","sourceRoot":"","sources":["../src/LibVlcPlayerView.tsx"],"names":[],"mappings":"AAIA,OAAO,EAEL,qBAAqB,EACrB,mBAAmB,EAUpB,MAAM,sBAAsB,CAAC;AAU9B,QAAA,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"LibVlcPlayerView.d.ts","sourceRoot":"","sources":["../src/LibVlcPlayerView.tsx"],"names":[],"mappings":"AAIA,OAAO,EAEL,qBAAqB,EACrB,mBAAmB,EAUpB,MAAM,sBAAsB,CAAC;AAU9B,QAAA,MAAM,gBAAgB,uHAsGrB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { requireNativeView } from "expo";
|
|
2
|
-
import { forwardRef } from "react";
|
|
2
|
+
import { forwardRef, useRef } from "react";
|
|
3
3
|
import { View } from "react-native";
|
|
4
4
|
import { convertAspectRatio } from "./utils/aspect";
|
|
5
5
|
import { parseSource } from "./utils/assets";
|
|
@@ -7,59 +7,62 @@ import { convertNativeEvent } from "./utils/events";
|
|
|
7
7
|
const NativeView = requireNativeView("ExpoLibVlcPlayer");
|
|
8
8
|
let loggedRenderingChildrenWarning = false;
|
|
9
9
|
const LibVlcPlayerView = forwardRef((props, ref) => {
|
|
10
|
+
const aspectRatio = useRef(undefined);
|
|
10
11
|
if (props.children && !loggedRenderingChildrenWarning) {
|
|
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
15
|
const onEncounteredError = (event) => {
|
|
16
|
+
const nativeEvent = convertNativeEvent(event);
|
|
15
17
|
if (props.onEncounteredError) {
|
|
16
|
-
const nativeEvent = convertNativeEvent(event);
|
|
17
18
|
props.onEncounteredError(nativeEvent);
|
|
18
19
|
}
|
|
19
20
|
};
|
|
20
21
|
const onDialogDisplay = (event) => {
|
|
22
|
+
const nativeEvent = convertNativeEvent(event);
|
|
21
23
|
if (props.onDialogDisplay) {
|
|
22
|
-
const nativeEvent = convertNativeEvent(event);
|
|
23
24
|
props.onDialogDisplay(nativeEvent);
|
|
24
25
|
}
|
|
25
26
|
};
|
|
26
27
|
const onTimeChanged = (event) => {
|
|
28
|
+
const nativeEvent = convertNativeEvent(event);
|
|
27
29
|
if (props.onTimeChanged) {
|
|
28
|
-
const nativeEvent = convertNativeEvent(event);
|
|
29
30
|
props.onTimeChanged(nativeEvent);
|
|
30
31
|
}
|
|
31
32
|
};
|
|
32
33
|
const onPositionChanged = (event) => {
|
|
34
|
+
const nativeEvent = convertNativeEvent(event);
|
|
33
35
|
if (props.onPositionChanged) {
|
|
34
|
-
const nativeEvent = convertNativeEvent(event);
|
|
35
36
|
props.onPositionChanged(nativeEvent);
|
|
36
37
|
}
|
|
37
38
|
};
|
|
38
39
|
const onESAdded = (event) => {
|
|
40
|
+
const nativeEvent = convertNativeEvent(event);
|
|
39
41
|
if (props.onESAdded) {
|
|
40
|
-
const nativeEvent = convertNativeEvent(event);
|
|
41
42
|
props.onESAdded(nativeEvent);
|
|
42
43
|
}
|
|
43
44
|
};
|
|
44
45
|
const onRecordChanged = (event) => {
|
|
46
|
+
const nativeEvent = convertNativeEvent(event);
|
|
45
47
|
if (props.onRecordChanged) {
|
|
46
|
-
const nativeEvent = convertNativeEvent(event);
|
|
47
48
|
props.onRecordChanged(nativeEvent);
|
|
48
49
|
}
|
|
49
50
|
};
|
|
50
51
|
const onSnapshotTaken = (event) => {
|
|
52
|
+
const nativeEvent = convertNativeEvent(event);
|
|
51
53
|
if (props.onSnapshotTaken) {
|
|
52
|
-
const nativeEvent = convertNativeEvent(event);
|
|
53
54
|
props.onSnapshotTaken(nativeEvent);
|
|
54
55
|
}
|
|
55
56
|
};
|
|
56
57
|
const onFirstPlay = (event) => {
|
|
58
|
+
const nativeEvent = convertNativeEvent(event);
|
|
57
59
|
if (props.onFirstPlay) {
|
|
58
|
-
const nativeEvent = convertNativeEvent(event);
|
|
59
60
|
props.onFirstPlay(nativeEvent);
|
|
60
61
|
}
|
|
62
|
+
aspectRatio.current = nativeEvent.width / nativeEvent.height;
|
|
61
63
|
};
|
|
62
|
-
|
|
64
|
+
const nativeRatio = props.aspectRatio || aspectRatio.current;
|
|
65
|
+
return (<View style={{ aspectRatio: convertAspectRatio(nativeRatio) }}>
|
|
63
66
|
<NativeView {...props} ref={ref} style={[props.style, { height: "100%" }]} source={parseSource(props.source)} slaves={props.slaves?.map((slave) => ({
|
|
64
67
|
...slave,
|
|
65
68
|
source: parseSource(slave.source),
|
|
@@ -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;
|
|
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;AAgBpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD,MAAM,UAAU,GACd,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;AAExC,IAAI,8BAA8B,GAAY,KAAK,CAAC;AAEpD,MAAM,gBAAgB,GAAG,UAAU,CACjC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACb,MAAM,WAAW,GAAG,MAAM,CAAqB,SAAS,CAAC,CAAC;IAE1D,IAAI,KAAK,CAAC,QAAQ,IAAI,CAAC,8BAA8B,EAAE,CAAC;QACtD,OAAO,CAAC,IAAI,CACV,gNAAgN,CACjN,CAAC;QACF,8BAA8B,GAAG,IAAI,CAAC;IACxC,CAAC;IAED,MAAM,kB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C,KAAK,CAAC,MAAM,CAAE;SACnC,CAAC,CAAC,CAAC,CACJ,kBAAkB,CAAC,CAAC,kBAAkB,CAAC,CACvC,eAAe,CAAC,CAAC,eAAe,CAAC,CACjC,aAAa,CAAC,CAAC,aAAa,CAAC,CAC7B,iBAAiB,CAAC,CAAC,iBAAiB,CAAC,CACrC,SAAS,CAAC,CAAC,SAAS,CAAC,CACrB,eAAe,CAAC,CAAC,eAAe,CAAC,CACjC,eAAe,CAAC,CAAC,eAAe,CAAC,CACjC,WAAW,CAAC,CAAC,WAAW,CAAC,EAE7B;MAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,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} from \"./LibVlcPlayer.types\";\nimport { convertAspectRatio } from \"./utils/aspect\";\nimport { parseSource } from \"./utils/assets\";\nimport { convertNativeEvent } from \"./utils/events\";\n\nconst NativeView: ComponentType<LibVlcPlayerViewNativeProps> =\n requireNativeView(\"ExpoLibVlcPlayer\");\n\nlet loggedRenderingChildrenWarning: boolean = false;\n\nconst LibVlcPlayerView = forwardRef<LibVlcPlayerViewRef, LibVlcPlayerViewProps>(\n (props, ref) => {\n const aspectRatio = useRef<number | undefined>(undefined);\n\n if (props.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 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\n if (props.onFirstPlay) {\n props.onFirstPlay(nativeEvent);\n }\n\n aspectRatio.current = nativeEvent.width / nativeEvent.height;\n };\n\n const nativeRatio = props.aspectRatio || aspectRatio.current;\n\n return (\n <View style={{ aspectRatio: convertAspectRatio(nativeRatio) }}>\n <NativeView\n {...props}\n ref={ref}\n style={[props.style, { height: \"100%\" }]}\n source={parseSource(props.source)}\n slaves={props.slaves?.map((slave) => ({\n ...slave,\n source: parseSource(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);\n\nexport default LibVlcPlayerView;\n"]}
|
package/build/utils/aspect.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aspect.d.ts","sourceRoot":"","sources":["../../src/utils/aspect.ts"],"names":[],"mappings":"
|
|
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,CAChC,KAAK,CAAC,EAAE,gBAAgB,GACvB,gBAAgB,GAAG,SAAS,CAc9B"}
|
package/build/utils/aspect.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
const DEFAULT_ASPECT_RATIO = 1 / 1;
|
|
2
1
|
export function convertAspectRatio(ratio) {
|
|
3
|
-
if (ratio
|
|
2
|
+
if (typeof ratio === "string") {
|
|
4
3
|
const numbers = ratio.split(":");
|
|
5
4
|
if (numbers.length === 2) {
|
|
6
5
|
const [width, height] = numbers.map(Number);
|
|
@@ -9,6 +8,6 @@ export function convertAspectRatio(ratio) {
|
|
|
9
8
|
}
|
|
10
9
|
}
|
|
11
10
|
}
|
|
12
|
-
return
|
|
11
|
+
return ratio;
|
|
13
12
|
}
|
|
14
13
|
//# sourceMappingURL=aspect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aspect.js","sourceRoot":"","sources":["../../src/utils/aspect.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"aspect.js","sourceRoot":"","sources":["../../src/utils/aspect.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,kBAAkB,CAChC,KAAwB;IAExB,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,IAAI,KAAK,GAAG,CAAC,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC5B,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(\n ratio?: VideoAspectRatio,\n): 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 if (width > 0 && height > 0) {\n return width / height;\n }\n }\n }\n\n return ratio;\n}\n"]}
|
|
@@ -89,12 +89,6 @@ public class LibVlcPlayerModule: Module {
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
Prop("aspectRatio") { (view: LibVlcPlayerView, aspectRatio: String?) in
|
|
93
|
-
if aspectRatio != view.aspectRatio {
|
|
94
|
-
view.aspectRatio = aspectRatio
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
92
|
Prop("contentFit") { (view: LibVlcPlayerView, contentFit: VideoContentFit?) in
|
|
99
93
|
if contentFit != view.contentFit {
|
|
100
94
|
view.contentFit = contentFit ?? .contain
|
|
@@ -23,7 +23,7 @@ class LibVlcPlayerView: ExpoView {
|
|
|
23
23
|
var vlcDialog: VLCDialogProvider?
|
|
24
24
|
var vlcDialogRef: NSValue?
|
|
25
25
|
|
|
26
|
-
var mediaLength: Int32
|
|
26
|
+
var mediaLength: Int32?
|
|
27
27
|
private var oldVolume: Int = maxPlayerVolume
|
|
28
28
|
|
|
29
29
|
private var shouldCreate: Bool = false
|
|
@@ -58,13 +58,14 @@ class LibVlcPlayerView: ExpoView {
|
|
|
58
58
|
|
|
59
59
|
deinit {
|
|
60
60
|
MediaPlayerManager.shared.unregisterPlayerView(self)
|
|
61
|
-
|
|
62
61
|
destroyPlayer()
|
|
63
62
|
}
|
|
64
63
|
|
|
65
64
|
override var bounds: CGRect {
|
|
66
65
|
didSet {
|
|
66
|
+
playerView.transform = .identity
|
|
67
67
|
playerView.frame = bounds
|
|
68
|
+
setContentFit()
|
|
68
69
|
}
|
|
69
70
|
}
|
|
70
71
|
|
|
@@ -144,12 +145,12 @@ class LibVlcPlayerView: ExpoView {
|
|
|
144
145
|
|
|
145
146
|
func setContentFit() {
|
|
146
147
|
DispatchQueue.main.async {
|
|
147
|
-
|
|
148
|
-
let view = self.playerView.frame.size
|
|
148
|
+
let view = self.playerView.frame.size
|
|
149
149
|
|
|
150
|
-
|
|
150
|
+
var transform: CGAffineTransform = .identity
|
|
151
151
|
|
|
152
|
-
|
|
152
|
+
if let player = self.mediaPlayer {
|
|
153
|
+
let video = player.videoSize
|
|
153
154
|
|
|
154
155
|
if video != .zero {
|
|
155
156
|
let viewAspect = view.width / view.height
|
|
@@ -178,9 +179,9 @@ class LibVlcPlayerView: ExpoView {
|
|
|
178
179
|
transform = CGAffineTransform(scaleX: scaleX, y: scaleY)
|
|
179
180
|
}
|
|
180
181
|
}
|
|
181
|
-
|
|
182
|
-
self.playerView.transform = transform
|
|
183
182
|
}
|
|
183
|
+
|
|
184
|
+
self.playerView.transform = transform
|
|
184
185
|
}
|
|
185
186
|
}
|
|
186
187
|
|
|
@@ -248,7 +249,9 @@ class LibVlcPlayerView: ExpoView {
|
|
|
248
249
|
tracks: mediaTracks,
|
|
249
250
|
)
|
|
250
251
|
|
|
251
|
-
mediaLength = length
|
|
252
|
+
mediaLength = length > 0 ?
|
|
253
|
+
length :
|
|
254
|
+
nil
|
|
252
255
|
}
|
|
253
256
|
|
|
254
257
|
return mediaInfo
|
|
@@ -325,12 +328,6 @@ class LibVlcPlayerView: ExpoView {
|
|
|
325
328
|
}
|
|
326
329
|
}
|
|
327
330
|
|
|
328
|
-
var aspectRatio: String? {
|
|
329
|
-
didSet {
|
|
330
|
-
setContentFit()
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
|
|
334
331
|
var contentFit: VideoContentFit = .contain {
|
|
335
332
|
didSet {
|
|
336
333
|
setContentFit()
|
|
@@ -428,7 +425,8 @@ class LibVlcPlayerView: ExpoView {
|
|
|
428
425
|
}
|
|
429
426
|
} else {
|
|
430
427
|
if type == "position" {
|
|
431
|
-
|
|
428
|
+
let length = mediaLength ?? 0
|
|
429
|
+
time = Int(value * Double(length))
|
|
432
430
|
} else {
|
|
433
431
|
time = Int(value)
|
|
434
432
|
}
|
package/package.json
CHANGED
|
@@ -76,6 +76,8 @@ export interface Slave {
|
|
|
76
76
|
selected?: boolean;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
export type VideoAspectRatio = string | number;
|
|
80
|
+
|
|
79
81
|
export type VideoContentFit = "contain" | "cover" | "fill";
|
|
80
82
|
|
|
81
83
|
export type AudioMixingMode =
|
|
@@ -219,7 +221,7 @@ export interface LibVlcPlayerViewNativeProps extends ViewProps {
|
|
|
219
221
|
tracks?: Tracks;
|
|
220
222
|
slaves?: Slave[];
|
|
221
223
|
scale?: number;
|
|
222
|
-
aspectRatio?:
|
|
224
|
+
aspectRatio?: VideoAspectRatio;
|
|
223
225
|
contentFit?: VideoContentFit;
|
|
224
226
|
rate?: number;
|
|
225
227
|
time?: number;
|
|
@@ -328,13 +330,13 @@ export interface LibVlcPlayerViewProps extends ViewProps {
|
|
|
328
330
|
*/
|
|
329
331
|
scale?: number;
|
|
330
332
|
/**
|
|
331
|
-
* Sets the player aspect ratio. Must be a valid ratio string
|
|
333
|
+
* Sets the player aspect ratio. Must be a valid ratio string or number
|
|
332
334
|
*
|
|
333
335
|
* @example "16:9"
|
|
334
336
|
*
|
|
335
337
|
* @default undefined
|
|
336
338
|
*/
|
|
337
|
-
aspectRatio?:
|
|
339
|
+
aspectRatio?: VideoAspectRatio;
|
|
338
340
|
/**
|
|
339
341
|
* Sets how the video should be scaled to fit in the container
|
|
340
342
|
*
|
package/src/LibVlcPlayerView.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { requireNativeView } from "expo";
|
|
2
|
-
import { forwardRef, type ComponentType } from "react";
|
|
2
|
+
import { forwardRef, useRef, type ComponentType } from "react";
|
|
3
3
|
import { View } from "react-native";
|
|
4
4
|
|
|
5
5
|
import {
|
|
@@ -27,6 +27,8 @@ let loggedRenderingChildrenWarning: boolean = false;
|
|
|
27
27
|
|
|
28
28
|
const LibVlcPlayerView = forwardRef<LibVlcPlayerViewRef, LibVlcPlayerViewProps>(
|
|
29
29
|
(props, ref) => {
|
|
30
|
+
const aspectRatio = useRef<number | undefined>(undefined);
|
|
31
|
+
|
|
30
32
|
if (props.children && !loggedRenderingChildrenWarning) {
|
|
31
33
|
console.warn(
|
|
32
34
|
"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.",
|
|
@@ -35,63 +37,75 @@ const LibVlcPlayerView = forwardRef<LibVlcPlayerViewRef, LibVlcPlayerViewProps>(
|
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
const onEncounteredError = (event: NativeEvent<Error>) => {
|
|
40
|
+
const nativeEvent = convertNativeEvent(event);
|
|
41
|
+
|
|
38
42
|
if (props.onEncounteredError) {
|
|
39
|
-
const nativeEvent = convertNativeEvent(event);
|
|
40
43
|
props.onEncounteredError(nativeEvent);
|
|
41
44
|
}
|
|
42
45
|
};
|
|
43
46
|
|
|
44
47
|
const onDialogDisplay = (event: NativeEvent<Dialog>) => {
|
|
48
|
+
const nativeEvent = convertNativeEvent(event);
|
|
49
|
+
|
|
45
50
|
if (props.onDialogDisplay) {
|
|
46
|
-
const nativeEvent = convertNativeEvent(event);
|
|
47
51
|
props.onDialogDisplay(nativeEvent);
|
|
48
52
|
}
|
|
49
53
|
};
|
|
50
54
|
|
|
51
55
|
const onTimeChanged = (event: NativeEvent<Time>) => {
|
|
56
|
+
const nativeEvent = convertNativeEvent(event);
|
|
57
|
+
|
|
52
58
|
if (props.onTimeChanged) {
|
|
53
|
-
const nativeEvent = convertNativeEvent(event);
|
|
54
59
|
props.onTimeChanged(nativeEvent);
|
|
55
60
|
}
|
|
56
61
|
};
|
|
57
62
|
|
|
58
63
|
const onPositionChanged = (event: NativeEvent<Position>) => {
|
|
64
|
+
const nativeEvent = convertNativeEvent(event);
|
|
65
|
+
|
|
59
66
|
if (props.onPositionChanged) {
|
|
60
|
-
const nativeEvent = convertNativeEvent(event);
|
|
61
67
|
props.onPositionChanged(nativeEvent);
|
|
62
68
|
}
|
|
63
69
|
};
|
|
64
70
|
|
|
65
71
|
const onESAdded = (event: NativeEvent<MediaTracks>) => {
|
|
72
|
+
const nativeEvent = convertNativeEvent(event);
|
|
73
|
+
|
|
66
74
|
if (props.onESAdded) {
|
|
67
|
-
const nativeEvent = convertNativeEvent(event);
|
|
68
75
|
props.onESAdded(nativeEvent);
|
|
69
76
|
}
|
|
70
77
|
};
|
|
71
78
|
|
|
72
79
|
const onRecordChanged = (event: NativeEvent<Recording>) => {
|
|
80
|
+
const nativeEvent = convertNativeEvent(event);
|
|
81
|
+
|
|
73
82
|
if (props.onRecordChanged) {
|
|
74
|
-
const nativeEvent = convertNativeEvent(event);
|
|
75
83
|
props.onRecordChanged(nativeEvent);
|
|
76
84
|
}
|
|
77
85
|
};
|
|
78
86
|
|
|
79
87
|
const onSnapshotTaken = (event: NativeEvent<Snapshot>) => {
|
|
88
|
+
const nativeEvent = convertNativeEvent(event);
|
|
89
|
+
|
|
80
90
|
if (props.onSnapshotTaken) {
|
|
81
|
-
const nativeEvent = convertNativeEvent(event);
|
|
82
91
|
props.onSnapshotTaken(nativeEvent);
|
|
83
92
|
}
|
|
84
93
|
};
|
|
85
94
|
|
|
86
95
|
const onFirstPlay = (event: NativeEvent<MediaInfo>) => {
|
|
96
|
+
const nativeEvent = convertNativeEvent(event);
|
|
97
|
+
|
|
87
98
|
if (props.onFirstPlay) {
|
|
88
|
-
const nativeEvent = convertNativeEvent(event);
|
|
89
99
|
props.onFirstPlay(nativeEvent);
|
|
90
100
|
}
|
|
101
|
+
|
|
102
|
+
aspectRatio.current = nativeEvent.width / nativeEvent.height;
|
|
91
103
|
};
|
|
92
104
|
|
|
105
|
+
const nativeRatio = props.aspectRatio || aspectRatio.current;
|
|
106
|
+
|
|
93
107
|
return (
|
|
94
|
-
<View style={{ aspectRatio: convertAspectRatio(
|
|
108
|
+
<View style={{ aspectRatio: convertAspectRatio(nativeRatio) }}>
|
|
95
109
|
<NativeView
|
|
96
110
|
{...props}
|
|
97
111
|
ref={ref}
|
package/src/utils/aspect.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import { VideoAspectRatio } from "../LibVlcPlayer.types";
|
|
2
2
|
|
|
3
|
-
export function convertAspectRatio(
|
|
4
|
-
|
|
3
|
+
export function convertAspectRatio(
|
|
4
|
+
ratio?: VideoAspectRatio,
|
|
5
|
+
): VideoAspectRatio | undefined {
|
|
6
|
+
if (typeof ratio === "string") {
|
|
5
7
|
const numbers = ratio.split(":");
|
|
6
8
|
|
|
7
9
|
if (numbers.length === 2) {
|
|
@@ -13,5 +15,5 @@ export function convertAspectRatio(ratio?: string): number {
|
|
|
13
15
|
}
|
|
14
16
|
}
|
|
15
17
|
|
|
16
|
-
return
|
|
18
|
+
return ratio;
|
|
17
19
|
}
|