expo-libvlc-player 3.1.2 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/libvlcplayer/LibVlcPlayerModule.kt +5 -0
- package/android/src/main/java/expo/modules/libvlcplayer/LibVlcPlayerView.kt +88 -20
- package/android/src/main/java/expo/modules/libvlcplayer/enums/VideoContentFit.kt +11 -0
- package/build/LibVlcPlayer.types.d.ts +10 -0
- package/build/LibVlcPlayer.types.d.ts.map +1 -1
- package/build/LibVlcPlayer.types.js.map +1 -1
- package/ios/Enums/VideoContentFit.swift +7 -0
- package/ios/LibVlcPlayerModule.swift +4 -0
- package/ios/LibVlcPlayerView.swift +74 -17
- package/package.json +1 -1
- package/src/LibVlcPlayer.types.ts +11 -0
package/README.md
CHANGED
|
@@ -117,7 +117,7 @@ return (
|
|
|
117
117
|
<View style={{ aspectRatio: 16 / 9 }}>
|
|
118
118
|
<LibVlcPlayerView
|
|
119
119
|
style={{ height: "100%" }}
|
|
120
|
-
source="
|
|
120
|
+
source="https://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_720p_h264.mov"
|
|
121
121
|
/>
|
|
122
122
|
</View>
|
|
123
123
|
);
|
|
@@ -164,6 +164,7 @@ The `LibVlcPlayerView` extends React Native `ViewProps` and implements the follo
|
|
|
164
164
|
| `slaves` | Sets the player audio and subtitle slaves array. See [`Slave`](#slave) for more | `[]` |
|
|
165
165
|
| `scale` | Sets the player scaling factor. Must be a float equal or greater than `0` | `0` |
|
|
166
166
|
| `aspectRatio` | Sets the player aspect ratio. Must be a valid string or `null` for default | `undefined` |
|
|
167
|
+
| `contentFit` | Sets how the video should be scaled to fit in the container | `"contain"` |
|
|
167
168
|
| `rate` | Sets the player rate. Must be a float equal or greater than `1` | `1` |
|
|
168
169
|
| `time` | Sets the initial player time. Must be an integer in milliseconds | `0` |
|
|
169
170
|
| `volume` | Sets the player volume. Must be an integer between `0` and `100` | `100` |
|
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.1
|
|
4
|
+
version = "3.2.1"
|
|
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.1
|
|
30
|
+
versionName "3.2.1"
|
|
31
31
|
consumerProguardFiles("proguard-rules.pro")
|
|
32
32
|
}
|
|
33
33
|
lintOptions {
|
|
@@ -3,6 +3,7 @@ package expo.modules.libvlcplayer
|
|
|
3
3
|
import expo.modules.kotlin.modules.Module
|
|
4
4
|
import expo.modules.kotlin.modules.ModuleDefinition
|
|
5
5
|
import expo.modules.libvlcplayer.enums.AudioMixingMode
|
|
6
|
+
import expo.modules.libvlcplayer.enums.VideoContentFit
|
|
6
7
|
import expo.modules.libvlcplayer.records.Slave
|
|
7
8
|
import expo.modules.libvlcplayer.records.Tracks
|
|
8
9
|
|
|
@@ -89,6 +90,10 @@ class LibVlcPlayerModule : Module() {
|
|
|
89
90
|
view.aspectRatio = aspectRatio
|
|
90
91
|
}
|
|
91
92
|
|
|
93
|
+
Prop("contentFit") { view: LibVlcPlayerView, contentFit: VideoContentFit? ->
|
|
94
|
+
view.contentFit = contentFit ?: VideoContentFit.CONTAIN
|
|
95
|
+
}
|
|
96
|
+
|
|
92
97
|
Prop("rate") { view: LibVlcPlayerView, rate: Float? ->
|
|
93
98
|
view.rate = rate ?: DEFAULT_PLAYER_RATE
|
|
94
99
|
}
|
|
@@ -2,6 +2,7 @@ package expo.modules.libvlcplayer
|
|
|
2
2
|
|
|
3
3
|
import android.content.Context
|
|
4
4
|
import android.graphics.Bitmap
|
|
5
|
+
import android.graphics.Matrix
|
|
5
6
|
import android.net.Uri
|
|
6
7
|
import android.os.Handler
|
|
7
8
|
import android.os.Looper
|
|
@@ -12,6 +13,7 @@ import expo.modules.kotlin.AppContext
|
|
|
12
13
|
import expo.modules.kotlin.viewevent.EventDispatcher
|
|
13
14
|
import expo.modules.kotlin.views.ExpoView
|
|
14
15
|
import expo.modules.libvlcplayer.enums.AudioMixingMode
|
|
16
|
+
import expo.modules.libvlcplayer.enums.VideoContentFit
|
|
15
17
|
import expo.modules.libvlcplayer.records.Dialog
|
|
16
18
|
import expo.modules.libvlcplayer.records.MediaInfo
|
|
17
19
|
import expo.modules.libvlcplayer.records.MediaTracks
|
|
@@ -200,6 +202,61 @@ class LibVlcPlayerView(
|
|
|
200
202
|
}
|
|
201
203
|
}
|
|
202
204
|
|
|
205
|
+
fun setContentFit() {
|
|
206
|
+
mediaPlayer?.let { player ->
|
|
207
|
+
val textureView = playerView.findViewById<TextureView>(org.videolan.R.id.texture_video) ?: return
|
|
208
|
+
val video = player.getCurrentVideoTrack() ?: return
|
|
209
|
+
|
|
210
|
+
val viewWidth = playerView.width.toFloat()
|
|
211
|
+
val viewHeight = playerView.height.toFloat()
|
|
212
|
+
|
|
213
|
+
val videoWidth = video.width.toFloat()
|
|
214
|
+
val videoHeight = video.height.toFloat()
|
|
215
|
+
|
|
216
|
+
val viewAspect = viewWidth / viewHeight
|
|
217
|
+
val videoAspect = videoWidth / videoHeight
|
|
218
|
+
|
|
219
|
+
val pivotX = viewWidth / 2f
|
|
220
|
+
val pivotY = viewHeight / 2f
|
|
221
|
+
|
|
222
|
+
val matrix = Matrix()
|
|
223
|
+
|
|
224
|
+
when (contentFit) {
|
|
225
|
+
VideoContentFit.CONTAIN -> {
|
|
226
|
+
// No scale required
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
VideoContentFit.COVER -> {
|
|
230
|
+
val scale =
|
|
231
|
+
if (videoAspect > viewAspect) {
|
|
232
|
+
videoAspect / viewAspect
|
|
233
|
+
} else {
|
|
234
|
+
viewAspect / videoAspect
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
matrix.setScale(scale, scale, pivotX, pivotY)
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
VideoContentFit.FILL -> {
|
|
241
|
+
var scaleX = 1f
|
|
242
|
+
var scaleY = 1f
|
|
243
|
+
|
|
244
|
+
if (videoAspect > viewAspect) {
|
|
245
|
+
scaleX = 1f
|
|
246
|
+
scaleY = videoAspect / viewAspect
|
|
247
|
+
} else {
|
|
248
|
+
scaleX = viewAspect / videoAspect
|
|
249
|
+
scaleY = 1f
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
matrix.setScale(scaleX, scaleY, pivotX, pivotY)
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
textureView.setTransform(matrix)
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
203
260
|
fun getMediaTracks(): MediaTracks {
|
|
204
261
|
var mediaTracks = MediaTracks()
|
|
205
262
|
|
|
@@ -273,17 +330,16 @@ class LibVlcPlayerView(
|
|
|
273
330
|
mediaPlayer?.let { player ->
|
|
274
331
|
setPlayerTracks()
|
|
275
332
|
|
|
276
|
-
if (
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
MIN_PLAYER_VOLUME
|
|
280
|
-
} else {
|
|
281
|
-
volume
|
|
282
|
-
}
|
|
333
|
+
if (scale != DEFAULT_PLAYER_SCALE) {
|
|
334
|
+
player.setScale(scale)
|
|
335
|
+
}
|
|
283
336
|
|
|
284
|
-
|
|
337
|
+
if (aspectRatio != null) {
|
|
338
|
+
player.setAspectRatio(aspectRatio)
|
|
285
339
|
}
|
|
286
340
|
|
|
341
|
+
setContentFit()
|
|
342
|
+
|
|
287
343
|
if (rate != DEFAULT_PLAYER_RATE) {
|
|
288
344
|
player.setRate(rate)
|
|
289
345
|
}
|
|
@@ -292,12 +348,15 @@ class LibVlcPlayerView(
|
|
|
292
348
|
player.setTime(time.toLong())
|
|
293
349
|
}
|
|
294
350
|
|
|
295
|
-
if (
|
|
296
|
-
|
|
297
|
-
|
|
351
|
+
if (volume != MAX_PLAYER_VOLUME || mute) {
|
|
352
|
+
val newVolume =
|
|
353
|
+
if (mute) {
|
|
354
|
+
MIN_PLAYER_VOLUME
|
|
355
|
+
} else {
|
|
356
|
+
volume
|
|
357
|
+
}
|
|
298
358
|
|
|
299
|
-
|
|
300
|
-
player.setAspectRatio(aspectRatio)
|
|
359
|
+
player.setVolume(newVolume)
|
|
301
360
|
}
|
|
302
361
|
|
|
303
362
|
time = DEFAULT_PLAYER_TIME
|
|
@@ -308,14 +367,20 @@ class LibVlcPlayerView(
|
|
|
308
367
|
set(value) {
|
|
309
368
|
val old = field
|
|
310
369
|
field = value
|
|
311
|
-
|
|
370
|
+
|
|
371
|
+
if (!shouldCreate) {
|
|
372
|
+
shouldCreate = value != old
|
|
373
|
+
}
|
|
312
374
|
}
|
|
313
375
|
|
|
314
376
|
var options: ArrayList<String> = ArrayList()
|
|
315
377
|
set(value) {
|
|
316
378
|
val old = field
|
|
317
379
|
field = value
|
|
318
|
-
|
|
380
|
+
|
|
381
|
+
if (!shouldCreate) {
|
|
382
|
+
shouldCreate = value != old
|
|
383
|
+
}
|
|
319
384
|
}
|
|
320
385
|
|
|
321
386
|
var tracks: Tracks? = null
|
|
@@ -347,6 +412,12 @@ class LibVlcPlayerView(
|
|
|
347
412
|
mediaPlayer?.setAspectRatio(value)
|
|
348
413
|
}
|
|
349
414
|
|
|
415
|
+
var contentFit: VideoContentFit = VideoContentFit.CONTAIN
|
|
416
|
+
set(value) {
|
|
417
|
+
field = value
|
|
418
|
+
setContentFit()
|
|
419
|
+
}
|
|
420
|
+
|
|
350
421
|
var rate: Float = DEFAULT_PLAYER_RATE
|
|
351
422
|
set(value) {
|
|
352
423
|
field = value
|
|
@@ -487,13 +558,10 @@ class LibVlcPlayerView(
|
|
|
487
558
|
mediaPlayer?.let { player ->
|
|
488
559
|
try {
|
|
489
560
|
val textureView = playerView.findViewById<TextureView>(org.videolan.R.id.texture_video) ?: throw Exception()
|
|
490
|
-
|
|
491
|
-
val video = player.getCurrentVideoTrack()
|
|
492
|
-
val width = video.width ?: 0
|
|
493
|
-
val height = video.height ?: 0
|
|
561
|
+
val video = player.getCurrentVideoTrack() ?: throw Exception()
|
|
494
562
|
|
|
495
563
|
val surface = Surface(textureView.surfaceTexture)
|
|
496
|
-
val bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
|
|
564
|
+
val bitmap = Bitmap.createBitmap(video.width, video.height, Bitmap.Config.ARGB_8888)
|
|
497
565
|
|
|
498
566
|
PixelCopy.request(
|
|
499
567
|
surface,
|
|
@@ -70,6 +70,7 @@ export interface Slave {
|
|
|
70
70
|
type: "audio" | "subtitle";
|
|
71
71
|
selected?: boolean;
|
|
72
72
|
}
|
|
73
|
+
export type VideoContentFit = "contain" | "cover" | "fill";
|
|
73
74
|
export type AudioMixingMode = "mixWithOthers" | "duckOthers" | "auto" | "doNotMix";
|
|
74
75
|
export interface NativeEventProps {
|
|
75
76
|
target: number;
|
|
@@ -188,6 +189,7 @@ export interface LibVlcPlayerViewNativeProps {
|
|
|
188
189
|
slaves?: Slave[];
|
|
189
190
|
scale?: number;
|
|
190
191
|
aspectRatio?: string | null;
|
|
192
|
+
contentFit?: VideoContentFit;
|
|
191
193
|
rate?: number;
|
|
192
194
|
time?: number;
|
|
193
195
|
volume?: number;
|
|
@@ -277,6 +279,14 @@ export interface LibVlcPlayerViewProps extends ViewProps {
|
|
|
277
279
|
* @default undefined
|
|
278
280
|
*/
|
|
279
281
|
aspectRatio?: string | null;
|
|
282
|
+
/**
|
|
283
|
+
* Sets how the video should be scaled to fit in the container
|
|
284
|
+
*
|
|
285
|
+
* @example "cover"
|
|
286
|
+
*
|
|
287
|
+
* @default "contain"
|
|
288
|
+
*/
|
|
289
|
+
contentFit?: VideoContentFit;
|
|
280
290
|
/**
|
|
281
291
|
* Sets the player rate. Must be a float equal or greater than `1`
|
|
282
292
|
*
|
|
@@ -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;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC;;;;;;;OAOG;IACH,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5E;;;;;;OAMG;IACH,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD;;;;;;OAMG;IACH,QAAQ,CAAC,UAAU,EAAE,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACvC;AAED,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,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AI,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\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 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 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 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 {\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 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 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 continue playing in the background\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 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 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 {\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 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 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 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 * @default \"auto\"\n */\n audioMixingMode?: AudioMixingMode;\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 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"]}
|
|
@@ -81,6 +81,10 @@ public class LibVlcPlayerModule: Module {
|
|
|
81
81
|
view.aspectRatio = aspectRatio
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
Prop("contentFit") { (view: LibVlcPlayerView, contentFit: VideoContentFit?) in
|
|
85
|
+
view.contentFit = contentFit ?? .contain
|
|
86
|
+
}
|
|
87
|
+
|
|
84
88
|
Prop("rate") { (view: LibVlcPlayerView, rate: Float?) in
|
|
85
89
|
view.rate = rate ?? defaultPlayerRate
|
|
86
90
|
}
|
|
@@ -49,10 +49,10 @@ class LibVlcPlayerView: ExpoView {
|
|
|
49
49
|
required init(appContext: AppContext? = nil) {
|
|
50
50
|
super.init(appContext: appContext)
|
|
51
51
|
|
|
52
|
-
MediaPlayerManager.shared.registerPlayerView(self)
|
|
53
|
-
|
|
54
|
-
clipsToBounds = true
|
|
55
52
|
playerView.backgroundColor = .black
|
|
53
|
+
clipsToBounds = true
|
|
54
|
+
|
|
55
|
+
MediaPlayerManager.shared.registerPlayerView(self)
|
|
56
56
|
addSubview(playerView)
|
|
57
57
|
}
|
|
58
58
|
|
|
@@ -62,6 +62,8 @@ class LibVlcPlayerView: ExpoView {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
override func layoutSubviews() {
|
|
65
|
+
super.layoutSubviews()
|
|
66
|
+
|
|
65
67
|
playerView.frame = bounds
|
|
66
68
|
}
|
|
67
69
|
|
|
@@ -141,6 +143,49 @@ class LibVlcPlayerView: ExpoView {
|
|
|
141
143
|
}
|
|
142
144
|
}
|
|
143
145
|
|
|
146
|
+
func setContentFit() {
|
|
147
|
+
if let player = mediaPlayer {
|
|
148
|
+
let view = playerView.bounds.size
|
|
149
|
+
let video = player.videoSize
|
|
150
|
+
|
|
151
|
+
let viewAspect = view.width / view.height
|
|
152
|
+
let videoAspect = video.width / video.height
|
|
153
|
+
|
|
154
|
+
var transform: CGAffineTransform = .identity
|
|
155
|
+
|
|
156
|
+
switch contentFit {
|
|
157
|
+
case .contain:
|
|
158
|
+
// No transform required
|
|
159
|
+
break
|
|
160
|
+
case .cover:
|
|
161
|
+
var scale = 1.0
|
|
162
|
+
|
|
163
|
+
if videoAspect > viewAspect {
|
|
164
|
+
scale = videoAspect / viewAspect
|
|
165
|
+
} else {
|
|
166
|
+
scale = viewAspect / videoAspect
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
transform = CGAffineTransform(scaleX: scale, y: scale)
|
|
170
|
+
case .fill:
|
|
171
|
+
var scaleX = 1.0
|
|
172
|
+
var scaleY = 1.0
|
|
173
|
+
|
|
174
|
+
if videoAspect > viewAspect {
|
|
175
|
+
scaleX = 1.0
|
|
176
|
+
scaleY = videoAspect / viewAspect
|
|
177
|
+
} else {
|
|
178
|
+
scaleX = viewAspect / videoAspect
|
|
179
|
+
scaleY = 1.0
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
transform = CGAffineTransform(scaleX: scaleX, y: scaleY)
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
playerView.transform = transform
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
144
189
|
func getMediaTracks() -> MediaTracks {
|
|
145
190
|
var mediaTracks = MediaTracks()
|
|
146
191
|
|
|
@@ -218,14 +263,18 @@ class LibVlcPlayerView: ExpoView {
|
|
|
218
263
|
if let player = mediaPlayer {
|
|
219
264
|
setPlayerTracks()
|
|
220
265
|
|
|
221
|
-
if
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
volume
|
|
266
|
+
if scale != defaultPlayerScale {
|
|
267
|
+
player.scaleFactor = scale
|
|
268
|
+
}
|
|
225
269
|
|
|
226
|
-
|
|
270
|
+
if let aspectRatio = aspectRatio {
|
|
271
|
+
aspectRatio.withCString { cString in
|
|
272
|
+
player.videoAspectRatio = UnsafeMutablePointer(mutating: cString)
|
|
273
|
+
}
|
|
227
274
|
}
|
|
228
275
|
|
|
276
|
+
setContentFit()
|
|
277
|
+
|
|
229
278
|
if rate != defaultPlayerRate {
|
|
230
279
|
player.rate = rate
|
|
231
280
|
}
|
|
@@ -234,14 +283,12 @@ class LibVlcPlayerView: ExpoView {
|
|
|
234
283
|
player.time = VLCTime(int: Int32(time))
|
|
235
284
|
}
|
|
236
285
|
|
|
237
|
-
if
|
|
238
|
-
|
|
239
|
-
|
|
286
|
+
if volume != maxPlayerVolume || mute {
|
|
287
|
+
let newVolume = mute ?
|
|
288
|
+
minPlayerVolume :
|
|
289
|
+
volume
|
|
240
290
|
|
|
241
|
-
|
|
242
|
-
aspectRatio.withCString { cString in
|
|
243
|
-
player.videoAspectRatio = UnsafeMutablePointer(mutating: cString)
|
|
244
|
-
}
|
|
291
|
+
player.audio?.volume = Int32(newVolume)
|
|
245
292
|
}
|
|
246
293
|
|
|
247
294
|
time = defaultPlayerTime
|
|
@@ -250,13 +297,17 @@ class LibVlcPlayerView: ExpoView {
|
|
|
250
297
|
|
|
251
298
|
var source: String? {
|
|
252
299
|
didSet {
|
|
253
|
-
shouldCreate
|
|
300
|
+
if !shouldCreate {
|
|
301
|
+
shouldCreate = source != oldValue
|
|
302
|
+
}
|
|
254
303
|
}
|
|
255
304
|
}
|
|
256
305
|
|
|
257
306
|
var options: [String] = .init() {
|
|
258
307
|
didSet {
|
|
259
|
-
shouldCreate
|
|
308
|
+
if !shouldCreate {
|
|
309
|
+
shouldCreate = options != oldValue
|
|
310
|
+
}
|
|
260
311
|
}
|
|
261
312
|
}
|
|
262
313
|
|
|
@@ -299,6 +350,12 @@ class LibVlcPlayerView: ExpoView {
|
|
|
299
350
|
}
|
|
300
351
|
}
|
|
301
352
|
|
|
353
|
+
var contentFit: VideoContentFit = .contain {
|
|
354
|
+
didSet {
|
|
355
|
+
setContentFit()
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
302
359
|
var rate: Float = defaultPlayerRate {
|
|
303
360
|
didSet {
|
|
304
361
|
mediaPlayer?.rate = rate
|
package/package.json
CHANGED
|
@@ -76,6 +76,8 @@ export interface Slave {
|
|
|
76
76
|
selected?: boolean;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
export type VideoContentFit = "contain" | "cover" | "fill";
|
|
80
|
+
|
|
79
81
|
export type AudioMixingMode =
|
|
80
82
|
| "mixWithOthers"
|
|
81
83
|
| "duckOthers"
|
|
@@ -218,6 +220,7 @@ export interface LibVlcPlayerViewNativeProps {
|
|
|
218
220
|
slaves?: Slave[];
|
|
219
221
|
scale?: number;
|
|
220
222
|
aspectRatio?: string | null;
|
|
223
|
+
contentFit?: VideoContentFit;
|
|
221
224
|
rate?: number;
|
|
222
225
|
time?: number;
|
|
223
226
|
volume?: number;
|
|
@@ -308,6 +311,14 @@ export interface LibVlcPlayerViewProps extends ViewProps {
|
|
|
308
311
|
* @default undefined
|
|
309
312
|
*/
|
|
310
313
|
aspectRatio?: string | null;
|
|
314
|
+
/**
|
|
315
|
+
* Sets how the video should be scaled to fit in the container
|
|
316
|
+
*
|
|
317
|
+
* @example "cover"
|
|
318
|
+
*
|
|
319
|
+
* @default "contain"
|
|
320
|
+
*/
|
|
321
|
+
contentFit?: VideoContentFit;
|
|
311
322
|
/**
|
|
312
323
|
* Sets the player rate. Must be a float equal or greater than `1`
|
|
313
324
|
*
|