expo-libvlc-player 2.3.2 → 2.4.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 CHANGED
@@ -133,6 +133,7 @@ See the [Example App](example/components/PlayerView.tsx) for additional usage.
133
133
  | `pause()` | Pauses playback of the current player |
134
134
  | `stop()` | Stops playback of the current player |
135
135
  | `seek(value: number, type?: "position" \| "time")` | Sets the position or time of the current player. Must be a number equal or greater than `0` and type defaults to `"position"` |
136
+ | `record(path: string \| null)` | Starts or stops recording the current media. Must be a valid string or `null` |
136
137
  | `postAction(action: number)` | Posts an answer to a [`Dialog`](#dialog). Must be an integer of `1` or `2` |
137
138
  | `dismiss()` | Dismisses a [`Dialog`](#dialog) |
138
139
 
@@ -170,6 +171,7 @@ The `LibVlcPlayerView` extends React Native `ViewProps` and implements the follo
170
171
  | `onTimeChanged` | Called after the `TimeChanged` player event | `{ time: number }` |
171
172
  | `onPositionChanged` | Called after the `PositionChanged` player event | `{ position: number }` |
172
173
  | `onESAdded` | Called after the `ESAdded` player event | [`MediaTracks`](#mediatracks) |
174
+ | `onRecordChanged` | Called after the `RecordChanged` player event | [`Recording`](#recording) |
173
175
  | `onDialogDisplay` | Called after a `Dialog` needs to be displayed | [`Dialog`](#dialog) |
174
176
  | `onFirstPlay` | Called after the player first playing event | [`MediaInfo`](#mediainfo) |
175
177
  | `onBackground` | Called after the player enters the background | |
@@ -227,6 +229,15 @@ The `LibVlcPlayerView` extends React Native `ViewProps` and implements the follo
227
229
  }
228
230
  ```
229
231
 
232
+ #### `Recording`
233
+
234
+ ```ts
235
+ {
236
+ path: string | null;
237
+ isRecording: boolean;
238
+ }
239
+ ```
240
+
230
241
  #### `Dialog`
231
242
 
232
243
  ```ts
@@ -1,7 +1,7 @@
1
1
  apply plugin: "com.android.library"
2
2
 
3
3
  group = "expo.modules.libvlcplayer"
4
- version = "2.3.2"
4
+ version = "2.4.0"
5
5
 
6
6
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
7
7
  apply from: expoModulesCorePlugin
@@ -27,7 +27,7 @@ android {
27
27
  namespace "expo.modules.libvlcplayer"
28
28
  defaultConfig {
29
29
  versionCode 1
30
- versionName "2.3.2"
30
+ versionName "2.4.0"
31
31
  consumerProguardFiles("proguard-rules.pro")
32
32
  }
33
33
  lintOptions {
@@ -15,6 +15,7 @@ private const val ENCOUNTERED_ERROR_EVENT = "onEncounteredError"
15
15
  private const val TIME_CHANGED_EVENT = "onTimeChanged"
16
16
  private const val POSITION_CHANGED_EVENT = "onPositionChanged"
17
17
  private const val ES_ADDED_EVENT = "onESAdded"
18
+ private const val RECORD_CHANGED_EVENT = "onRecordChanged"
18
19
  private const val DIALOG_DISPLAY_EVENT = "onDialogDisplay"
19
20
  private const val FIRST_PLAY_EVENT = "onFirstPlay"
20
21
  private const val BACKGROUND_EVENT = "onBackground"
@@ -30,6 +31,7 @@ val playerEvents =
30
31
  TIME_CHANGED_EVENT,
31
32
  POSITION_CHANGED_EVENT,
32
33
  ES_ADDED_EVENT,
34
+ RECORD_CHANGED_EVENT,
33
35
  DIALOG_DISPLAY_EVENT,
34
36
  FIRST_PLAY_EVENT,
35
37
  BACKGROUND_EVENT,
@@ -132,6 +134,10 @@ class LibVlcPlayerModule : Module() {
132
134
  view.seek(value, type ?: "position")
133
135
  }
134
136
 
137
+ AsyncFunction("record") { view: LibVlcPlayerView, path: String? ->
138
+ view.record(path)
139
+ }
140
+
135
141
  AsyncFunction("postAction") { view: LibVlcPlayerView, action: Int ->
136
142
  view.postAction(action)
137
143
  }
@@ -9,6 +9,7 @@ import expo.modules.libvlcplayer.enums.AudioMixingMode
9
9
  import expo.modules.libvlcplayer.records.Dialog
10
10
  import expo.modules.libvlcplayer.records.MediaInfo
11
11
  import expo.modules.libvlcplayer.records.MediaTracks
12
+ import expo.modules.libvlcplayer.records.Recording
12
13
  import expo.modules.libvlcplayer.records.Slave
13
14
  import expo.modules.libvlcplayer.records.Track
14
15
  import expo.modules.libvlcplayer.records.Tracks
@@ -63,6 +64,7 @@ class LibVlcPlayerView(
63
64
  internal val onTimeChanged by EventDispatcher()
64
65
  internal val onPositionChanged by EventDispatcher()
65
66
  internal val onESAdded by EventDispatcher<MediaTracks>()
67
+ internal val onRecordChanged by EventDispatcher<Recording>()
66
68
  internal val onDialogDisplay by EventDispatcher<Dialog>()
67
69
  internal val onFirstPlay by EventDispatcher<MediaInfo>()
68
70
  internal val onBackground by EventDispatcher<Unit>()
@@ -112,9 +114,7 @@ class LibVlcPlayerView(
112
114
  media = Media(libVLC, Uri.parse(source))
113
115
  mediaPlayer!!.setMedia(media)
114
116
  media!!.release()
115
-
116
117
  addPlayerSlaves()
117
-
118
118
  mediaPlayer!!.play()
119
119
 
120
120
  shouldCreate = false
@@ -349,6 +349,7 @@ class LibVlcPlayerView(
349
349
 
350
350
  if (options.hasAudioOption()) {
351
351
  val error = mapOf("error" to "Audio disabled via options")
352
+
352
353
  onEncounteredError(error)
353
354
  }
354
355
 
@@ -366,6 +367,7 @@ class LibVlcPlayerView(
366
367
 
367
368
  if (options.hasAudioOption()) {
368
369
  val error = mapOf("error" to "Audio disabled via options")
370
+
369
371
  onEncounteredError(error)
370
372
  }
371
373
 
@@ -392,6 +394,7 @@ class LibVlcPlayerView(
392
394
 
393
395
  if (options.hasRepeatOption()) {
394
396
  val error = mapOf("error" to "Repeat enabled via options")
397
+
395
398
  onEncounteredError(error)
396
399
  }
397
400
  }
@@ -450,6 +453,28 @@ class LibVlcPlayerView(
450
453
  }
451
454
  }
452
455
 
456
+ fun record(path: String?) {
457
+ mediaPlayer?.let { player ->
458
+ if (!player.isPlaying()) {
459
+ return
460
+ }
461
+
462
+ if (path != null) {
463
+ val success = player.record(path)
464
+
465
+ if (!success) {
466
+ val error = mapOf("error" to "Invalid path, media could not be recorded")
467
+
468
+ onEncounteredError(error)
469
+
470
+ player.record(null)
471
+ }
472
+ } else {
473
+ player.record(null)
474
+ }
475
+ }
476
+ }
477
+
453
478
  fun postAction(action: Int) {
454
479
  vlcDialog?.let { dialog ->
455
480
  when (dialog) {
@@ -1,5 +1,6 @@
1
1
  package expo.modules.libvlcplayer
2
2
 
3
+ import expo.modules.libvlcplayer.records.Recording
3
4
  import org.videolan.libvlc.MediaPlayer.Event
4
5
  import org.videolan.libvlc.MediaPlayer.EventListener
5
6
 
@@ -94,6 +95,21 @@ fun LibVlcPlayerView.setMediaPlayerListener() {
94
95
 
95
96
  onESAdded(mediaTracks)
96
97
  }
98
+
99
+ Event.RecordChanged -> {
100
+ var recording = Recording()
101
+
102
+ val path = event.getRecordPath()
103
+ val isRecording = event.getRecording()
104
+
105
+ recording =
106
+ Recording(
107
+ path = path,
108
+ isRecording = isRecording,
109
+ )
110
+
111
+ onRecordChanged(recording)
112
+ }
97
113
  }
98
114
  },
99
115
  )
@@ -0,0 +1,11 @@
1
+ package expo.modules.libvlcplayer.records
2
+
3
+ import expo.modules.kotlin.records.Field
4
+ import expo.modules.kotlin.records.Record
5
+ import java.io.Serializable
6
+
7
+ class Recording(
8
+ @Field val path: String? = "",
9
+ @Field val isRecording: Boolean = false,
10
+ ) : Record,
11
+ Serializable
@@ -27,6 +27,14 @@ export interface LibVlcPlayerViewRef {
27
27
  * @returns A promise which resolves to `void`
28
28
  */
29
29
  readonly seek: (value: number, type?: "position" | "time") => Promise<void>;
30
+ /**
31
+ * Starts or stops recording the current media
32
+ *
33
+ * @param path - Must be a valid string or `null`
34
+ *
35
+ * @returns A promise which resolves to `void`
36
+ */
37
+ readonly record: (path: string | null) => Promise<void>;
30
38
  /**
31
39
  * Posts an answer to a `Dialog`
32
40
  *
@@ -77,6 +85,10 @@ export interface MediaInfo {
77
85
  seekable: boolean;
78
86
  tracks: MediaTracks;
79
87
  }
88
+ export interface Recording {
89
+ path: string | null;
90
+ isRecording: boolean;
91
+ }
80
92
  export interface Dialog {
81
93
  title: string;
82
94
  text: string;
@@ -104,31 +116,35 @@ type StoppedListener = () => void;
104
116
  * @hidden
105
117
  */
106
118
  type EndReachedListener = () => void;
107
- /**
108
- * @hidden
109
- */
110
- type EncounteredErrorListener = (event: NativeEvent<Error>) => void;
111
119
  export type Error = {
112
120
  error: string;
113
121
  };
114
122
  /**
115
123
  * @hidden
116
124
  */
117
- type TimeChangedListener = (event: NativeEvent<Time>) => void;
125
+ type EncounteredErrorListener = (event: NativeEvent<Error>) => void;
118
126
  export type Time = {
119
127
  time: number;
120
128
  };
121
129
  /**
122
130
  * @hidden
123
131
  */
124
- type PositionChangedListener = (event: NativeEvent<Position>) => void;
132
+ type TimeChangedListener = (event: NativeEvent<Time>) => void;
125
133
  export type Position = {
126
134
  position: number;
127
135
  };
136
+ /**
137
+ * @hidden
138
+ */
139
+ type PositionChangedListener = (event: NativeEvent<Position>) => void;
128
140
  /**
129
141
  * @hidden
130
142
  */
131
143
  type ESAddedListener = (event: NativeEvent<MediaTracks>) => void;
144
+ /**
145
+ * @hidden
146
+ */
147
+ type RecordChangedListener = (event: NativeEvent<Recording>) => void;
132
148
  /**
133
149
  * @hidden
134
150
  */
@@ -169,6 +185,7 @@ export interface LibVlcPlayerViewNativeProps {
169
185
  onTimeChanged?: TimeChangedListener;
170
186
  onPositionChanged?: PositionChangedListener;
171
187
  onESAdded?: ESAddedListener;
188
+ onRecordChanged?: RecordChangedListener;
172
189
  onDialogDisplay?: DialogDisplayListener;
173
190
  onFirstPlay?: FirstPlayListener;
174
191
  onBackground?: BackgroundListener;
@@ -322,6 +339,10 @@ export interface LibVlcPlayerViewProps extends ViewProps {
322
339
  * Called after the `ESAdded` player event
323
340
  */
324
341
  onESAdded?: (event: MediaTracks) => void;
342
+ /**
343
+ * Called after the `RecordChanged` player event
344
+ */
345
+ onRecordChanged?: (event: Recording) => void;
325
346
  /**
326
347
  * Called after a `Dialog` needs to be displayed
327
348
  */
@@ -1 +1 @@
1
- {"version":3,"file":"LibVlcPlayer.types.d.ts","sourceRoot":"","sources":["../src/LibVlcPlayer.types.ts"],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"names":[],"mappings":"","sourcesContent":["import type { ViewProps } from \"react-native\";\n\nexport interface LibVlcPlayerViewRef {\n /**\n * Starts playback of the current player\n *\n * @returns A promise which resolves to `void`\n */\n readonly play: () => Promise<void>;\n /**\n * Pauses playback of the current player\n *\n * @returns A promise which resolves to `void`\n */\n readonly pause: () => Promise<void>;\n /**\n * Stops playback of the current player\n *\n * @returns A promise which resolves to `void`\n */\n readonly stop: () => Promise<void>;\n /**\n * Sets the position or time of the current player\n *\n * @param value - Must be a number equal or greater than `0`\n * @param type - Defaults to `\"position\"`\n *\n * @returns A promise which resolves to `void`\n */\n readonly seek: (value: number, type?: \"position\" | \"time\") => Promise<void>;\n /**\n * Posts an answer to a `Dialog`\n *\n * @param action - Must be an integer of `1` or `2`\n *\n * @returns A promise which resolves to `void`\n */\n readonly postAction: (action: 1 | 2) => Promise<void>;\n /**\n * Dismisses a `Dialog`\n *\n * @returns A promise which resolves to `void`\n */\n readonly dismiss: () => Promise<void>;\n}\n\nexport type LibVlcSource = string | number | null;\n\nexport interface Tracks {\n audio?: number;\n video?: number;\n subtitle?: number;\n}\n\nexport interface Slave {\n source: NonNullable<LibVlcSource>;\n type: \"audio\" | \"subtitle\";\n selected?: boolean;\n}\n\nexport type AudioMixingMode =\n | \"mixWithOthers\"\n | \"duckOthers\"\n | \"auto\"\n | \"doNotMix\";\n\nexport interface NativeEventProps {\n target: number;\n}\n\nexport interface NativeEvent<T> {\n nativeEvent: T & NativeEventProps;\n}\n\nexport type LibVlcEvent<T> = Omit<T & NativeEventProps, \"target\">;\n\nexport interface Track {\n id: number;\n name: string;\n}\n\nexport interface MediaTracks {\n audio: Track[];\n video: Track[];\n subtitle: Track[];\n}\n\nexport interface MediaInfo {\n width: number;\n height: number;\n length: number;\n seekable: boolean;\n tracks: MediaTracks;\n}\n\nexport interface Dialog {\n title: string;\n text: string;\n cancelText?: string;\n action1Text?: string;\n action2Text?: string;\n}\n\n/**\n * @hidden\n */\ntype BufferingListener = () => void;\n\n/**\n * @hidden\n */\ntype PlayingListener = () => void;\n\n/**\n * @hidden\n */\ntype PausedListener = () => void;\n\n/**\n * @hidden\n */\ntype StoppedListener = () => void;\n\n/**\n * @hidden\n */\ntype EndReachedListener = () => void;\n\n/**\n * @hidden\n */\ntype EncounteredErrorListener = (event: NativeEvent<Error>) => void;\n\nexport type Error = { error: string };\n\n/**\n * @hidden\n */\ntype TimeChangedListener = (event: NativeEvent<Time>) => void;\n\nexport type Time = { time: number };\n\n/**\n * @hidden\n */\ntype PositionChangedListener = (event: NativeEvent<Position>) => void;\n\nexport type Position = { position: number };\n\n/**\n * @hidden\n */\ntype ESAddedListener = (event: NativeEvent<MediaTracks>) => void;\n\n/**\n * @hidden\n */\ntype DialogDisplayListener = (event: NativeEvent<Dialog>) => void;\n\n/**\n * @hidden\n */\ntype FirstPlayListener = (event: NativeEvent<MediaInfo>) => void;\n\n/**\n * @hidden\n */\ntype BackgroundListener = () => void;\n\n/**\n * @hidden\n */\nexport interface LibVlcPlayerViewNativeProps {\n ref?: React.Ref<LibVlcPlayerViewRef>;\n source?: LibVlcSource;\n options?: string[];\n tracks?: Tracks;\n slaves?: Slave[];\n scale?: number;\n aspectRatio?: string | null;\n rate?: number;\n time?: number;\n volume?: number;\n mute?: boolean;\n audioMixingMode?: AudioMixingMode;\n repeat?: boolean;\n playInBackground?: boolean;\n autoplay?: boolean;\n onBuffering?: BufferingListener;\n onPlaying?: PlayingListener;\n onPaused?: PausedListener;\n onStopped?: StoppedListener;\n onEndReached?: EndReachedListener;\n onEncounteredError?: EncounteredErrorListener;\n onTimeChanged?: TimeChangedListener;\n onPositionChanged?: PositionChangedListener;\n onESAdded?: ESAddedListener;\n onDialogDisplay?: DialogDisplayListener;\n onFirstPlay?: FirstPlayListener;\n onBackground?: BackgroundListener;\n}\n\nexport interface LibVlcPlayerViewProps extends ViewProps {\n /**\n * Sets the source of the media to be played. Set to `null` to release the player\n */\n source: LibVlcSource;\n /**\n * Sets the VLC options to initialize the player with\n *\n * https://wiki.videolan.org/VLC_command-line_help/\n *\n * @example [\"--network-caching=1000\"]\n *\n * @default []\n */\n options?: string[];\n /**\n * Sets the player audio, video and subtitle tracks\n *\n * @example\n * ```tsx\n * <LibVlcPlayerView\n * tracks={{\n * audio: 0,\n * video: 1,\n * subtitle: 2,\n * }}\n * />\n * ```\n *\n * @default undefined\n */\n tracks?: Tracks;\n /**\n * Sets the player audio and subtitle slaves\n *\n * @example\n * ```tsx\n * <LibVlcPlayerView\n * slaves={[\n * {\n * source: \"file://path/to/subtitle.srt\",\n * type: \"subtitle\",\n * selected: true\n * },\n * ]}\n * />\n * ```\n *\n * @default []\n */\n slaves?: Slave[];\n /**\n * Sets the player scaling factor. Must be a float equal or greater than `0`\n *\n * @default 0\n */\n scale?: number;\n /**\n * Sets the player aspect ratio. Must be a valid string or `null` for default\n *\n * @example \"16:9\"\n *\n * @default undefined\n */\n aspectRatio?: string | null;\n /**\n * Sets the player rate. Must be a float equal or greater than `1`\n *\n * @default 1\n */\n rate?: number;\n /**\n * Sets the initial player time. Must be an integer in milliseconds\n *\n * @default 0\n */\n time?: number;\n /**\n * Sets the player volume. Must be an integer between `0` and `100`\n *\n * @default 100\n */\n volume?: number;\n /**\n * Sets the player volume to `0` when `true`. Previous value is set when `false`\n *\n * @default false\n */\n mute?: boolean;\n /**\n * Determines how the player will interact with other audio playing in the system\n *\n * @default \"auto\"\n */\n audioMixingMode?: AudioMixingMode;\n /**\n * Determines whether the media should repeat once ended\n *\n * @default false\n */\n repeat?: boolean;\n /**\n * Determines whether the media should continue playing in the background\n *\n * @default false\n */\n playInBackground?: boolean;\n /**\n * Determines whether the media should autoplay once created\n *\n * @default true\n */\n autoplay?: boolean;\n /**\n * Called after the `Buffering` player event\n */\n onBuffering?: () => void;\n /**\n * Called after the `Playing` player event\n */\n onPlaying?: () => void;\n /**\n * Called after the `Paused` player event\n */\n onPaused?: () => void;\n /**\n * Called after the `Stopped` player event\n */\n onStopped?: () => void;\n /**\n * Called after the `EndReached` player event\n */\n onEndReached?: () => void;\n /**\n * Called after the `EncounteredError` player event\n */\n onEncounteredError?: (event: Error) => void;\n /**\n * Called after the `TimeChanged` player event\n */\n onTimeChanged?: (event: Time) => void;\n /**\n * Called after the `PositionChanged` player event\n */\n onPositionChanged?: (event: Position) => void;\n /**\n * Called after the `ESAdded` player event\n */\n onESAdded?: (event: MediaTracks) => void;\n /**\n * Called after a `Dialog` needs to be displayed\n */\n onDialogDisplay?: (event: Dialog) => void;\n /**\n * Called after the player first playing event\n */\n onFirstPlay?: (event: MediaInfo) => void;\n /**\n * Called after the player enters the background\n */\n onBackground?: () => void;\n}\n"]}
1
+ {"version":3,"file":"LibVlcPlayer.types.js","sourceRoot":"","sources":["../src/LibVlcPlayer.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ViewProps } from \"react-native\";\n\nexport interface LibVlcPlayerViewRef {\n /**\n * Starts playback of the current player\n *\n * @returns A promise which resolves to `void`\n */\n readonly play: () => Promise<void>;\n /**\n * Pauses playback of the current player\n *\n * @returns A promise which resolves to `void`\n */\n readonly pause: () => Promise<void>;\n /**\n * Stops playback of the current player\n *\n * @returns A promise which resolves to `void`\n */\n readonly stop: () => Promise<void>;\n /**\n * Sets the position or time of the current player\n *\n * @param value - Must be a number equal or greater than `0`\n * @param type - Defaults to `\"position\"`\n *\n * @returns A promise which resolves to `void`\n */\n readonly seek: (value: number, type?: \"position\" | \"time\") => Promise<void>;\n /**\n * Starts or stops recording the current media\n *\n * @param path - Must be a valid string or `null`\n *\n * @returns A promise which resolves to `void`\n */\n readonly record: (path: string | null) => Promise<void>;\n /**\n * Posts an answer to a `Dialog`\n *\n * @param action - Must be an integer of `1` or `2`\n *\n * @returns A promise which resolves to `void`\n */\n readonly postAction: (action: 1 | 2) => Promise<void>;\n /**\n * Dismisses a `Dialog`\n *\n * @returns A promise which resolves to `void`\n */\n readonly dismiss: () => Promise<void>;\n}\n\nexport type LibVlcSource = string | number | null;\n\nexport interface Tracks {\n audio?: number;\n video?: number;\n subtitle?: number;\n}\n\nexport interface Slave {\n source: NonNullable<LibVlcSource>;\n type: \"audio\" | \"subtitle\";\n selected?: boolean;\n}\n\nexport type AudioMixingMode =\n | \"mixWithOthers\"\n | \"duckOthers\"\n | \"auto\"\n | \"doNotMix\";\n\nexport interface NativeEventProps {\n target: number;\n}\n\nexport interface NativeEvent<T> {\n nativeEvent: T & NativeEventProps;\n}\n\nexport type LibVlcEvent<T> = Omit<T & NativeEventProps, \"target\">;\n\nexport interface Track {\n id: number;\n name: string;\n}\n\nexport interface MediaTracks {\n audio: Track[];\n video: Track[];\n subtitle: Track[];\n}\n\nexport interface MediaInfo {\n width: number;\n height: number;\n length: number;\n seekable: boolean;\n tracks: MediaTracks;\n}\n\nexport interface Recording {\n path: string | null;\n isRecording: boolean;\n}\n\nexport interface Dialog {\n title: string;\n text: string;\n cancelText?: string;\n action1Text?: string;\n action2Text?: string;\n}\n\n/**\n * @hidden\n */\ntype BufferingListener = () => void;\n\n/**\n * @hidden\n */\ntype PlayingListener = () => void;\n\n/**\n * @hidden\n */\ntype PausedListener = () => void;\n\n/**\n * @hidden\n */\ntype StoppedListener = () => void;\n\n/**\n * @hidden\n */\ntype EndReachedListener = () => void;\n\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\n/**\n * @hidden\n */\ntype DialogDisplayListener = (event: NativeEvent<Dialog>) => void;\n\n/**\n * @hidden\n */\ntype FirstPlayListener = (event: NativeEvent<MediaInfo>) => void;\n\n/**\n * @hidden\n */\ntype BackgroundListener = () => void;\n\n/**\n * @hidden\n */\nexport interface LibVlcPlayerViewNativeProps {\n ref?: React.Ref<LibVlcPlayerViewRef>;\n source?: LibVlcSource;\n options?: string[];\n tracks?: Tracks;\n slaves?: Slave[];\n scale?: number;\n aspectRatio?: string | null;\n rate?: number;\n time?: number;\n volume?: number;\n mute?: boolean;\n audioMixingMode?: AudioMixingMode;\n repeat?: boolean;\n playInBackground?: boolean;\n autoplay?: boolean;\n onBuffering?: BufferingListener;\n onPlaying?: PlayingListener;\n onPaused?: PausedListener;\n onStopped?: StoppedListener;\n onEndReached?: EndReachedListener;\n onEncounteredError?: EncounteredErrorListener;\n onTimeChanged?: TimeChangedListener;\n onPositionChanged?: PositionChangedListener;\n onESAdded?: ESAddedListener;\n onRecordChanged?: RecordChangedListener;\n onDialogDisplay?: DialogDisplayListener;\n onFirstPlay?: FirstPlayListener;\n onBackground?: BackgroundListener;\n}\n\nexport interface LibVlcPlayerViewProps extends ViewProps {\n /**\n * Sets the source of the media to be played. Set to `null` to release the player\n */\n source: LibVlcSource;\n /**\n * Sets the VLC options to initialize the player with\n *\n * https://wiki.videolan.org/VLC_command-line_help/\n *\n * @example [\"--network-caching=1000\"]\n *\n * @default []\n */\n options?: string[];\n /**\n * Sets the player audio, video and subtitle tracks\n *\n * @example\n * ```tsx\n * <LibVlcPlayerView\n * tracks={{\n * audio: 0,\n * video: 1,\n * subtitle: 2,\n * }}\n * />\n * ```\n *\n * @default undefined\n */\n tracks?: Tracks;\n /**\n * Sets the player audio and subtitle slaves\n *\n * @example\n * ```tsx\n * <LibVlcPlayerView\n * slaves={[\n * {\n * source: \"file://path/to/subtitle.srt\",\n * type: \"subtitle\",\n * selected: true\n * },\n * ]}\n * />\n * ```\n *\n * @default []\n */\n slaves?: Slave[];\n /**\n * Sets the player scaling factor. Must be a float equal or greater than `0`\n *\n * @default 0\n */\n scale?: number;\n /**\n * Sets the player aspect ratio. Must be a valid string or `null` for default\n *\n * @example \"16:9\"\n *\n * @default undefined\n */\n aspectRatio?: string | null;\n /**\n * Sets the player rate. Must be a float equal or greater than `1`\n *\n * @default 1\n */\n rate?: number;\n /**\n * Sets the initial player time. Must be an integer in milliseconds\n *\n * @default 0\n */\n time?: number;\n /**\n * Sets the player volume. Must be an integer between `0` and `100`\n *\n * @default 100\n */\n volume?: number;\n /**\n * Sets the player volume to `0` when `true`. Previous value is set when `false`\n *\n * @default false\n */\n mute?: boolean;\n /**\n * Determines how the player will interact with other audio playing in the system\n *\n * @default \"auto\"\n */\n audioMixingMode?: AudioMixingMode;\n /**\n * Determines whether the media should repeat once ended\n *\n * @default false\n */\n repeat?: boolean;\n /**\n * Determines whether the media should continue playing in the background\n *\n * @default false\n */\n playInBackground?: boolean;\n /**\n * Determines whether the media should autoplay once created\n *\n * @default true\n */\n autoplay?: boolean;\n /**\n * Called after the `Buffering` player event\n */\n onBuffering?: () => void;\n /**\n * Called after the `Playing` player event\n */\n onPlaying?: () => void;\n /**\n * Called after the `Paused` player event\n */\n onPaused?: () => void;\n /**\n * Called after the `Stopped` player event\n */\n onStopped?: () => void;\n /**\n * Called after the `EndReached` player event\n */\n onEndReached?: () => void;\n /**\n * Called after the `EncounteredError` player event\n */\n onEncounteredError?: (event: Error) => void;\n /**\n * Called after the `TimeChanged` player event\n */\n onTimeChanged?: (event: Time) => void;\n /**\n * Called after the `PositionChanged` player event\n */\n onPositionChanged?: (event: Position) => void;\n /**\n * Called after the `ESAdded` player event\n */\n onESAdded?: (event: MediaTracks) => void;\n /**\n * Called after the `RecordChanged` player event\n */\n onRecordChanged?: (event: Recording) => void;\n /**\n * Called after a `Dialog` needs to be displayed\n */\n onDialogDisplay?: (event: Dialog) => void;\n /**\n * Called after the player first playing event\n */\n onFirstPlay?: (event: MediaInfo) => void;\n /**\n * Called after the player enters the background\n */\n onBackground?: () => void;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"LibVlcPlayerView.d.ts","sourceRoot":"","sources":["../src/LibVlcPlayerView.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEL,qBAAqB,EACrB,mBAAmB,EAQpB,MAAM,sBAAsB,CAAC;AAU9B,QAAA,MAAM,gBAAgB,uHA8ErB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"LibVlcPlayerView.d.ts","sourceRoot":"","sources":["../src/LibVlcPlayerView.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEL,qBAAqB,EACrB,mBAAmB,EASpB,MAAM,sBAAsB,CAAC;AAU9B,QAAA,MAAM,gBAAgB,uHAuFrB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -36,6 +36,12 @@ const LibVlcPlayerView = forwardRef((props, ref) => {
36
36
  props.onESAdded(nativeEvent);
37
37
  }
38
38
  };
39
+ const onRecordChanged = (event) => {
40
+ if (props.onRecordChanged) {
41
+ const nativeEvent = converNativeEvent(event);
42
+ props.onRecordChanged(nativeEvent);
43
+ }
44
+ };
39
45
  const onDialogDisplay = (event) => {
40
46
  if (props.onDialogDisplay) {
41
47
  const nativeEvent = converNativeEvent(event);
@@ -51,7 +57,7 @@ const LibVlcPlayerView = forwardRef((props, ref) => {
51
57
  return (<NativeView {...nativeProps} ref={ref} source={parseSource(props.source)} slaves={props.slaves?.map((slave) => ({
52
58
  ...slave,
53
59
  source: parseSource(slave.source),
54
- }))} onEncounteredError={onEncounteredError} onTimeChanged={onTimeChanged} onPositionChanged={onPositionChanged} onESAdded={onESAdded} onDialogDisplay={onDialogDisplay} onFirstPlay={onFirstPlay}/>);
60
+ }))} onEncounteredError={onEncounteredError} onTimeChanged={onTimeChanged} onPositionChanged={onPositionChanged} onESAdded={onESAdded} onRecordChanged={onRecordChanged} onDialogDisplay={onDialogDisplay} onFirstPlay={onFirstPlay}/>);
55
61
  });
56
62
  export default LibVlcPlayerView;
57
63
  //# sourceMappingURL=LibVlcPlayerView.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LibVlcPlayerView.js","sourceRoot":"","sources":["../src/LibVlcPlayerView.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Aa,CAAC,CAC7B,iBAAiB,CAAC,CAAC,iBAAiB,CAAC,CACrC,SAAS,CAAC,CAAC,SAAS,CAAC,CACrB,eAAe,CAAC,CAAC,eAAe,CAAC,CACjC,WAAW,CAAC,CAAC,WAAW,CAAC,EACzB,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["import { requireNativeView } from \"expo\";\nimport { forwardRef, type ComponentType } from \"react\";\n\nimport {\n LibVlcPlayerViewNativeProps,\n LibVlcPlayerViewProps,\n LibVlcPlayerViewRef,\n type NativeEvent,\n type Error,\n type Time,\n type Position,\n type MediaTracks,\n type MediaInfo,\n type Dialog,\n} from \"./LibVlcPlayer.types\";\nimport { parseSource } from \"./utils/assets\";\nimport { converNativeEvent } from \"./utils/events\";\nimport { convertNativeProps } from \"./utils/props\";\n\nconst NativeView: ComponentType<LibVlcPlayerViewNativeProps> =\n requireNativeView(\"ExpoLibVlcPlayer\");\n\nlet loggedRenderingChildrenWarning: boolean = false;\n\nconst LibVlcPlayerView = forwardRef<LibVlcPlayerViewRef, LibVlcPlayerViewProps>(\n (props, ref) => {\n const nativeProps = convertNativeProps(props);\n\n // @ts-expect-error\n if (nativeProps.children && !loggedRenderingChildrenWarning) {\n console.warn(\n \"The <LibVlcPlayerView> component does not support children. This may lead to inconsistent behaviour or crashes. If you want to render content on top of the LibVlcPlayer, consider using absolute positioning.\",\n );\n loggedRenderingChildrenWarning = true;\n }\n\n const onEncounteredError = (event: NativeEvent<Error>) => {\n if (props.onEncounteredError) {\n const nativeEvent = converNativeEvent(event);\n\n props.onEncounteredError(nativeEvent);\n }\n };\n\n const onTimeChanged = (event: NativeEvent<Time>) => {\n if (props.onTimeChanged) {\n const nativeEvent = converNativeEvent(event);\n\n props.onTimeChanged(nativeEvent);\n }\n };\n\n const onPositionChanged = (event: NativeEvent<Position>) => {\n if (props.onPositionChanged) {\n const nativeEvent = converNativeEvent(event);\n\n props.onPositionChanged(nativeEvent);\n }\n };\n\n const onESAdded = (event: NativeEvent<MediaTracks>) => {\n if (props.onESAdded) {\n const nativeEvent = converNativeEvent(event);\n\n props.onESAdded(nativeEvent);\n }\n };\n\n const onDialogDisplay = (event: NativeEvent<Dialog>) => {\n if (props.onDialogDisplay) {\n const nativeEvent = converNativeEvent(event);\n\n props.onDialogDisplay(nativeEvent);\n }\n };\n\n const onFirstPlay = (event: NativeEvent<MediaInfo>) => {\n if (props.onFirstPlay) {\n const nativeEvent = converNativeEvent(event);\n\n props.onFirstPlay(nativeEvent);\n }\n };\n\n return (\n <NativeView\n {...nativeProps}\n ref={ref}\n source={parseSource(props.source)}\n slaves={props.slaves?.map((slave) => ({\n ...slave,\n source: parseSource(slave.source)!,\n }))}\n onEncounteredError={onEncounteredError}\n onTimeChanged={onTimeChanged}\n onPositionChanged={onPositionChanged}\n onESAdded={onESAdded}\n onDialogDisplay={onDialogDisplay}\n onFirstPlay={onFirstPlay}\n />\n );\n },\n);\n\nexport default LibVlcPlayerView;\n"]}
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;AAevD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,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,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAE9C,mBAAmB;IACnB,IAAI,WAAW,CAAC,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react\";\n\nimport {\n LibVlcPlayerViewNativeProps,\n LibVlcPlayerViewProps,\n LibVlcPlayerViewRef,\n type NativeEvent,\n type Error,\n type Time,\n type Position,\n type MediaTracks,\n type MediaInfo,\n type Dialog,\n type Recording,\n} from \"./LibVlcPlayer.types\";\nimport { parseSource } from \"./utils/assets\";\nimport { converNativeEvent } from \"./utils/events\";\nimport { convertNativeProps } from \"./utils/props\";\n\nconst NativeView: ComponentType<LibVlcPlayerViewNativeProps> =\n requireNativeView(\"ExpoLibVlcPlayer\");\n\nlet loggedRenderingChildrenWarning: boolean = false;\n\nconst LibVlcPlayerView = forwardRef<LibVlcPlayerViewRef, LibVlcPlayerViewProps>(\n (props, ref) => {\n const nativeProps = convertNativeProps(props);\n\n // @ts-expect-error\n if (nativeProps.children && !loggedRenderingChildrenWarning) {\n console.warn(\n \"The <LibVlcPlayerView> component does not support children. This may lead to inconsistent behaviour or crashes. If you want to render content on top of the LibVlcPlayer, consider using absolute positioning.\",\n );\n loggedRenderingChildrenWarning = true;\n }\n\n const onEncounteredError = (event: NativeEvent<Error>) => {\n if (props.onEncounteredError) {\n const nativeEvent = converNativeEvent(event);\n\n props.onEncounteredError(nativeEvent);\n }\n };\n\n const onTimeChanged = (event: NativeEvent<Time>) => {\n if (props.onTimeChanged) {\n const nativeEvent = converNativeEvent(event);\n\n props.onTimeChanged(nativeEvent);\n }\n };\n\n const onPositionChanged = (event: NativeEvent<Position>) => {\n if (props.onPositionChanged) {\n const nativeEvent = converNativeEvent(event);\n\n props.onPositionChanged(nativeEvent);\n }\n };\n\n const onESAdded = (event: NativeEvent<MediaTracks>) => {\n if (props.onESAdded) {\n const nativeEvent = converNativeEvent(event);\n\n props.onESAdded(nativeEvent);\n }\n };\n\n const onRecordChanged = (event: NativeEvent<Recording>) => {\n if (props.onRecordChanged) {\n const nativeEvent = converNativeEvent(event);\n\n props.onRecordChanged(nativeEvent);\n }\n };\n\n const onDialogDisplay = (event: NativeEvent<Dialog>) => {\n if (props.onDialogDisplay) {\n const nativeEvent = converNativeEvent(event);\n\n props.onDialogDisplay(nativeEvent);\n }\n };\n\n const onFirstPlay = (event: NativeEvent<MediaInfo>) => {\n if (props.onFirstPlay) {\n const nativeEvent = converNativeEvent(event);\n\n props.onFirstPlay(nativeEvent);\n }\n };\n\n return (\n <NativeView\n {...nativeProps}\n ref={ref}\n source={parseSource(props.source)}\n slaves={props.slaves?.map((slave) => ({\n ...slave,\n source: parseSource(slave.source)!,\n }))}\n onEncounteredError={onEncounteredError}\n onTimeChanged={onTimeChanged}\n onPositionChanged={onPositionChanged}\n onESAdded={onESAdded}\n onRecordChanged={onRecordChanged}\n onDialogDisplay={onDialogDisplay}\n onFirstPlay={onFirstPlay}\n />\n );\n },\n);\n\nexport default LibVlcPlayerView;\n"]}
@@ -9,6 +9,7 @@ private let encounteredErrorEvent = "onEncounteredError"
9
9
  private let timeChangedEvent = "onTimeChanged"
10
10
  private let positionChangedEvent = "onPositionChanged"
11
11
  private let esAddedEvent = "onESAdded"
12
+ private let recordChangedEvent = "onRecordChanged"
12
13
  private let dialogDisplayEvent = "onDialogDisplay"
13
14
  private let firstPlayEvent = "onFirstPlay"
14
15
  private let backgroundEvent = "onBackground"
@@ -23,6 +24,7 @@ let playerEvents = [
23
24
  timeChangedEvent,
24
25
  positionChangedEvent,
25
26
  esAddedEvent,
27
+ recordChangedEvent,
26
28
  dialogDisplayEvent,
27
29
  firstPlayEvent,
28
30
  backgroundEvent,
@@ -115,6 +117,10 @@ public class LibVlcPlayerModule: Module {
115
117
  view.seek(value, type ?? "position")
116
118
  }
117
119
 
120
+ AsyncFunction("record") { (view: LibVlcPlayerView, path: String?) in
121
+ view.record(path)
122
+ }
123
+
118
124
  AsyncFunction("postAction") { (view: LibVlcPlayerView, action: Int) in
119
125
  view.postAction(action)
120
126
  }
@@ -39,6 +39,7 @@ class LibVlcPlayerView: ExpoView {
39
39
  let onTimeChanged = EventDispatcher()
40
40
  let onPositionChanged = EventDispatcher()
41
41
  let onESAdded = EventDispatcher()
42
+ let onRecordChanged = EventDispatcher()
42
43
  let onDialogDisplay = EventDispatcher()
43
44
  let onFirstPlay = EventDispatcher()
44
45
  let onBackground = EventDispatcher()
@@ -90,9 +91,7 @@ class LibVlcPlayerView: ExpoView {
90
91
  }
91
92
 
92
93
  mediaPlayer!.media = VLCMedia(url: url)
93
-
94
94
  addPlayerSlaves()
95
-
96
95
  mediaPlayer!.play()
97
96
 
98
97
  shouldCreate = false
@@ -310,6 +309,7 @@ class LibVlcPlayerView: ExpoView {
310
309
  didSet {
311
310
  if options.hasAudioOption() {
312
311
  let error = ["error": "Audio disabled via options"]
312
+
313
313
  onEncounteredError(error)
314
314
  }
315
315
 
@@ -326,6 +326,7 @@ class LibVlcPlayerView: ExpoView {
326
326
  didSet {
327
327
  if options.hasAudioOption() {
328
328
  let error = ["error": "Audio disabled via options"]
329
+
329
330
  onEncounteredError(error)
330
331
  }
331
332
 
@@ -348,6 +349,7 @@ class LibVlcPlayerView: ExpoView {
348
349
  didSet {
349
350
  if options.hasRepeatOption() {
350
351
  let error = ["error": "Repeat enabled via options"]
352
+
351
353
  onEncounteredError(error)
352
354
  }
353
355
  }
@@ -403,6 +405,25 @@ class LibVlcPlayerView: ExpoView {
403
405
  }
404
406
  }
405
407
 
408
+ func record(_ path: String?) {
409
+ if let player = mediaPlayer, player.isPlaying {
410
+ if let path = path {
411
+ // https://code.videolan.org/videolan/VLCKit/-/issues/394
412
+ let success = !player.startRecording(atPath: path)
413
+
414
+ if !success {
415
+ let error = ["error": "Invalid path, media could not be recorded"]
416
+
417
+ onEncounteredError(error)
418
+
419
+ player.stopRecording()
420
+ }
421
+ } else {
422
+ player.stopRecording()
423
+ }
424
+ }
425
+ }
426
+
406
427
  func postAction(_ action: Int) {
407
428
  if let dialog = vlcDialog, let reference = vlcDialogRef {
408
429
  dialog.postAction(Int32(action), forDialogReference: reference)
@@ -82,4 +82,26 @@ extension LibVlcPlayerView: VLCMediaPlayerDelegate {
82
82
  onPositionChanged(position)
83
83
  }
84
84
  }
85
+
86
+ func mediaPlayerStartedRecording(_: VLCMediaPlayer) {
87
+ var recording = Recording()
88
+
89
+ recording = Recording(
90
+ path: nil,
91
+ isRecording: true,
92
+ )
93
+
94
+ onRecordChanged(recording)
95
+ }
96
+
97
+ func mediaPlayer(_: VLCMediaPlayer, recordingStoppedAtPath path: String) {
98
+ var recording = Recording()
99
+
100
+ recording = Recording(
101
+ path: path,
102
+ isRecording: false,
103
+ )
104
+
105
+ onRecordChanged(recording)
106
+ }
85
107
  }
@@ -0,0 +1,9 @@
1
+ import ExpoModulesCore
2
+
3
+ struct Recording: Record {
4
+ @Field
5
+ var path: String? = ""
6
+
7
+ @Field
8
+ var isRecording: Bool = false
9
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-libvlc-player",
3
- "version": "2.3.2",
3
+ "version": "2.4.0",
4
4
  "description": "LibVLC Player for Expo",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -28,6 +28,14 @@ export interface LibVlcPlayerViewRef {
28
28
  * @returns A promise which resolves to `void`
29
29
  */
30
30
  readonly seek: (value: number, type?: "position" | "time") => Promise<void>;
31
+ /**
32
+ * Starts or stops recording the current media
33
+ *
34
+ * @param path - Must be a valid string or `null`
35
+ *
36
+ * @returns A promise which resolves to `void`
37
+ */
38
+ readonly record: (path: string | null) => Promise<void>;
31
39
  /**
32
40
  * Posts an answer to a `Dialog`
33
41
  *
@@ -93,6 +101,11 @@ export interface MediaInfo {
93
101
  tracks: MediaTracks;
94
102
  }
95
103
 
104
+ export interface Recording {
105
+ path: string | null;
106
+ isRecording: boolean;
107
+ }
108
+
96
109
  export interface Dialog {
97
110
  title: string;
98
111
  text: string;
@@ -126,32 +139,37 @@ type StoppedListener = () => void;
126
139
  */
127
140
  type EndReachedListener = () => void;
128
141
 
142
+ export type Error = { error: string };
143
+
129
144
  /**
130
145
  * @hidden
131
146
  */
132
147
  type EncounteredErrorListener = (event: NativeEvent<Error>) => void;
133
148
 
134
- export type Error = { error: string };
149
+ export type Time = { time: number };
135
150
 
136
151
  /**
137
152
  * @hidden
138
153
  */
139
154
  type TimeChangedListener = (event: NativeEvent<Time>) => void;
140
155
 
141
- export type Time = { time: number };
156
+ export type Position = { position: number };
142
157
 
143
158
  /**
144
159
  * @hidden
145
160
  */
146
161
  type PositionChangedListener = (event: NativeEvent<Position>) => void;
147
162
 
148
- export type Position = { position: number };
149
-
150
163
  /**
151
164
  * @hidden
152
165
  */
153
166
  type ESAddedListener = (event: NativeEvent<MediaTracks>) => void;
154
167
 
168
+ /**
169
+ * @hidden
170
+ */
171
+ type RecordChangedListener = (event: NativeEvent<Recording>) => void;
172
+
155
173
  /**
156
174
  * @hidden
157
175
  */
@@ -195,6 +213,7 @@ export interface LibVlcPlayerViewNativeProps {
195
213
  onTimeChanged?: TimeChangedListener;
196
214
  onPositionChanged?: PositionChangedListener;
197
215
  onESAdded?: ESAddedListener;
216
+ onRecordChanged?: RecordChangedListener;
198
217
  onDialogDisplay?: DialogDisplayListener;
199
218
  onFirstPlay?: FirstPlayListener;
200
219
  onBackground?: BackgroundListener;
@@ -349,6 +368,10 @@ export interface LibVlcPlayerViewProps extends ViewProps {
349
368
  * Called after the `ESAdded` player event
350
369
  */
351
370
  onESAdded?: (event: MediaTracks) => void;
371
+ /**
372
+ * Called after the `RecordChanged` player event
373
+ */
374
+ onRecordChanged?: (event: Recording) => void;
352
375
  /**
353
376
  * Called after a `Dialog` needs to be displayed
354
377
  */
@@ -12,6 +12,7 @@ import {
12
12
  type MediaTracks,
13
13
  type MediaInfo,
14
14
  type Dialog,
15
+ type Recording,
15
16
  } from "./LibVlcPlayer.types";
16
17
  import { parseSource } from "./utils/assets";
17
18
  import { converNativeEvent } from "./utils/events";
@@ -66,6 +67,14 @@ const LibVlcPlayerView = forwardRef<LibVlcPlayerViewRef, LibVlcPlayerViewProps>(
66
67
  }
67
68
  };
68
69
 
70
+ const onRecordChanged = (event: NativeEvent<Recording>) => {
71
+ if (props.onRecordChanged) {
72
+ const nativeEvent = converNativeEvent(event);
73
+
74
+ props.onRecordChanged(nativeEvent);
75
+ }
76
+ };
77
+
69
78
  const onDialogDisplay = (event: NativeEvent<Dialog>) => {
70
79
  if (props.onDialogDisplay) {
71
80
  const nativeEvent = converNativeEvent(event);
@@ -95,6 +104,7 @@ const LibVlcPlayerView = forwardRef<LibVlcPlayerViewRef, LibVlcPlayerViewProps>(
95
104
  onTimeChanged={onTimeChanged}
96
105
  onPositionChanged={onPositionChanged}
97
106
  onESAdded={onESAdded}
107
+ onRecordChanged={onRecordChanged}
98
108
  onDialogDisplay={onDialogDisplay}
99
109
  onFirstPlay={onFirstPlay}
100
110
  />