@stepincto/expo-video 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. package/README.md +45 -0
  2. package/android/build.gradle +32 -0
  3. package/android/src/main/AndroidManifest.xml +20 -0
  4. package/android/src/main/java/expo/modules/video/AudioFocusManager.kt +241 -0
  5. package/android/src/main/java/expo/modules/video/FullscreenPlayerActivity.kt +145 -0
  6. package/android/src/main/java/expo/modules/video/IntervalUpdateClock.kt +54 -0
  7. package/android/src/main/java/expo/modules/video/MediaMetadataRetriever.kt +89 -0
  8. package/android/src/main/java/expo/modules/video/PictureInPictureHelperFragment.kt +26 -0
  9. package/android/src/main/java/expo/modules/video/PlayerViewExtension.kt +36 -0
  10. package/android/src/main/java/expo/modules/video/VideoCache.kt +104 -0
  11. package/android/src/main/java/expo/modules/video/VideoExceptions.kt +34 -0
  12. package/android/src/main/java/expo/modules/video/VideoManager.kt +133 -0
  13. package/android/src/main/java/expo/modules/video/VideoModule.kt +414 -0
  14. package/android/src/main/java/expo/modules/video/VideoThumbnail.kt +20 -0
  15. package/android/src/main/java/expo/modules/video/VideoView.kt +367 -0
  16. package/android/src/main/java/expo/modules/video/delegates/IgnoreSameSet.kt +24 -0
  17. package/android/src/main/java/expo/modules/video/drawing/OutlineProvider.kt +217 -0
  18. package/android/src/main/java/expo/modules/video/enums/AudioMixingMode.kt +20 -0
  19. package/android/src/main/java/expo/modules/video/enums/ContentFit.kt +19 -0
  20. package/android/src/main/java/expo/modules/video/enums/ContentType.kt +22 -0
  21. package/android/src/main/java/expo/modules/video/enums/DRMType.kt +26 -0
  22. package/android/src/main/java/expo/modules/video/enums/PlayerStatus.kt +10 -0
  23. package/android/src/main/java/expo/modules/video/playbackService/ExpoVideoPlaybackService.kt +184 -0
  24. package/android/src/main/java/expo/modules/video/playbackService/PlaybackServiceConnection.kt +39 -0
  25. package/android/src/main/java/expo/modules/video/playbackService/VideoMediaSessionCallback.kt +47 -0
  26. package/android/src/main/java/expo/modules/video/player/FirstFrameEventGenerator.kt +93 -0
  27. package/android/src/main/java/expo/modules/video/player/PlayerEvent.kt +164 -0
  28. package/android/src/main/java/expo/modules/video/player/VideoPlayer.kt +460 -0
  29. package/android/src/main/java/expo/modules/video/player/VideoPlayerAudioTracks.kt +125 -0
  30. package/android/src/main/java/expo/modules/video/player/VideoPlayerListener.kt +32 -0
  31. package/android/src/main/java/expo/modules/video/player/VideoPlayerLoadControl.kt +525 -0
  32. package/android/src/main/java/expo/modules/video/player/VideoPlayerSubtitles.kt +125 -0
  33. package/android/src/main/java/expo/modules/video/records/BufferOptions.kt +15 -0
  34. package/android/src/main/java/expo/modules/video/records/DRMOptions.kt +25 -0
  35. package/android/src/main/java/expo/modules/video/records/PlaybackError.kt +19 -0
  36. package/android/src/main/java/expo/modules/video/records/Tracks.kt +81 -0
  37. package/android/src/main/java/expo/modules/video/records/VideoEventPayloads.kt +79 -0
  38. package/android/src/main/java/expo/modules/video/records/VideoMetadata.kt +12 -0
  39. package/android/src/main/java/expo/modules/video/records/VideoSize.kt +14 -0
  40. package/android/src/main/java/expo/modules/video/records/VideoSource.kt +104 -0
  41. package/android/src/main/java/expo/modules/video/records/VideoThumbnailOptions.kt +24 -0
  42. package/android/src/main/java/expo/modules/video/utils/DataSourceUtils.kt +75 -0
  43. package/android/src/main/java/expo/modules/video/utils/EventDispatcherUtils.kt +43 -0
  44. package/android/src/main/java/expo/modules/video/utils/MutableWeakReference.kt +15 -0
  45. package/android/src/main/java/expo/modules/video/utils/PictureInPictureUtils.kt +96 -0
  46. package/android/src/main/java/expo/modules/video/utils/YogaUtils.kt +20 -0
  47. package/android/src/main/res/drawable/seek_backwards_10s.xml +25 -0
  48. package/android/src/main/res/drawable/seek_backwards_15s.xml +25 -0
  49. package/android/src/main/res/drawable/seek_backwards_5s.xml +25 -0
  50. package/android/src/main/res/drawable/seek_forwards_10s.xml +30 -0
  51. package/android/src/main/res/drawable/seek_forwards_15s.xml +31 -0
  52. package/android/src/main/res/drawable/seek_forwards_5s.xml +30 -0
  53. package/android/src/main/res/layout/fullscreen_player_activity.xml +16 -0
  54. package/android/src/main/res/layout/surface_player_view.xml +7 -0
  55. package/android/src/main/res/layout/texture_player_view.xml +7 -0
  56. package/android/src/main/res/values/styles.xml +9 -0
  57. package/app.plugin.js +1 -0
  58. package/build/NativeVideoModule.d.ts +16 -0
  59. package/build/NativeVideoModule.d.ts.map +1 -0
  60. package/build/NativeVideoModule.js +3 -0
  61. package/build/NativeVideoModule.js.map +1 -0
  62. package/build/NativeVideoModule.web.d.ts +3 -0
  63. package/build/NativeVideoModule.web.d.ts.map +1 -0
  64. package/build/NativeVideoModule.web.js +2 -0
  65. package/build/NativeVideoModule.web.js.map +1 -0
  66. package/build/NativeVideoView.d.ts +4 -0
  67. package/build/NativeVideoView.d.ts.map +1 -0
  68. package/build/NativeVideoView.js +6 -0
  69. package/build/NativeVideoView.js.map +1 -0
  70. package/build/VideoModule.d.ts +38 -0
  71. package/build/VideoModule.d.ts.map +1 -0
  72. package/build/VideoModule.js +53 -0
  73. package/build/VideoModule.js.map +1 -0
  74. package/build/VideoPlayer.d.ts +15 -0
  75. package/build/VideoPlayer.d.ts.map +1 -0
  76. package/build/VideoPlayer.js +52 -0
  77. package/build/VideoPlayer.js.map +1 -0
  78. package/build/VideoPlayer.types.d.ts +532 -0
  79. package/build/VideoPlayer.types.d.ts.map +1 -0
  80. package/build/VideoPlayer.types.js +2 -0
  81. package/build/VideoPlayer.types.js.map +1 -0
  82. package/build/VideoPlayer.web.d.ts +75 -0
  83. package/build/VideoPlayer.web.d.ts.map +1 -0
  84. package/build/VideoPlayer.web.js +376 -0
  85. package/build/VideoPlayer.web.js.map +1 -0
  86. package/build/VideoPlayerEvents.types.d.ts +262 -0
  87. package/build/VideoPlayerEvents.types.d.ts.map +1 -0
  88. package/build/VideoPlayerEvents.types.js +2 -0
  89. package/build/VideoPlayerEvents.types.js.map +1 -0
  90. package/build/VideoThumbnail.d.ts +29 -0
  91. package/build/VideoThumbnail.d.ts.map +1 -0
  92. package/build/VideoThumbnail.js +3 -0
  93. package/build/VideoThumbnail.js.map +1 -0
  94. package/build/VideoView.d.ts +44 -0
  95. package/build/VideoView.d.ts.map +1 -0
  96. package/build/VideoView.js +76 -0
  97. package/build/VideoView.js.map +1 -0
  98. package/build/VideoView.types.d.ts +147 -0
  99. package/build/VideoView.types.d.ts.map +1 -0
  100. package/build/VideoView.types.js +2 -0
  101. package/build/VideoView.types.js.map +1 -0
  102. package/build/VideoView.web.d.ts +9 -0
  103. package/build/VideoView.web.d.ts.map +1 -0
  104. package/build/VideoView.web.js +180 -0
  105. package/build/VideoView.web.js.map +1 -0
  106. package/build/index.d.ts +9 -0
  107. package/build/index.d.ts.map +1 -0
  108. package/build/index.js +7 -0
  109. package/build/index.js.map +1 -0
  110. package/build/resolveAssetSource.d.ts +3 -0
  111. package/build/resolveAssetSource.d.ts.map +1 -0
  112. package/build/resolveAssetSource.js +3 -0
  113. package/build/resolveAssetSource.js.map +1 -0
  114. package/build/resolveAssetSource.web.d.ts +4 -0
  115. package/build/resolveAssetSource.web.d.ts.map +1 -0
  116. package/build/resolveAssetSource.web.js +16 -0
  117. package/build/resolveAssetSource.web.js.map +1 -0
  118. package/expo-module.config.json +9 -0
  119. package/ios/Cache/CachableRequest.swift +44 -0
  120. package/ios/Cache/CachedResource.swift +97 -0
  121. package/ios/Cache/CachingHelpers.swift +92 -0
  122. package/ios/Cache/MediaFileHandle.swift +94 -0
  123. package/ios/Cache/MediaInfo.swift +147 -0
  124. package/ios/Cache/ResourceLoaderDelegate.swift +274 -0
  125. package/ios/Cache/SynchronizedHashTable.swift +23 -0
  126. package/ios/Cache/VideoCacheManager.swift +338 -0
  127. package/ios/ContentKeyDelegate.swift +214 -0
  128. package/ios/ContentKeyManager.swift +21 -0
  129. package/ios/Enums/AudioMixingMode.swift +37 -0
  130. package/ios/Enums/ContentType.swift +12 -0
  131. package/ios/Enums/DRMType.swift +20 -0
  132. package/ios/Enums/PlayerStatus.swift +10 -0
  133. package/ios/Enums/VideoContentFit.swift +39 -0
  134. package/ios/ExpoVideo.podspec +29 -0
  135. package/ios/NowPlayingManager.swift +296 -0
  136. package/ios/Records/BufferOptions.swift +12 -0
  137. package/ios/Records/DRMOptions.swift +24 -0
  138. package/ios/Records/PlaybackError.swift +10 -0
  139. package/ios/Records/Tracks.swift +176 -0
  140. package/ios/Records/VideoEventPayloads.swift +76 -0
  141. package/ios/Records/VideoMetadata.swift +16 -0
  142. package/ios/Records/VideoSize.swift +15 -0
  143. package/ios/Records/VideoSource.swift +25 -0
  144. package/ios/Thumbnails/VideoThumbnail.swift +27 -0
  145. package/ios/Thumbnails/VideoThumbnailGenerator.swift +68 -0
  146. package/ios/Thumbnails/VideoThumbnailOptions.swift +15 -0
  147. package/ios/VideoAsset.swift +123 -0
  148. package/ios/VideoExceptions.swift +53 -0
  149. package/ios/VideoItem.swift +11 -0
  150. package/ios/VideoManager.swift +140 -0
  151. package/ios/VideoModule.swift +383 -0
  152. package/ios/VideoPlayer/DangerousPropertiesStore.swift +19 -0
  153. package/ios/VideoPlayer.swift +435 -0
  154. package/ios/VideoPlayerAudioTracks.swift +72 -0
  155. package/ios/VideoPlayerItem.swift +97 -0
  156. package/ios/VideoPlayerObserver.swift +523 -0
  157. package/ios/VideoPlayerSubtitles.swift +71 -0
  158. package/ios/VideoSourceLoader.swift +89 -0
  159. package/ios/VideoSourceLoaderListener.swift +34 -0
  160. package/ios/VideoView.swift +224 -0
  161. package/package.json +59 -0
  162. package/plugin/build/tsconfig.tsbuildinfo +1 -0
  163. package/plugin/build/withExpoVideo.d.ts +7 -0
  164. package/plugin/build/withExpoVideo.js +38 -0
  165. package/src/NativeVideoModule.ts +20 -0
  166. package/src/NativeVideoModule.web.ts +1 -0
  167. package/src/NativeVideoView.ts +8 -0
  168. package/src/VideoModule.ts +59 -0
  169. package/src/VideoPlayer.tsx +67 -0
  170. package/src/VideoPlayer.types.ts +613 -0
  171. package/src/VideoPlayer.web.tsx +451 -0
  172. package/src/VideoPlayerEvents.types.ts +313 -0
  173. package/src/VideoThumbnail.ts +31 -0
  174. package/src/VideoView.tsx +86 -0
  175. package/src/VideoView.types.ts +165 -0
  176. package/src/VideoView.web.tsx +214 -0
  177. package/src/index.ts +46 -0
  178. package/src/resolveAssetSource.ts +2 -0
  179. package/src/resolveAssetSource.web.ts +17 -0
  180. package/src/ts-declarations/react-native-assets.d.ts +1 -0
