@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,30 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <vector xmlns:android="http://schemas.android.com/apk/res/android"
3
+ android:width="24dp"
4
+ android:height="24dp"
5
+ android:viewportWidth="24"
6
+ android:viewportHeight="24">
7
+ <group
8
+ android:pivotX="12"
9
+ android:pivotY="4"
10
+ android:scaleX="1.15"
11
+ android:scaleY="1.15">
12
+ <group
13
+ android:pivotX="12"
14
+ android:pivotY="12"
15
+ android:scaleX="-1">
16
+ <path
17
+ android:fillColor="?android:attr/colorControlNormal"
18
+ android:pathData="M12,5V1L7,6l5,5V7c3.31,0 6,2.69 6,6s-2.69,6 -6,6 -6,-2.69 -6,-6H4c0,4.42 3.58,8 8,8s8,-3.58 8,-8 -3.58,-8 -8,-8z" />
19
+ </group>
20
+ <group
21
+ android:pivotX="0"
22
+ android:pivotY="10"
23
+ android:scaleX="1"
24
+ android:scaleY="0.9">
25
+ <path
26
+ android:fillColor="?android:attr/colorControlNormal"
27
+ android:pathData="m10.412 17.244h-0.70313v-4.4805q-0.25391 0.24219-0.66797 0.48438-0.41016 0.24219-0.73828 0.36328v-0.67969q0.58984-0.27734 1.0313-0.67188 0.44141-0.39453 0.625-0.76563h0.45313zm1.2008-2.8242q0-1.0156 0.20703-1.6328 0.21094-0.6211 0.6211-0.95703 0.41406-0.33594 1.0391-0.33594 0.46094 0 0.80859 0.1875 0.34766 0.18359 0.57422 0.53516 0.22656 0.34766 0.35547 0.85156 0.12891 0.5 0.12891 1.3516 0 1.0078-0.20703 1.6289-0.20703 0.61719-0.6211 0.95703-0.41016 0.33594-1.0391 0.33594-0.82813 0-1.3008-0.59375-0.56641-0.71484-0.56641-2.3281zm0.72266 0q0 1.4102 0.32812 1.8789 0.33203 0.46484 0.81641 0.46484 0.48438 0 0.8125-0.46875 0.33203-0.46875 0.33203-1.875 0-1.4141-0.33203-1.8789-0.32813-0.46484-0.82031-0.46484-0.48438 0-0.77344 0.41016-0.36328 0.52344-0.36328 1.9336z" />
28
+ </group>
29
+ </group>
30
+ </vector>
@@ -0,0 +1,31 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <vector xmlns:android="http://schemas.android.com/apk/res/android"
3
+ android:width="24dp"
4
+ android:height="24dp"
5
+ android:viewportWidth="24"
6
+ android:viewportHeight="24">
7
+ <group
8
+ android:pivotX="12"
9
+ android:pivotY="4"
10
+ android:scaleX="1.15"
11
+ android:scaleY="1.15">
12
+ <group
13
+ android:pivotX="12"
14
+ android:pivotY="12"
15
+ android:scaleX="-1">
16
+ <path
17
+ android:fillColor="?android:attr/colorControlNormal"
18
+ android:pathData="M12,5V1L7,6l5,5V7c3.31,0 6,2.69 6,6s-2.69,6 -6,6 -6,-2.69 -6,-6H4c0,4.42 3.58,8 8,8s8,-3.58 8,-8 -3.58,-8 -8,-8z" />
19
+ </group>
20
+ <group
21
+ android:pivotX="12"
22
+ android:pivotY="8"
23
+ android:scaleX="0.9"
24
+ android:scaleY="0.9">
25
+ <path
26
+ android:fillColor="?android:attr/colorControlNormal"
27
+ android:pathData="m10.412 17.244h-0.70313v-4.4805q-0.25391 0.24219-0.66797 0.48438-0.41016 0.24219-0.73828 0.36328v-0.67969q0.58984-0.27734 1.0313-0.67188 0.44141-0.39453 0.625-0.76563h0.45313zm1.2008-1.5 0.73828-0.0625q0.08203 0.53906 0.37891 0.8125 0.30078 0.26953 0.72266 0.26953 0.50781 0 0.85938-0.38281t0.35156-1.0156q0-0.60156-0.33984-0.94922-0.33594-0.34766-0.88281-0.34766-0.33984 0-0.61328 0.15625-0.27344 0.15234-0.42969 0.39844l-0.66016-0.08594 0.55469-2.9414h2.8477v0.67188h-2.2852l-0.30859 1.5391q0.51562-0.35938 1.082-0.35938 0.75 0 1.2656 0.51953 0.51562 0.51953 0.51562 1.3359 0 0.77734-0.45312 1.3438-0.55078 0.69531-1.5039 0.69531-0.78125 0-1.2773-0.4375-0.49219-0.4375-0.5625-1.1602z" />
28
+ </group>
29
+ </group>
30
+
31
+ </vector>
@@ -0,0 +1,30 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <vector xmlns:android="http://schemas.android.com/apk/res/android"
3
+ android:width="24dp"
4
+ android:height="24dp"
5
+ android:viewportWidth="24"
6
+ android:viewportHeight="24">
7
+ <group
8
+ android:pivotX="12"
9
+ android:pivotY="4"
10
+ android:scaleX="1.15"
11
+ android:scaleY="1.15">
12
+ <group
13
+ android:pivotX="12"
14
+ android:pivotY="12"
15
+ android:scaleX="-1">
16
+ <path
17
+ android:fillColor="?android:attr/colorControlNormal"
18
+ android:pathData="M12,5V1L7,6l5,5V7c3.31,0 6,2.69 6,6s-2.69,6 -6,6 -6,-2.69 -6,-6H4c0,4.42 3.58,8 8,8s8,-3.58 8,-8 -3.58,-8 -8,-8z" />
19
+ </group>
20
+ <group
21
+ android:pivotX="12"
22
+ android:pivotY="8"
23
+ android:scaleX="0.9"
24
+ android:scaleY="0.9">
25
+ <path
26
+ android:fillColor="?android:attr/colorControlNormal"
27
+ android:pathData="m 10.030088,16.051511 0.770367,-0.06521 q 0.08559,0.562491 0.395373,0.847811 0.313853,0.281245 0.754062,0.281245 0.529882,0 0.896723,-0.399449 0.366841,-0.39945 0.366841,-1.059764 0,-0.627706 -0.354612,-0.990471 -0.350538,-0.362765 -0.92118,-0.362765 -0.354613,0 -0.639933,0.163041 -0.285322,0.158964 -0.448362,0.415752 l -0.688846,-0.08967 0.578794,-3.069238 h 2.971413 v 0.701074 H 11.32626 l -0.322005,1.60595 q 0.538034,-0.374993 1.129056,-0.374993 0.782594,0 1.320628,0.54211 0.538034,0.542109 0.538034,1.393996 0,0.811127 -0.472817,1.402149 -0.574718,0.72553 -1.569266,0.72553 -0.815202,0 -1.332856,-0.456514 -0.513578,-0.456516 -0.586946,-1.210578 z" />
28
+ </group>
29
+ </group>
30
+ </vector>
@@ -0,0 +1,16 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+ xmlns:tools="http://schemas.android.com/tools"
4
+ android:id="@+id/enclosing_layout"
5
+ android:layout_width="match_parent"
6
+ android:layout_height="match_parent"
7
+ android:background="@android:color/black"
8
+ android:keepScreenOn="true"
9
+ tools:context=".FullscreenPlayerActivity">
10
+
11
+ <androidx.media3.ui.PlayerView
12
+ android:id="@+id/player_view"
13
+ android:layout_width="match_parent"
14
+ android:layout_height="match_parent" />
15
+
16
+ </FrameLayout>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <androidx.media3.ui.PlayerView xmlns:android="http://schemas.android.com/apk/res/android"
3
+ xmlns:app="http://schemas.android.com/apk/res-auto"
4
+ android:id="@+id/surface_player_view"
5
+ android:layout_width="match_parent"
6
+ android:layout_height="match_parent"
7
+ app:surface_type="surface_view" />
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <androidx.media3.ui.PlayerView xmlns:android="http://schemas.android.com/apk/res/android"
3
+ xmlns:app="http://schemas.android.com/apk/res-auto"
4
+ android:id="@+id/texture_player_view"
5
+ android:layout_width="match_parent"
6
+ android:layout_height="match_parent"
7
+ app:surface_type="texture_view" />
@@ -0,0 +1,9 @@
1
+ <resources>
2
+ <style name="Fullscreen" parent="Theme.AppCompat.Light.NoActionBar">
3
+ <item name="android:statusBarColor">@android:color/transparent</item>
4
+ <item name="android:windowActionBar">false</item>
5
+ <item name="android:windowTranslucentStatus">true</item>
6
+ <item name="android:windowTranslucentNavigation">true</item>
7
+ <item name="android:fitsSystemWindows">false</item>
8
+ </style>
9
+ </resources>
package/app.plugin.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./plugin/build/withExpoVideo');
@@ -0,0 +1,16 @@
1
+ import type { VideoPlayer } from './VideoPlayer.types';
2
+ import type { VideoThumbnail } from './VideoThumbnail';
3
+ type ExpoVideoModule = {
4
+ VideoPlayer: typeof VideoPlayer;
5
+ VideoThumbnail: typeof VideoThumbnail;
6
+ isPictureInPictureSupported(): boolean;
7
+ setVideoCacheSizeAsync(sizeBytes: number): Promise<void>;
8
+ clearVideoCacheAsync(): Promise<void>;
9
+ getCurrentVideoCacheSize(): number;
10
+ preCacheVideoPartialAsync(url: string, chunkSize?: number): Promise<boolean>;
11
+ preCacheVideoAsync(url: string): Promise<boolean>;
12
+ isVideoCachedAsync(url: string): Promise<boolean>;
13
+ };
14
+ declare const _default: ExpoVideoModule;
15
+ export default _default;
16
+ //# sourceMappingURL=NativeVideoModule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeVideoModule.d.ts","sourceRoot":"","sources":["../src/NativeVideoModule.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,KAAK,eAAe,GAAG;IACrB,WAAW,EAAE,OAAO,WAAW,CAAC;IAChC,cAAc,EAAE,OAAO,cAAc,CAAC;IAEtC,2BAA2B,IAAI,OAAO,CAAC;IACvC,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,wBAAwB,IAAI,MAAM,CAAC;IAEnC,yBAAyB,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7E,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAClD,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACnD,CAAC;;AAEF,wBAAiE"}
@@ -0,0 +1,3 @@
1
+ import { requireNativeModule } from 'expo-modules-core';
2
+ export default requireNativeModule('ExpoVideo');
3
+ //# sourceMappingURL=NativeVideoModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeVideoModule.js","sourceRoot":"","sources":["../src/NativeVideoModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAmBxD,eAAe,mBAAmB,CAAkB,WAAW,CAAC,CAAC","sourcesContent":["import { requireNativeModule } from 'expo-modules-core';\n\nimport type { VideoPlayer } from './VideoPlayer.types';\nimport type { VideoThumbnail } from './VideoThumbnail';\n\ntype ExpoVideoModule = {\n VideoPlayer: typeof VideoPlayer;\n VideoThumbnail: typeof VideoThumbnail;\n\n isPictureInPictureSupported(): boolean;\n setVideoCacheSizeAsync(sizeBytes: number): Promise<void>;\n clearVideoCacheAsync(): Promise<void>;\n getCurrentVideoCacheSize(): number;\n\n preCacheVideoPartialAsync(url: string, chunkSize?: number): Promise<boolean>;\n preCacheVideoAsync(url: string): Promise<boolean>;\n isVideoCachedAsync(url: string): Promise<boolean>;\n};\n\nexport default requireNativeModule<ExpoVideoModule>('ExpoVideo');\n"]}
@@ -0,0 +1,3 @@
1
+ declare const _default: () => void;
2
+ export default _default;
3
+ //# sourceMappingURL=NativeVideoModule.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeVideoModule.web.d.ts","sourceRoot":"","sources":["../src/NativeVideoModule.web.ts"],"names":[],"mappings":";AAAA,wBAAwB"}
@@ -0,0 +1,2 @@
1
+ export default () => { };
2
+ //# sourceMappingURL=NativeVideoModule.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeVideoModule.web.js","sourceRoot":"","sources":["../src/NativeVideoModule.web.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,GAAE,CAAC,CAAC","sourcesContent":["export default () => {};\n"]}
@@ -0,0 +1,4 @@
1
+ declare const _default: import("react").ComponentType<any>;
2
+ export default _default;
3
+ export declare const NativeTextureVideoView: import("react").ComponentType<any> | null;
4
+ //# sourceMappingURL=NativeVideoView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeVideoView.d.ts","sourceRoot":"","sources":["../src/NativeVideoView.ts"],"names":[],"mappings":";AAKA,wBAAsE;AACtE,eAAO,MAAM,sBAAsB,2CAC2D,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { requireNativeViewManager } from 'expo-modules-core';
2
+ import { Platform } from 'react-native';
3
+ const defaultViewName = Platform.OS === 'android' ? 'SurfaceVideoView' : 'VideoView';
4
+ export default requireNativeViewManager('ExpoVideo', defaultViewName);
5
+ export const NativeTextureVideoView = Platform.OS === 'android' ? requireNativeViewManager('ExpoVideo', 'TextureVideoView') : null;
6
+ //# sourceMappingURL=NativeVideoView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeVideoView.js","sourceRoot":"","sources":["../src/NativeVideoView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,MAAM,eAAe,GAAG,QAAQ,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,WAAW,CAAC;AAErF,eAAe,wBAAwB,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;AACtE,MAAM,CAAC,MAAM,sBAAsB,GACjC,QAAQ,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC,CAAC,wBAAwB,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC","sourcesContent":["import { requireNativeViewManager } from 'expo-modules-core';\nimport { Platform } from 'react-native';\n\nconst defaultViewName = Platform.OS === 'android' ? 'SurfaceVideoView' : 'VideoView';\n\nexport default requireNativeViewManager('ExpoVideo', defaultViewName);\nexport const NativeTextureVideoView =\n Platform.OS === 'android' ? requireNativeViewManager('ExpoVideo', 'TextureVideoView') : null;\n"]}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Returns whether the current device supports Picture in Picture (PiP) mode.
3
+ *
4
+ * @returns A `boolean` which is `true` if the device supports PiP mode, and `false` otherwise.
5
+ * @platform android
6
+ * @platform ios
7
+ */
8
+ export declare function isPictureInPictureSupported(): boolean;
9
+ /**
10
+ * Clears all video cache.
11
+ * > This function can be called only if there are no existing `VideoPlayer` instances.
12
+ *
13
+ * @returns A promise that fulfills after the cache has been cleaned.
14
+ * @platform android
15
+ * @platform ios
16
+ */
17
+ export declare function clearVideoCacheAsync(): Promise<void>;
18
+ /**
19
+ * Sets desired video cache size in bytes. The default video cache size is 1GB. Value set by this function is persistent.
20
+ * The cache size is not guaranteed to be exact and the actual cache size may be slightly larger. The cache is evicted on a least-recently-used basis.
21
+ * > This function can be called only if there are no existing `VideoPlayer` instances.
22
+ *
23
+ * @returns A promise that fulfills after the cache size has been set.
24
+ * @platform android
25
+ * @platform ios
26
+ */
27
+ export declare function setVideoCacheSizeAsync(sizeBytes: number): Promise<void>;
28
+ /**
29
+ * Returns the space currently occupied by the video cache in bytes.
30
+ *
31
+ * @platform android
32
+ * @platform ios
33
+ */
34
+ export declare function getCurrentVideoCacheSize(): number;
35
+ export declare function preCacheVideoAsync(url: string): Promise<boolean>;
36
+ export declare function preCacheVideoPartialAsync(url: string, chunkSize?: number): Promise<boolean>;
37
+ export declare function isVideoCachedAsync(url: string): Promise<boolean>;
38
+ //# sourceMappingURL=VideoModule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VideoModule.d.ts","sourceRoot":"","sources":["../src/VideoModule.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,2BAA2B,IAAI,OAAO,CAErD;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC,CAEpD;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEvE;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,CAEjD;AAED,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAEtE;AAED,wBAAsB,yBAAyB,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAEjG;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAEhE"}
@@ -0,0 +1,53 @@
1
+ import NativeVideoModule from './NativeVideoModule';
2
+ /**
3
+ * Returns whether the current device supports Picture in Picture (PiP) mode.
4
+ *
5
+ * @returns A `boolean` which is `true` if the device supports PiP mode, and `false` otherwise.
6
+ * @platform android
7
+ * @platform ios
8
+ */
9
+ export function isPictureInPictureSupported() {
10
+ return NativeVideoModule.isPictureInPictureSupported();
11
+ }
12
+ /**
13
+ * Clears all video cache.
14
+ * > This function can be called only if there are no existing `VideoPlayer` instances.
15
+ *
16
+ * @returns A promise that fulfills after the cache has been cleaned.
17
+ * @platform android
18
+ * @platform ios
19
+ */
20
+ export function clearVideoCacheAsync() {
21
+ return NativeVideoModule.clearVideoCacheAsync();
22
+ }
23
+ /**
24
+ * Sets desired video cache size in bytes. The default video cache size is 1GB. Value set by this function is persistent.
25
+ * The cache size is not guaranteed to be exact and the actual cache size may be slightly larger. The cache is evicted on a least-recently-used basis.
26
+ * > This function can be called only if there are no existing `VideoPlayer` instances.
27
+ *
28
+ * @returns A promise that fulfills after the cache size has been set.
29
+ * @platform android
30
+ * @platform ios
31
+ */
32
+ export function setVideoCacheSizeAsync(sizeBytes) {
33
+ return NativeVideoModule.setVideoCacheSizeAsync(sizeBytes);
34
+ }
35
+ /**
36
+ * Returns the space currently occupied by the video cache in bytes.
37
+ *
38
+ * @platform android
39
+ * @platform ios
40
+ */
41
+ export function getCurrentVideoCacheSize() {
42
+ return NativeVideoModule.getCurrentVideoCacheSize();
43
+ }
44
+ export async function preCacheVideoAsync(url) {
45
+ return NativeVideoModule.preCacheVideoAsync(url);
46
+ }
47
+ export async function preCacheVideoPartialAsync(url, chunkSize) {
48
+ return NativeVideoModule.preCacheVideoPartialAsync(url, chunkSize);
49
+ }
50
+ export function isVideoCachedAsync(url) {
51
+ return NativeVideoModule.isVideoCachedAsync(url);
52
+ }
53
+ //# sourceMappingURL=VideoModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VideoModule.js","sourceRoot":"","sources":["../src/VideoModule.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,UAAU,2BAA2B;IACzC,OAAO,iBAAiB,CAAC,2BAA2B,EAAE,CAAC;AACzD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO,iBAAiB,CAAC,oBAAoB,EAAE,CAAC;AAClD,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,sBAAsB,CAAC,SAAiB;IACtD,OAAO,iBAAiB,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC;AAC7D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB;IACtC,OAAO,iBAAiB,CAAC,wBAAwB,EAAE,CAAC;AACtD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,GAAW;IAClD,OAAO,iBAAiB,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,GAAW,EAAE,SAAkB;IAC7E,OAAO,iBAAiB,CAAC,yBAAyB,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;AACrE,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,GAAW;IAC5C,OAAO,iBAAiB,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC;AACnD,CAAC","sourcesContent":["import NativeVideoModule from './NativeVideoModule';\n\n/**\n * Returns whether the current device supports Picture in Picture (PiP) mode.\n *\n * @returns A `boolean` which is `true` if the device supports PiP mode, and `false` otherwise.\n * @platform android\n * @platform ios\n */\nexport function isPictureInPictureSupported(): boolean {\n return NativeVideoModule.isPictureInPictureSupported();\n}\n\n/**\n * Clears all video cache.\n * > This function can be called only if there are no existing `VideoPlayer` instances.\n *\n * @returns A promise that fulfills after the cache has been cleaned.\n * @platform android\n * @platform ios\n */\nexport function clearVideoCacheAsync(): Promise<void> {\n return NativeVideoModule.clearVideoCacheAsync();\n}\n\n/**\n * Sets desired video cache size in bytes. The default video cache size is 1GB. Value set by this function is persistent.\n * The cache size is not guaranteed to be exact and the actual cache size may be slightly larger. The cache is evicted on a least-recently-used basis.\n * > This function can be called only if there are no existing `VideoPlayer` instances.\n *\n * @returns A promise that fulfills after the cache size has been set.\n * @platform android\n * @platform ios\n */\nexport function setVideoCacheSizeAsync(sizeBytes: number): Promise<void> {\n return NativeVideoModule.setVideoCacheSizeAsync(sizeBytes);\n}\n\n/**\n * Returns the space currently occupied by the video cache in bytes.\n *\n * @platform android\n * @platform ios\n */\nexport function getCurrentVideoCacheSize(): number {\n return NativeVideoModule.getCurrentVideoCacheSize();\n}\n\nexport async function preCacheVideoAsync(url: string): Promise<boolean> {\n return NativeVideoModule.preCacheVideoAsync(url);\n}\n\nexport async function preCacheVideoPartialAsync(url: string, chunkSize?: number): Promise<boolean> {\n return NativeVideoModule.preCacheVideoPartialAsync(url, chunkSize);\n}\n\nexport function isVideoCachedAsync(url: string): Promise<boolean> {\n return NativeVideoModule.isVideoCachedAsync(url);\n}\n"]}
@@ -0,0 +1,15 @@
1
+ import { VideoSource, VideoPlayer } from './VideoPlayer.types';
2
+ /**
3
+ * Creates a direct instance of `VideoPlayer` that doesn't release automatically.
4
+ *
5
+ * > **info** For most use cases you should use the [`useVideoPlayer`](#usevideoplayer) hook instead. See the [Using the VideoPlayer Directly](#using-the-videoplayer-directly) section for more details.
6
+ * @param source
7
+ */
8
+ export declare function createVideoPlayer(source: VideoSource): VideoPlayer;
9
+ /**
10
+ * Creates a `VideoPlayer`, which will be automatically cleaned up when the component is unmounted.
11
+ * @param source - A video source that is used to initialize the player.
12
+ * @param setup - A function that allows setting up the player. It will run after the player is created.
13
+ */
14
+ export declare function useVideoPlayer(source: VideoSource, setup?: (player: VideoPlayer) => void): VideoPlayer;
15
+ //# sourceMappingURL=VideoPlayer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VideoPlayer.d.ts","sourceRoot":"","sources":["../src/VideoPlayer.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAsB/D;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CAElE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,WAAW,EACnB,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,GACpC,WAAW,CAQb"}
@@ -0,0 +1,52 @@
1
+ import { useReleasingSharedObject } from 'expo-modules-core';
2
+ import NativeVideoModule from './NativeVideoModule';
3
+ import resolveAssetSource from './resolveAssetSource';
4
+ // TODO: Temporary solution until we develop a way of overriding prototypes that won't break the lazy loading of the module.
5
+ const replace = NativeVideoModule.VideoPlayer.prototype.replace;
6
+ NativeVideoModule.VideoPlayer.prototype.replace = function (source, disableWarning = false) {
7
+ if (!disableWarning) {
8
+ console.warn('On iOS `VideoPlayer.replace` loads the asset data synchronously on the main thread, which can lead to UI freezes and will be deprecated in a future release. Switch to `replaceAsync` for better user experience.');
9
+ }
10
+ return replace.call(this, parseSource(source));
11
+ };
12
+ const replaceAsync = NativeVideoModule.VideoPlayer.prototype.replaceAsync;
13
+ NativeVideoModule.VideoPlayer.prototype.replaceAsync = function (source) {
14
+ return replaceAsync.call(this, parseSource(source));
15
+ };
16
+ /**
17
+ * Creates a direct instance of `VideoPlayer` that doesn't release automatically.
18
+ *
19
+ * > **info** For most use cases you should use the [`useVideoPlayer`](#usevideoplayer) hook instead. See the [Using the VideoPlayer Directly](#using-the-videoplayer-directly) section for more details.
20
+ * @param source
21
+ */
22
+ export function createVideoPlayer(source) {
23
+ return new NativeVideoModule.VideoPlayer(parseSource(source));
24
+ }
25
+ /**
26
+ * Creates a `VideoPlayer`, which will be automatically cleaned up when the component is unmounted.
27
+ * @param source - A video source that is used to initialize the player.
28
+ * @param setup - A function that allows setting up the player. It will run after the player is created.
29
+ */
30
+ export function useVideoPlayer(source, setup) {
31
+ const parsedSource = parseSource(source);
32
+ return useReleasingSharedObject(() => {
33
+ const player = new NativeVideoModule.VideoPlayer(parsedSource);
34
+ setup?.(player);
35
+ return player;
36
+ }, [JSON.stringify(parsedSource)]);
37
+ }
38
+ function parseSource(source) {
39
+ if (typeof source === 'number') {
40
+ // TODO(@kitten): This seems to not handle the `null` case. Is this correct?
41
+ return { uri: resolveAssetSource(source).uri };
42
+ }
43
+ else if (typeof source === 'string') {
44
+ return { uri: source };
45
+ }
46
+ if (typeof source?.assetId === 'number' && !source.uri) {
47
+ // TODO(@kitten): This seems to not handle the `null` case. Is this correct?
48
+ return { ...source, uri: resolveAssetSource(source.assetId).uri };
49
+ }
50
+ return source;
51
+ }
52
+ //# sourceMappingURL=VideoPlayer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VideoPlayer.js","sourceRoot":"","sources":["../src/VideoPlayer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AAEpD,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AAEtD,4HAA4H;AAC5H,MAAM,OAAO,GAAG,iBAAiB,CAAC,WAAW,CAAC,SAAS,CAAC,OAAO,CAAC;AAChE,iBAAiB,CAAC,WAAW,CAAC,SAAS,CAAC,OAAO,GAAG,UAChD,MAAmB,EACnB,iBAA0B,KAAK;IAE/B,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,OAAO,CAAC,IAAI,CACV,mNAAmN,CACpN,CAAC;IACJ,CAAC;IAED,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;AACjD,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,iBAAiB,CAAC,WAAW,CAAC,SAAS,CAAC,YAAY,CAAC;AAC1E,iBAAiB,CAAC,WAAW,CAAC,SAAS,CAAC,YAAY,GAAG,UAAU,MAAmB;IAClF,OAAO,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;AACtD,CAAC,CAAC;AACF;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAmB;IACnD,OAAO,IAAI,iBAAiB,CAAC,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;AAChE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAC5B,MAAmB,EACnB,KAAqC;IAErC,MAAM,YAAY,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IAEzC,OAAO,wBAAwB,CAAC,GAAG,EAAE;QACnC,MAAM,MAAM,GAAG,IAAI,iBAAiB,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;QAC/D,KAAK,EAAE,CAAC,MAAM,CAAC,CAAC;QAChB,OAAO,MAAM,CAAC;IAChB,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;AACrC,CAAC;AAED,SAAS,WAAW,CAAC,MAAmB;IACtC,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,4EAA4E;QAC5E,OAAO,EAAE,GAAG,EAAE,kBAAkB,CAAC,MAAM,CAAE,CAAC,GAAG,EAAE,CAAC;IAClD,CAAC;SAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QACtC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC;IACzB,CAAC;IAED,IAAI,OAAO,MAAM,EAAE,OAAO,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;QACvD,4EAA4E;QAC5E,OAAO,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,kBAAkB,CAAC,MAAM,CAAC,OAAO,CAAE,CAAC,GAAG,EAAE,CAAC;IACrE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { useReleasingSharedObject } from 'expo-modules-core';\n\nimport NativeVideoModule from './NativeVideoModule';\nimport { VideoSource, VideoPlayer } from './VideoPlayer.types';\nimport resolveAssetSource from './resolveAssetSource';\n\n// TODO: Temporary solution until we develop a way of overriding prototypes that won't break the lazy loading of the module.\nconst replace = NativeVideoModule.VideoPlayer.prototype.replace;\nNativeVideoModule.VideoPlayer.prototype.replace = function (\n source: VideoSource,\n disableWarning: boolean = false\n) {\n if (!disableWarning) {\n console.warn(\n 'On iOS `VideoPlayer.replace` loads the asset data synchronously on the main thread, which can lead to UI freezes and will be deprecated in a future release. Switch to `replaceAsync` for better user experience.'\n );\n }\n\n return replace.call(this, parseSource(source));\n};\n\nconst replaceAsync = NativeVideoModule.VideoPlayer.prototype.replaceAsync;\nNativeVideoModule.VideoPlayer.prototype.replaceAsync = function (source: VideoSource) {\n return replaceAsync.call(this, parseSource(source));\n};\n/**\n * Creates a direct instance of `VideoPlayer` that doesn't release automatically.\n *\n * > **info** For most use cases you should use the [`useVideoPlayer`](#usevideoplayer) hook instead. See the [Using the VideoPlayer Directly](#using-the-videoplayer-directly) section for more details.\n * @param source\n */\nexport function createVideoPlayer(source: VideoSource): VideoPlayer {\n return new NativeVideoModule.VideoPlayer(parseSource(source));\n}\n\n/**\n * Creates a `VideoPlayer`, which will be automatically cleaned up when the component is unmounted.\n * @param source - A video source that is used to initialize the player.\n * @param setup - A function that allows setting up the player. It will run after the player is created.\n */\nexport function useVideoPlayer(\n source: VideoSource,\n setup?: (player: VideoPlayer) => void\n): VideoPlayer {\n const parsedSource = parseSource(source);\n\n return useReleasingSharedObject(() => {\n const player = new NativeVideoModule.VideoPlayer(parsedSource);\n setup?.(player);\n return player;\n }, [JSON.stringify(parsedSource)]);\n}\n\nfunction parseSource(source: VideoSource): VideoSource {\n if (typeof source === 'number') {\n // TODO(@kitten): This seems to not handle the `null` case. Is this correct?\n return { uri: resolveAssetSource(source)!.uri };\n } else if (typeof source === 'string') {\n return { uri: source };\n }\n\n if (typeof source?.assetId === 'number' && !source.uri) {\n // TODO(@kitten): This seems to not handle the `null` case. Is this correct?\n return { ...source, uri: resolveAssetSource(source.assetId)!.uri };\n }\n return source;\n}\n"]}