@@ -25,14 +25,45 @@ export class ExpoVideoAdapter implements VideoPlayerAdapter {
2525 return ! ! ( this . expoVideoModule && this . expoVideoModule . VideoView ) ;
2626 }
2727
28+ getAvailabilityInfo ( ) : { isAvailable : boolean ; error ?: string ; installCommand ?: string ; packageName ?: string } {
29+ if ( ! this . expoVideoModule ) {
30+ return {
31+ isAvailable : false ,
32+ error : "ExpoVideoAdapter: Module not found. Please install expo-video to enable video playback functionality." ,
33+ installCommand : "npx expo install expo-video" ,
34+ packageName : "expo-video"
35+ } ;
36+ }
37+
38+ if ( ! this . expoVideoModule . VideoView ) {
39+ return {
40+ isAvailable : false ,
41+ error : "ExpoVideoAdapter: VideoView component not found in expo-video. Please ensure you have a compatible version installed." ,
42+ installCommand : "npx expo install expo-video" ,
43+ packageName : "expo-video"
44+ } ;
45+ }
46+
47+ if ( ! this . expoVideoModule . createVideoPlayer ) {
48+ return {
49+ isAvailable : false ,
50+ error : "ExpoVideoAdapter: createVideoPlayer function not found in expo-video. Please ensure you have a compatible version installed." ,
51+ installCommand : "npx expo install expo-video" ,
52+ packageName : "expo-video"
53+ } ;
54+ }
55+
56+ return { isAvailable : true } ;
57+ }
58+
2859 getAdapterName ( ) : string {
2960 return VideoPlayerType . EXPO_VIDEO ;
3061 }
3162
3263 renderVideo ( props : VideoPlayerProps , ref : RefObject < VideoPlayerRef | null > ) : ReactElement {
33-
34- if ( ! this . isAvailable ( ) ) {
35- throw new Error ( 'expo-video is not available' ) ;
64+ const availabilityInfo = this . getAvailabilityInfo ( ) ;
65+ if ( ! availabilityInfo . isAvailable ) {
66+ throw new Error ( ` ${ availabilityInfo . error } \n\nTo fix this issue, run: ${ availabilityInfo . installCommand } ` ) ;
3667 }
3768
3869 const { VideoView, createVideoPlayer } = this . expoVideoModule ;
0 commit comments