@@ -0,0 +1,262 @@
1
+ import { PlayerError, SubtitleTrack, VideoPlayerStatus, VideoSource, VideoTrack, AudioTrack } from './VideoPlayer.types';
2
+ /**
3
+ * Handlers for events which can be emitted by the player.
4
+ */
5
+ export type VideoPlayerEvents = {
6
+ /**
7
+ * Handler for an event emitted when the status of the player changes.
8
+ */
9
+ statusChange(payload: StatusChangeEventPayload): void;
10
+ /**
11
+ * Handler for an event emitted when the player starts or stops playback.
12
+ */
13
+ playingChange(payload: PlayingChangeEventPayload): void;
14
+ /**
15
+ * Handler for an event emitted when the `playbackRate` property of the player changes.
16
+ */
17
+ playbackRateChange(payload: PlaybackRateChangeEventPayload): void;
18
+ /**
19
+ * Handler for an event emitted when the `volume` of `muted` property of the player changes.
20
+ */
21
+ volumeChange(payload: VolumeChangeEventPayload): void;
22
+ /**
23
+ * Handler for an event emitted when the `muted` property of the player changes
24
+ */
25
+ mutedChange(payload: MutedChangeEventPayload): void;
26
+ /**
27
+ * Handler for an event emitted when the player plays to the end of the current source.
28
+ */
29
+ playToEnd(): void;
30
+ /**
31
+ * Handler for an event emitted in a given interval specified by the `timeUpdateEventInterval`.
32
+ */
33
+ timeUpdate(payload: TimeUpdateEventPayload): void;
34
+ /**
35
+ * Handler for an event emitted when the current media source of the player changes.
36
+ */
37
+ sourceChange(payload: SourceChangeEventPayload): void;
38
+ /**
39
+ * Handler for an event emitted when the available subtitle tracks change.
40
+ */
41
+ availableSubtitleTracksChange(payload: AvailableSubtitleTracksChangeEventPayload): void;
42
+ /**
43
+ * Handler for an event emitted when the current subtitle track changes.
44
+ */
45
+ subtitleTrackChange(payload: SubtitleTrackChangeEventPayload): void;
46
+ /**
47
+ * Handler for an event emitted when the available audio tracks change.
48
+ */
49
+ availableAudioTracksChange(payload: AvailableAudioTracksChangeEventPayload): void;
50
+ /**
51
+ * Handler for an event emitted when the current audio track changes.
52
+ */
53
+ audioTrackChange(payload: AudioTrackChangeEventPayload): void;
54
+ /**
55
+ * Handler for an event emitted when the current video track changes.
56
+ */
57
+ videoTrackChange(payload: VideoTrackChangeEventPayload): void;
58
+ /**
59
+ * Handler for an event emitted when the player has finished loading metadata for the current video source.
60
+ * This event is emitted when the player has finished metadata for a [`VideoSource`](#videosource), but it doesn't mean that there is enough data buffered to start the playback.
61
+ */
62
+ sourceLoad(payload: SourceLoadEventPayload): void;
63
+ };
64
+ /**
65
+ * Data delivered with the [`statusChange`](#videoplayerevents) event.
66
+ */
67
+ export type StatusChangeEventPayload = {
68
+ /**
69
+ * New status of the player.
70
+ */
71
+ status: VideoPlayerStatus;
72
+ /**
73
+ * Previous status of the player.
74
+ */
75
+ oldStatus?: VideoPlayerStatus;
76
+ /**
77
+ * Error object containing information about the error that occurred.
78
+ */
79
+ error?: PlayerError;
80
+ };
81
+ /**
82
+ * Data delivered with the [`playingChange`](#videoplayerevents) event.
83
+ */
84
+ export type PlayingChangeEventPayload = {
85
+ /**
86
+ * Boolean value whether the player is currently playing.
87
+ */
88
+ isPlaying: boolean;
89
+ /**
90
+ * Previous value of the `isPlaying` property.
91
+ */
92
+ oldIsPlaying?: boolean;
93
+ };
94
+ /**
95
+ * Data delivered with the [`playbackRateChange`](#videoplayerevents) event.
96
+ */
97
+ export type PlaybackRateChangeEventPayload = {
98
+ /**
99
+ * Float value indicating the current playback speed of the player.
100
+ */
101
+ playbackRate: number;
102
+ /**
103
+ * Previous value of the `playbackRate` property.
104
+ */
105
+ oldPlaybackRate?: number;
106
+ };
107
+ /**
108
+ * Data delivered with the [`volumeChange`](#videoplayerevents) event.
109
+ */
110
+ export type VolumeChangeEventPayload = {
111
+ /**
112
+ * Float value indicating the current volume of the player.
113
+ */
114
+ volume: number;
115
+ /**
116
+ * Previous value of the `volume` property.
117
+ */
118
+ oldVolume?: number;
119
+ };
120
+ /**
121
+ * Data delivered with the [`mutedChange`](#videoplayerevents) event.
122
+ */
123
+ export type MutedChangeEventPayload = {
124
+ /**
125
+ * Boolean value whether the player is currently muted.
126
+ */
127
+ muted: boolean;
128
+ /**
129
+ * Previous value of the `isMuted` property.
130
+ */
131
+ oldMuted?: boolean;
132
+ };
133
+ /**
134
+ * Data delivered with the [`sourceChange`](#videoplayerevents) event.
135
+ */
136
+ export type SourceChangeEventPayload = {
137
+ /**
138
+ * New source of the player.
139
+ */
140
+ source: VideoSource;
141
+ /**
142
+ * Previous source of the player.
143
+ */
144
+ oldSource?: VideoSource;
145
+ };
146
+ /**
147
+ * Data delivered with the [`timeUpdate`](#videoplayerevents) event, contains information about the current playback progress.
148
+ */
149
+ export type TimeUpdateEventPayload = {
150
+ /**
151
+ * Float value indicating the current playback time in seconds. Same as the [`currentTime`](#currenttime) property.
152
+ */
153
+ currentTime: number;
154
+ /**
155
+ * The exact timestamp when the currently displayed video frame was sent from the server,
156
+ * based on the `EXT-X-PROGRAM-DATE-TIME` tag in the livestream metadata.
157
+ * Same as the [`currentLiveTimestamp`](#currentlivetimestamp) property.
158
+ * @platform android
159
+ * @platform ios
160
+ */
161
+ currentLiveTimestamp: number | null;
162
+ /**
163
+ * Float value indicating the latency of the live stream in seconds.
164
+ * Same as the [`currentOffsetFromLive`](#currentoffsetfromlive) property.
165
+ * @platform android
166
+ * @platform ios
167
+ */
168
+ currentOffsetFromLive: number | null;
169
+ /**
170
+ * Float value indicating how far the player has buffered the video in seconds.
171
+ * Same as the [`bufferedPosition`](#bufferedPosition) property.
172
+ * @platform android
173
+ * @platform ios
174
+ */
175
+ bufferedPosition: number;
176
+ };
177
+ export type SubtitleTrackChangeEventPayload = {
178
+ /**
179
+ * New subtitle track of the player.
180
+ */
181
+ subtitleTrack: SubtitleTrack | null;
182
+ /**
183
+ * Previous subtitle track of the player.
184
+ */
185
+ oldSubtitleTrack?: SubtitleTrack | null;
186
+ };
187
+ /**
188
+ * Data delivered with the [`videoTrackChange`](#videoplayerevents) event, contains information about the video track which is currently being played.
189
+ */
190
+ export type VideoTrackChangeEventPayload = {
191
+ /**
192
+ * New video track of the player.
193
+ */
194
+ videoTrack: VideoTrack | null;
195
+ /**
196
+ * Previous video track of the player.
197
+ */
198
+ oldVideoTrack?: VideoTrack | null;
199
+ };
200
+ /**
201
+ * TODO @behenate: For SDK53 mark as deprecated in favor of SourceLoadEventPayload
202
+ * @hidden
203
+ */
204
+ export type AvailableSubtitleTracksChangeEventPayload = {
205
+ /**
206
+ * Array of available subtitle tracks.
207
+ */
208
+ availableSubtitleTracks: SubtitleTrack[];
209
+ /**
210
+ * Previous array of available subtitle tracks.
211
+ */
212
+ oldAvailableSubtitleTracks?: SubtitleTrack[];
213
+ };
214
+ /**
215
+ * Data delivered with the [`sourceLoad`](#videoplayerevents) event, contains information about the video source that has finished loading.
216
+ */
217
+ export type SourceLoadEventPayload = {
218
+ /**
219
+ * The video source that has been loaded.
220
+ */
221
+ videoSource: VideoSource | null;
222
+ /**
223
+ * Duration of the video source in seconds.
224
+ */
225
+ duration: number;
226
+ /**
227
+ * Video tracks available for the loaded video source.
228
+ *
229
+ * > On iOS, when using a HLS source, make sure that the uri contains `.m3u8` extension or that the [`contentType`](#contenttype) property of the [`VideoSource`](#videosource) has been set to `'hls'`. Otherwise, the video tracks will not be available.
230
+ */
231
+ availableVideoTracks: VideoTrack[];
232
+ /**
233
+ * Subtitle tracks available for the loaded video source.
234
+ */
235
+ availableSubtitleTracks: SubtitleTrack[];
236
+ /**
237
+ * Audio tracks available for the loaded video source.
238
+ */
239
+ availableAudioTracks: AudioTrack[];
240
+ };
241
+ type AudioTrackChangeEventPayload = {
242
+ /**
243
+ * New audio track of the player.
244
+ */
245
+ audioTrack: AudioTrack | null;
246
+ /**
247
+ * Previous audio track of the player.
248
+ */
249
+ oldAudioTrack?: AudioTrack | null;
250
+ };
251
+ type AvailableAudioTracksChangeEventPayload = {
252
+ /**
253
+ * Array of available audio tracks.
254
+ */
255
+ availableAudioTracks: AudioTrack[];
256
+ /**
257
+ * Previous array of available audio tracks.
258
+ */
259
+ oldAvailableAudioTracks?: AudioTrack[];
260
+ };
261
+ export {};
262
+ //# sourceMappingURL=VideoPlayerEvents.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VideoPlayerEvents.types.d.ts","sourceRoot":"","sources":["../src/VideoPlayerEvents.types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,UAAU,EACV,UAAU,EACX,MAAM,qBAAqB,CAAC;AAE7B;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;OAEG;IACH,YAAY,CAAC,OAAO,EAAE,wBAAwB,GAAG,IAAI,CAAC;IAEtD;;OAEG;IACH,aAAa,CAAC,OAAO,EAAE,yBAAyB,GAAG,IAAI,CAAC;IAExD;;OAEG;IACH,kBAAkB,CAAC,OAAO,EAAE,8BAA8B,GAAG,IAAI,CAAC;IAElE;;OAEG;IACH,YAAY,CAAC,OAAO,EAAE,wBAAwB,GAAG,IAAI,CAAC;IAEtD;;OAEG;IACH,WAAW,CAAC,OAAO,EAAE,uBAAuB,GAAG,IAAI,CAAC;IAEpD;;OAEG;IACH,SAAS,IAAI,IAAI,CAAC;IAElB;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAElD;;OAEG;IACH,YAAY,CAAC,OAAO,EAAE,wBAAwB,GAAG,IAAI,CAAC;IAEtD;;OAEG;IACH,6BAA6B,CAAC,OAAO,EAAE,yCAAyC,GAAG,IAAI,CAAC;IAExF;;OAEG;IACH,mBAAmB,CAAC,OAAO,EAAE,+BAA+B,GAAG,I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AAG,IAAI,CAAC;CACnC,CAAC;AAEF,KAAK,sCAAsC,GAAG;IAC5C;;OAEG;IACH,oBAAoB,EAAE,UAAU,EAAE,CAAC;IAEnC;;OAEG;IACH,uBAAuB,CAAC,EAAE,UAAU,EAAE,CAAC;CACxC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=VideoPlayerEvents.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VideoPlayerEvents.types.js","sourceRoot":"","sources":["../src/VideoPlayerEvents.types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n PlayerError,\n SubtitleTrack,\n VideoPlayerStatus,\n VideoSource,\n VideoTrack,\n AudioTrack,\n} from './VideoPlayer.types';\n\n/**\n * Handlers for events which can be emitted by the player.\n */\nexport type VideoPlayerEvents = {\n /**\n * Handler for an event emitted when the status of the player changes.\n */\n statusChange(payload: StatusChangeEventPayload): void;\n\n /**\n * Handler for an event emitted when the player starts or stops playback.\n */\n playingChange(payload: PlayingChangeEventPayload): void;\n\n /**\n * Handler for an event emitted when the `playbackRate` property of the player changes.\n */\n playbackRateChange(payload: PlaybackRateChangeEventPayload): void;\n\n /**\n * Handler for an event emitted when the `volume` of `muted` property of the player changes.\n */\n volumeChange(payload: VolumeChangeEventPayload): void;\n\n /**\n * Handler for an event emitted when the `muted` property of the player changes\n */\n mutedChange(payload: MutedChangeEventPayload): void;\n\n /**\n * Handler for an event emitted when the player plays to the end of the current source.\n */\n playToEnd(): void;\n\n /**\n * Handler for an event emitted in a given interval specified by the `timeUpdateEventInterval`.\n */\n timeUpdate(payload: TimeUpdateEventPayload): void;\n\n /**\n * Handler for an event emitted when the current media source of the player changes.\n */\n sourceChange(payload: SourceChangeEventPayload): void;\n\n /**\n * Handler for an event emitted when the available subtitle tracks change.\n */\n availableSubtitleTracksChange(payload: AvailableSubtitleTracksChangeEventPayload): void;\n\n /**\n * Handler for an event emitted when the current subtitle track changes.\n */\n subtitleTrackChange(payload: SubtitleTrackChangeEventPayload): void;\n\n /**\n * Handler for an event emitted when the available audio tracks change.\n */\n availableAudioTracksChange(payload: AvailableAudioTracksChangeEventPayload): void;\n\n /**\n * Handler for an event emitted when the current audio track changes.\n */\n audioTrackChange(payload: AudioTrackChangeEventPayload): void;\n\n /**\n * Handler for an event emitted when the current video track changes.\n */\n videoTrackChange(payload: VideoTrackChangeEventPayload): void;\n\n /**\n * Handler for an event emitted when the player has finished loading metadata for the current video source.\n * This event is emitted when the player has finished metadata for a [`VideoSource`](#videosource), but it doesn't mean that there is enough data buffered to start the playback.\n */\n sourceLoad(payload: SourceLoadEventPayload): void;\n};\n\n/**\n * Data delivered with the [`statusChange`](#videoplayerevents) event.\n */\nexport type StatusChangeEventPayload = {\n /**\n * New status of the player.\n */\n status: VideoPlayerStatus;\n\n /**\n * Previous status of the player.\n */\n oldStatus?: VideoPlayerStatus;\n\n /**\n * Error object containing information about the error that occurred.\n */\n error?: PlayerError;\n};\n\n/**\n * Data delivered with the [`playingChange`](#videoplayerevents) event.\n */\nexport type PlayingChangeEventPayload = {\n /**\n * Boolean value whether the player is currently playing.\n */\n isPlaying: boolean;\n\n /**\n * Previous value of the `isPlaying` property.\n */\n oldIsPlaying?: boolean;\n};\n\n/**\n * Data delivered with the [`playbackRateChange`](#videoplayerevents) event.\n */\nexport type PlaybackRateChangeEventPayload = {\n /**\n * Float value indicating the current playback speed of the player.\n */\n playbackRate: number;\n\n /**\n * Previous value of the `playbackRate` property.\n */\n oldPlaybackRate?: number;\n};\n\n/**\n * Data delivered with the [`volumeChange`](#videoplayerevents) event.\n */\nexport type VolumeChangeEventPayload = {\n /**\n * Float value indicating the current volume of the player.\n */\n volume: number;\n\n /**\n * Previous value of the `volume` property.\n */\n oldVolume?: number;\n};\n\n/**\n * Data delivered with the [`mutedChange`](#videoplayerevents) event.\n */\nexport type MutedChangeEventPayload = {\n /**\n * Boolean value whether the player is currently muted.\n */\n muted: boolean;\n\n /**\n * Previous value of the `isMuted` property.\n */\n oldMuted?: boolean;\n};\n\n/**\n * Data delivered with the [`sourceChange`](#videoplayerevents) event.\n */\nexport type SourceChangeEventPayload = {\n /**\n * New source of the player.\n */\n source: VideoSource;\n\n /**\n * Previous source of the player.\n */\n oldSource?: VideoSource;\n};\n\n/**\n * Data delivered with the [`timeUpdate`](#videoplayerevents) event, contains information about the current playback progress.\n */\nexport type TimeUpdateEventPayload = {\n /**\n * Float value indicating the current playback time in seconds. Same as the [`currentTime`](#currenttime) property.\n */\n currentTime: number;\n\n /**\n * The exact timestamp when the currently displayed video frame was sent from the server,\n * based on the `EXT-X-PROGRAM-DATE-TIME` tag in the livestream metadata.\n * Same as the [`currentLiveTimestamp`](#currentlivetimestamp) property.\n * @platform android\n * @platform ios\n */\n currentLiveTimestamp: number | null;\n\n /**\n * Float value indicating the latency of the live stream in seconds.\n * Same as the [`currentOffsetFromLive`](#currentoffsetfromlive) property.\n * @platform android\n * @platform ios\n */\n currentOffsetFromLive: number | null;\n\n /**\n * Float value indicating how far the player has buffered the video in seconds.\n * Same as the [`bufferedPosition`](#bufferedPosition) property.\n * @platform android\n * @platform ios\n */\n bufferedPosition: number;\n};\n\nexport type SubtitleTrackChangeEventPayload = {\n /**\n * New subtitle track of the player.\n */\n subtitleTrack: SubtitleTrack | null;\n\n /**\n * Previous subtitle track of the player.\n */\n oldSubtitleTrack?: SubtitleTrack | null;\n};\n\n/**\n * Data delivered with the [`videoTrackChange`](#videoplayerevents) event, contains information about the video track which is currently being played.\n */\nexport type VideoTrackChangeEventPayload = {\n /**\n * New video track of the player.\n */\n videoTrack: VideoTrack | null;\n\n /**\n * Previous video track of the player.\n */\n oldVideoTrack?: VideoTrack | null;\n};\n\n/**\n * TODO @behenate: For SDK53 mark as deprecated in favor of SourceLoadEventPayload\n * @hidden\n */\nexport type AvailableSubtitleTracksChangeEventPayload = {\n /**\n * Array of available subtitle tracks.\n */\n availableSubtitleTracks: SubtitleTrack[];\n\n /**\n * Previous array of available subtitle tracks.\n */\n oldAvailableSubtitleTracks?: SubtitleTrack[];\n};\n\n/**\n * Data delivered with the [`sourceLoad`](#videoplayerevents) event, contains information about the video source that has finished loading.\n */\nexport type SourceLoadEventPayload = {\n /**\n * The video source that has been loaded.\n */\n videoSource: VideoSource | null;\n\n /**\n * Duration of the video source in seconds.\n */\n duration: number;\n\n /**\n * Video tracks available for the loaded video source.\n *\n * > On iOS, when using a HLS source, make sure that the uri contains `.m3u8` extension or that the [`contentType`](#contenttype) property of the [`VideoSource`](#videosource) has been set to `'hls'`. Otherwise, the video tracks will not be available.\n */\n availableVideoTracks: VideoTrack[];\n\n /**\n * Subtitle tracks available for the loaded video source.\n */\n availableSubtitleTracks: SubtitleTrack[];\n\n /**\n * Audio tracks available for the loaded video source.\n */\n availableAudioTracks: AudioTrack[];\n};\n\ntype AudioTrackChangeEventPayload = {\n /**\n * New audio track of the player.\n */\n audioTrack: AudioTrack | null;\n\n /**\n * Previous audio track of the player.\n */\n oldAudioTrack?: AudioTrack | null;\n};\n\ntype AvailableAudioTracksChangeEventPayload = {\n /**\n * Array of available audio tracks.\n */\n availableAudioTracks: AudioTrack[];\n\n /**\n * Previous array of available audio tracks.\n */\n oldAvailableAudioTracks?: AudioTrack[];\n};\n"]}
@@ -0,0 +1,29 @@
1
+ import { SharedRef } from 'expo';
2
+ /**
3
+ * Represents a video thumbnail that references a native image.
4
+ * Instances of this class can be passed as a source to the `Image` component from `expo-image`.
5
+ * @platform android
6
+ * @platform ios
7
+ */
8
+ export declare class VideoThumbnail extends SharedRef<'image'> {
9
+ /**
10
+ * Width of the created thumbnail.
11
+ */
12
+ width: number;
13
+ /**
14
+ * Height of the created thumbnail.
15
+ */
16
+ height: number;
17
+ /**
18
+ * The time in seconds at which the thumbnail was to be created.
19
+ */
20
+ requestedTime: number;
21
+ /**
22
+ * The time in seconds at which the thumbnail was actually generated.
23
+ * @platform ios
24
+ */
25
+ actualTime: number;
26
+ }
27
+ declare const _default: typeof VideoThumbnail;
28
+ export default _default;
29
+ //# sourceMappingURL=VideoThumbnail.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VideoThumbnail.d.ts","sourceRoot":"","sources":["../src/VideoThumbnail.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAIjC;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,SAAS,CAAC,OAAO,CAAC;IAC5D;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;;AAED,wBAAgD"}
@@ -0,0 +1,3 @@
1
+ import NativeVideoModule from './NativeVideoModule';
2
+ export default NativeVideoModule.VideoThumbnail;
3
+ //# sourceMappingURL=VideoThumbnail.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VideoThumbnail.js","sourceRoot":"","sources":["../src/VideoThumbnail.ts"],"names":[],"mappings":"AAEA,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AA4BpD,eAAe,iBAAiB,CAAC,cAAc,CAAC","sourcesContent":["import { SharedRef } from 'expo';\n\nimport NativeVideoModule from './NativeVideoModule';\n\n/**\n * Represents a video thumbnail that references a native image.\n * Instances of this class can be passed as a source to the `Image` component from `expo-image`.\n * @platform android\n * @platform ios\n */\nexport declare class VideoThumbnail extends SharedRef<'image'> {\n /**\n * Width of the created thumbnail.\n */\n width: number;\n /**\n * Height of the created thumbnail.\n */\n height: number;\n /**\n * The time in seconds at which the thumbnail was to be created.\n */\n requestedTime: number;\n /**\n * The time in seconds at which the thumbnail was actually generated.\n * @platform ios\n */\n actualTime: number;\n}\n\nexport default NativeVideoModule.VideoThumbnail;\n"]}
@@ -0,0 +1,44 @@
1
+ import { ReactNode, PureComponent } from 'react';
2
+ import type { VideoViewProps } from './VideoView.types';
3
+ /**
4
+ * Returns whether the current device supports Picture in Picture (PiP) mode.
5
+ *
6
+ * > **Note:** All major web browsers support Picture in Picture (PiP) mode except Firefox.
7
+ * > For more information, see [MDN web docs](https://developer.mozilla.org/en-US/docs/Web/API/Picture-in-Picture_API#browser_compatibility).
8
+ * @returns A `boolean` which is `true` if the device supports PiP mode, and `false` otherwise.
9
+ * @platform android
10
+ * @platform ios
11
+ * @platform web
12
+ */
13
+ export declare function isPictureInPictureSupported(): boolean;
14
+ export declare class VideoView extends PureComponent<VideoViewProps> {
15
+ nativeRef: import("react").RefObject<any>;
16
+ /**
17
+ * Enters fullscreen mode.
18
+ */
19
+ enterFullscreen(): Promise<void>;
20
+ /**
21
+ * Exits fullscreen mode.
22
+ */
23
+ exitFullscreen(): Promise<void>;
24
+ /**
25
+ * Enters Picture in Picture (PiP) mode. Throws an exception if the device does not support PiP.
26
+ * > **Note:** Only one player can be in Picture in Picture (PiP) mode at a time.
27
+ *
28
+ * > **Note:** The `supportsPictureInPicture` property of the [config plugin](#configuration-in-app-config)
29
+ * > has to be configured for the PiP to work.
30
+ * @platform android
31
+ * @platform ios
32
+ * @platform web
33
+ */
34
+ startPictureInPicture(): Promise<void>;
35
+ /**
36
+ * Exits Picture in Picture (PiP) mode.
37
+ * @platform android
38
+ * @platform ios
39
+ * @platform web
40
+ */
41
+ stopPictureInPicture(): Promise<void>;
42
+ render(): ReactNode;
43
+ }
44
+ //# sourceMappingURL=VideoView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VideoView.d.ts","sourceRoot":"","sources":["../src/VideoView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAa,MAAM,OAAO,CAAC;AAK5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,IAAI,OAAO,CAErD;AAED,qBAAa,SAAU,SAAQ,aAAa,CAAC,cAAc,CAAC;IAC1D,SAAS,iCAAoB;IAE7B;;OAEG;IACG,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAItC;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAIrC;;;;;;;;;OASG;IACG,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5C;;;;;OAKG;IACG,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3C,MAAM,IAAI,SAAS;CASpB"}
@@ -0,0 +1,76 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { PureComponent, createRef } from 'react';
3
+ import NativeVideoModule from './NativeVideoModule';
4
+ import NativeVideoView, { NativeTextureVideoView } from './NativeVideoView';
5
+ /**
6
+ * Returns whether the current device supports Picture in Picture (PiP) mode.
7
+ *
8
+ * > **Note:** All major web browsers support Picture in Picture (PiP) mode except Firefox.
9
+ * > For more information, see [MDN web docs](https://developer.mozilla.org/en-US/docs/Web/API/Picture-in-Picture_API#browser_compatibility).
10
+ * @returns A `boolean` which is `true` if the device supports PiP mode, and `false` otherwise.
11
+ * @platform android
12
+ * @platform ios
13
+ * @platform web
14
+ */
15
+ export function isPictureInPictureSupported() {
16
+ return NativeVideoModule.isPictureInPictureSupported();
17
+ }
18
+ export class VideoView extends PureComponent {
19
+ nativeRef = createRef();
20
+ /**
21
+ * Enters fullscreen mode.
22
+ */
23
+ async enterFullscreen() {
24
+ return await this.nativeRef.current?.enterFullscreen();
25
+ }
26
+ /**
27
+ * Exits fullscreen mode.
28
+ */
29
+ async exitFullscreen() {
30
+ return await this.nativeRef.current?.exitFullscreen();
31
+ }
32
+ /**
33
+ * Enters Picture in Picture (PiP) mode. Throws an exception if the device does not support PiP.
34
+ * > **Note:** Only one player can be in Picture in Picture (PiP) mode at a time.
35
+ *
36
+ * > **Note:** The `supportsPictureInPicture` property of the [config plugin](#configuration-in-app-config)
37
+ * > has to be configured for the PiP to work.
38
+ * @platform android
39
+ * @platform ios
40
+ * @platform web
41
+ */
42
+ async startPictureInPicture() {
43
+ return await this.nativeRef.current?.startPictureInPicture();
44
+ }
45
+ /**
46
+ * Exits Picture in Picture (PiP) mode.
47
+ * @platform android
48
+ * @platform ios
49
+ * @platform web
50
+ */
51
+ async stopPictureInPicture() {
52
+ return await this.nativeRef.current?.stopPictureInPicture();
53
+ }
54
+ render() {
55
+ const { player, ...props } = this.props;
56
+ const playerId = getPlayerId(player);
57
+ if (NativeTextureVideoView && this.props.surfaceType === 'textureView') {
58
+ return _jsx(NativeTextureVideoView, { ...props, player: playerId, ref: this.nativeRef });
59
+ }
60
+ return _jsx(NativeVideoView, { ...props, player: playerId, ref: this.nativeRef });
61
+ }
62
+ }
63
+ // Temporary solution to pass the shared object ID instead of the player object.
64
+ // We can't really pass it as an object in the old architecture.
65
+ // Technically we can in the new architecture, but it's not possible yet.
66
+ function getPlayerId(player) {
67
+ if (player instanceof NativeVideoModule.VideoPlayer) {
68
+ // @ts-expect-error
69
+ return player.__expo_shared_object_id__;
70
+ }
71
+ if (typeof player === 'number') {
72
+ return player;
73
+ }
74
+ return null;
75
+ }
76
+ //# sourceMappingURL=VideoView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VideoView.js","sourceRoot":"","sources":["../src/VideoView.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAa,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5D,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AACpD,OAAO,eAAe,EAAE,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAI5E;;;;;;;;;GASG;AACH,MAAM,UAAU,2BAA2B;IACzC,OAAO,iBAAiB,CAAC,2BAA2B,EAAE,CAAC;AACzD,CAAC;AAED,MAAM,OAAO,SAAU,SAAQ,aAA6B;IAC1D,SAAS,GAAG,SAAS,EAAO,CAAC;IAE7B;;OAEG;IACH,KAAK,CAAC,eAAe;QACnB,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,eAAe,EAAE,CAAC;IACzD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,cAAc;QAClB,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,cAAc,EAAE,CAAC;IACxD,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,qBAAqB;QACzB,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,qBAAqB,EAAE,CAAC;IAC/D,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,oBAAoB;QACxB,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,oBAAoB,EAAE,CAAC;IAC9D,CAAC;IAED,MAAM;QACJ,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QACxC,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;QAErC,IAAI,sBAAsB,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW,KAAK,aAAa,EAAE,CAAC;YACvE,OAAO,KAAC,sBAAsB,OAAK,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI,CAAC,SAAS,GAAI,CAAC;QACtF,CAAC;QACD,OAAO,KAAC,eAAe,OAAK,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI,CAAC,SAAS,GAAI,CAAC;IAC/E,CAAC;CACF;AAED,gFAAgF;AAChF,gEAAgE;AAChE,yEAAyE;AACzE,SAAS,WAAW,CAAC,MAA4B;IAC/C,IAAI,MAAM,YAAY,iBAAiB,CAAC,WAAW,EAAE,CAAC;QACpD,mBAAmB;QACnB,OAAO,MAAM,CAAC,yBAAyB,CAAC;IAC1C,CAAC;IACD,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { ReactNode, PureComponent, createRef } from 'react';\n\nimport NativeVideoModule from './NativeVideoModule';\nimport NativeVideoView, { NativeTextureVideoView } from './NativeVideoView';\nimport type { VideoPlayer } from './VideoPlayer.types';\nimport type { VideoViewProps } from './VideoView.types';\n\n/**\n * Returns whether the current device supports Picture in Picture (PiP) mode.\n *\n * > **Note:** All major web browsers support Picture in Picture (PiP) mode except Firefox.\n * > For more information, see [MDN web docs](https://developer.mozilla.org/en-US/docs/Web/API/Picture-in-Picture_API#browser_compatibility).\n * @returns A `boolean` which is `true` if the device supports PiP mode, and `false` otherwise.\n * @platform android\n * @platform ios\n * @platform web\n */\nexport function isPictureInPictureSupported(): boolean {\n return NativeVideoModule.isPictureInPictureSupported();\n}\n\nexport class VideoView extends PureComponent<VideoViewProps> {\n nativeRef = createRef<any>();\n\n /**\n * Enters fullscreen mode.\n */\n async enterFullscreen(): Promise<void> {\n return await this.nativeRef.current?.enterFullscreen();\n }\n\n /**\n * Exits fullscreen mode.\n */\n async exitFullscreen(): Promise<void> {\n return await this.nativeRef.current?.exitFullscreen();\n }\n\n /**\n * Enters Picture in Picture (PiP) mode. Throws an exception if the device does not support PiP.\n * > **Note:** Only one player can be in Picture in Picture (PiP) mode at a time.\n *\n * > **Note:** The `supportsPictureInPicture` property of the [config plugin](#configuration-in-app-config)\n * > has to be configured for the PiP to work.\n * @platform android\n * @platform ios\n * @platform web\n */\n async startPictureInPicture(): Promise<void> {\n return await this.nativeRef.current?.startPictureInPicture();\n }\n\n /**\n * Exits Picture in Picture (PiP) mode.\n * @platform android\n * @platform ios\n * @platform web\n */\n async stopPictureInPicture(): Promise<void> {\n return await this.nativeRef.current?.stopPictureInPicture();\n }\n\n render(): ReactNode {\n const { player, ...props } = this.props;\n const playerId = getPlayerId(player);\n\n if (NativeTextureVideoView && this.props.surfaceType === 'textureView') {\n return <NativeTextureVideoView {...props} player={playerId} ref={this.nativeRef} />;\n }\n return <NativeVideoView {...props} player={playerId} ref={this.nativeRef} />;\n }\n}\n\n// Temporary solution to pass the shared object ID instead of the player object.\n// We can't really pass it as an object in the old architecture.\n// Technically we can in the new architecture, but it's not possible yet.\nfunction getPlayerId(player: number | VideoPlayer): number | null {\n if (player instanceof NativeVideoModule.VideoPlayer) {\n // @ts-expect-error\n return player.__expo_shared_object_id__;\n }\n if (typeof player === 'number') {\n return player;\n }\n return null;\n}\n"]}
@@ -0,0 +1,147 @@
1
+ import { ViewProps } from 'react-native';
2
+ import type { VideoPlayer } from './VideoPlayer.types';
3
+ /**
4
+ * Describes how a video should be scaled to fit in a container.
5
+ * - `contain`: The video maintains its aspect ratio and fits inside the container, with possible letterboxing/pillarboxing.
6
+ * - `cover`: The video maintains its aspect ratio and covers the entire container, potentially cropping some portions.
7
+ * - `fill`: The video stretches/squeezes to completely fill the container, potentially causing distortion.
8
+ */
9
+ export type VideoContentFit = 'contain' | 'cover' | 'fill';
10
+ /**
11
+ * Describes the type of the surface used to render the video.
12
+ * - `surfaceView`: Uses the `SurfaceView` to render the video. This value should be used in the majority of cases. Provides significantly lower power consumption, better performance, and more features.
13
+ * - `textureView`: Uses the `TextureView` to render the video. Should be used in cases where the SurfaceView is not supported or causes issues (for example, overlapping video views).
14
+ *
15
+ * You can learn more about surface types in the official [ExoPlayer documentation](https://developer.android.com/media/media3/ui/playerview#surfacetype).
16
+ * @platform android
17
+ */
18
+ export type SurfaceType = 'textureView' | 'surfaceView';
19
+ export interface VideoViewProps extends ViewProps {
20
+ /**
21
+ * A video player instance. Use [`useVideoPlayer()`](#usevideoplayersource-setup) hook to create one.
22
+ */
23
+ player: VideoPlayer;
24
+ /**
25
+ * Determines whether native controls should be displayed or not.
26
+ * @default true
27
+ */
28
+ nativeControls?: boolean;
29
+ /**
30
+ * Describes how the video should be scaled to fit in the container.
31
+ * Options are `'contain'`, `'cover'`, and `'fill'`.
32
+ * @default 'contain'
33
+ */
34
+ contentFit?: VideoContentFit;
35
+ /**
36
+ * Determines whether fullscreen mode is allowed or not.
37
+ * @default true
38
+ */
39
+ allowsFullscreen?: boolean;
40
+ /**
41
+ * Determines whether the timecodes should be displayed or not.
42
+ * @default true
43
+ * @platform ios
44
+ */
45
+ showsTimecodes?: boolean;
46
+ /**
47
+ * Determines whether the player allows the user to skip media content.
48
+ * @default false
49
+ * @platform android
50
+ * @platform ios
51
+ */
52
+ requiresLinearPlayback?: boolean;
53
+ /**
54
+ * Determines the type of the surface used to render the video.
55
+ * > This prop should not be changed at runtime.
56
+ * @default 'surfaceView'
57
+ * @platform android
58
+ */
59
+ surfaceType?: SurfaceType;
60
+ /**
61
+ * Determines the position offset of the video inside the container.
62
+ * @default { dx: 0, dy: 0 }
63
+ * @platform ios
64
+ */
65
+ contentPosition?: {
66
+ dx?: number;
67
+ dy?: number;
68
+ };
69
+ /**
70
+ * A callback to call after the video player enters Picture in Picture (PiP) mode.
71
+ * @platform android
72
+ * @platform ios
73
+ * @platform web
74
+ */
75
+ onPictureInPictureStart?: () => void;
76
+ /**
77
+ * A callback to call after the video player exits Picture in Picture (PiP) mode.
78
+ * @platform android
79
+ * @platform ios
80
+ * @platform web
81
+ */
82
+ onPictureInPictureStop?: () => void;
83
+ /**
84
+ * Determines whether the player allows Picture in Picture (PiP) mode.
85
+ * > **Note:** The `supportsPictureInPicture` property of the [config plugin](#configuration-in-app-config)
86
+ * > has to be configured for the PiP to work.
87
+ * @platform android
88
+ * @platform ios
89
+ * @platform web
90
+ */
91
+ allowsPictureInPicture?: boolean;
92
+ /**
93
+ * Determines whether a video should be played "inline", that is, within the element's playback area.
94
+ * @platform web
95
+ */
96
+ playsInline?: boolean;
97
+ /**
98
+ * Determines whether the player should start Picture in Picture (PiP) automatically when the app is in the background.
99
+ * > **Note:** Only one player can be in Picture in Picture (PiP) mode at a time.
100
+ *
101
+ * > **Note:** The `supportsPictureInPicture` property of the [config plugin](#configuration-in-app-config)
102
+ * > has to be configured for the PiP to work.
103
+ *
104
+ * @default false
105
+ * @platform android 12+
106
+ * @platform ios
107
+ */
108
+ startsPictureInPictureAutomatically?: boolean;
109
+ /**
110
+ * Specifies whether to perform video frame analysis (Live Text in videos).
111
+ * Check official [Apple documentation](https://developer.apple.com/documentation/avkit/avplayerviewcontroller/allowsvideoframeanalysis) for more details.
112
+ * @default true
113
+ * @platform ios 16.0+
114
+ */
115
+ allowsVideoFrameAnalysis?: boolean;
116
+ /**
117
+ * A callback to call after the video player enters fullscreen mode.
118
+ */
119
+ onFullscreenEnter?: () => void;
120
+ /**
121
+ * A callback to call after the video player exits fullscreen mode.
122
+ */
123
+ onFullscreenExit?: () => void;
124
+ /**
125
+ * A callback to call after the mounted `VideoPlayer` has rendered the first frame into the `VideoView`.
126
+ * This event can be used to hide any cover images that conceal the initial loading of the player.
127
+ * > **Note:** This event may also be called during playback when the current video track changes (for example when the player switches video quality).
128
+ */
129
+ onFirstFrameRender?: () => void;
130
+ /**
131
+ * Determines whether the player should use the default ExoPlayer shutter that covers the `VideoView` before the first video frame is rendered.
132
+ * Setting this property to `false` makes the Android behavior the same as iOS.
133
+ *
134
+ * @platform android
135
+ * @default false
136
+ */
137
+ useExoShutter?: boolean;
138
+ /**
139
+ * Determines the [cross origin policy](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/crossorigin) used by the underlying native view on web.
140
+ * If undefined, does not use CORS at all.
141
+ *
142
+ * @platform web
143
+ * @default undefined
144
+ */
145
+ crossOrigin?: 'anonymous' | 'use-credentials';
146
+ }
147
+ //# sourceMappingURL=VideoView.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VideoView.types.d.ts","sourceRoot":"","sources":["../src/VideoView.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AAE3D;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG,aAAa,CAAC;AAExD,MAAM,WAAW,cAAe,SA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":3,"file":"VideoView.types.js","sourceRoot":"","sources":["../src/VideoView.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ViewProps } from 'react-native';\n\nimport type { VideoPlayer } from './VideoPlayer.types';\n\n/**\n * Describes how a video should be scaled to fit in a container.\n * - `contain`: The video maintains its aspect ratio and fits inside the container, with possible letterboxing/pillarboxing.\n * - `cover`: The video maintains its aspect ratio and covers the entire container, potentially cropping some portions.\n * - `fill`: The video stretches/squeezes to completely fill the container, potentially causing distortion.\n */\nexport type VideoContentFit = 'contain' | 'cover' | 'fill';\n\n/**\n * Describes the type of the surface used to render the video.\n * - `surfaceView`: Uses the `SurfaceView` to render the video. This value should be used in the majority of cases. Provides significantly lower power consumption, better performance, and more features.\n * - `textureView`: Uses the `TextureView` to render the video. Should be used in cases where the SurfaceView is not supported or causes issues (for example, overlapping video views).\n *\n * You can learn more about surface types in the official [ExoPlayer documentation](https://developer.android.com/media/media3/ui/playerview#surfacetype).\n * @platform android\n */\nexport type SurfaceType = 'textureView' | 'surfaceView';\n\nexport interface VideoViewProps extends ViewProps {\n /**\n * A video player instance. Use [`useVideoPlayer()`](#usevideoplayersource-setup) hook to create one.\n */\n player: VideoPlayer;\n\n /**\n * Determines whether native controls should be displayed or not.\n * @default true\n */\n nativeControls?: boolean;\n\n /**\n * Describes how the video should be scaled to fit in the container.\n * Options are `'contain'`, `'cover'`, and `'fill'`.\n * @default 'contain'\n */\n contentFit?: VideoContentFit;\n\n /**\n * Determines whether fullscreen mode is allowed or not.\n * @default true\n */\n allowsFullscreen?: boolean;\n\n /**\n * Determines whether the timecodes should be displayed or not.\n * @default true\n * @platform ios\n */\n showsTimecodes?: boolean;\n\n /**\n * Determines whether the player allows the user to skip media content.\n * @default false\n * @platform android\n * @platform ios\n */\n requiresLinearPlayback?: boolean;\n\n /**\n * Determines the type of the surface used to render the video.\n * > This prop should not be changed at runtime.\n * @default 'surfaceView'\n * @platform android\n */\n surfaceType?: SurfaceType;\n\n /**\n * Determines the position offset of the video inside the container.\n * @default { dx: 0, dy: 0 }\n * @platform ios\n */\n contentPosition?: { dx?: number; dy?: number };\n\n /**\n * A callback to call after the video player enters Picture in Picture (PiP) mode.\n * @platform android\n * @platform ios\n * @platform web\n */\n onPictureInPictureStart?: () => void;\n\n /**\n * A callback to call after the video player exits Picture in Picture (PiP) mode.\n * @platform android\n * @platform ios\n * @platform web\n */\n onPictureInPictureStop?: () => void;\n\n /**\n * Determines whether the player allows Picture in Picture (PiP) mode.\n * > **Note:** The `supportsPictureInPicture` property of the [config plugin](#configuration-in-app-config)\n * > has to be configured for the PiP to work.\n * @platform android\n * @platform ios\n * @platform web\n */\n allowsPictureInPicture?: boolean;\n\n /**\n * Determines whether a video should be played \"inline\", that is, within the element's playback area.\n * @platform web\n */\n playsInline?: boolean;\n\n /**\n * Determines whether the player should start Picture in Picture (PiP) automatically when the app is in the background.\n * > **Note:** Only one player can be in Picture in Picture (PiP) mode at a time.\n *\n * > **Note:** The `supportsPictureInPicture` property of the [config plugin](#configuration-in-app-config)\n * > has to be configured for the PiP to work.\n *\n * @default false\n * @platform android 12+\n * @platform ios\n */\n startsPictureInPictureAutomatically?: boolean;\n\n /**\n * Specifies whether to perform video frame analysis (Live Text in videos).\n * Check official [Apple documentation](https://developer.apple.com/documentation/avkit/avplayerviewcontroller/allowsvideoframeanalysis) for more details.\n * @default true\n * @platform ios 16.0+\n */\n allowsVideoFrameAnalysis?: boolean;\n\n /**\n * A callback to call after the video player enters fullscreen mode.\n */\n onFullscreenEnter?: () => void;\n\n /**\n * A callback to call after the video player exits fullscreen mode.\n */\n onFullscreenExit?: () => void;\n\n /**\n * A callback to call after the mounted `VideoPlayer` has rendered the first frame into the `VideoView`.\n * This event can be used to hide any cover images that conceal the initial loading of the player.\n * > **Note:** This event may also be called during playback when the current video track changes (for example when the player switches video quality).\n */\n onFirstFrameRender?: () => void;\n\n /**\n * Determines whether the player should use the default ExoPlayer shutter that covers the `VideoView` before the first video frame is rendered.\n * Setting this property to `false` makes the Android behavior the same as iOS.\n *\n * @platform android\n * @default false\n */\n useExoShutter?: boolean;\n\n /**\n * Determines the [cross origin policy](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/crossorigin) used by the underlying native view on web.\n * If undefined, does not use CORS at all.\n *\n * @platform web\n * @default undefined\n */\n crossOrigin?: 'anonymous' | 'use-credentials';\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import VideoPlayer from './VideoPlayer.web';
3
+ import type { VideoViewProps } from './VideoView.types';
4
+ export declare function isPictureInPictureSupported(): boolean;
5
+ export declare const VideoView: React.ForwardRefExoticComponent<{
6
+ player?: VideoPlayer;
7
+ } & VideoViewProps & React.RefAttributes<unknown>>;
8
+ export default VideoView;
9
+ //# sourceMappingURL=VideoView.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VideoView.web.d.ts","sourceRoot":"","sources":["../src/VideoView.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6D,MAAM,OAAO,CAAC;AAGlF,OAAO,WAA6B,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAsBxD,wBAAgB,2BAA2B,IAAI,OAAO,CAErD;AAED,eAAO,MAAM,SAAS;aAAiC,WAAW;kDAqLhE,CAAC;AAEH,eAAe,SAAS,CAAC"}