react-nativevideoexpo

React Native - Display Local Video


I am trying to display a local video in my React Native Expo app with controls for volume and video time. To do this, I have attempted to install the expo-av package. I have written import { Video } from "expo-av" at the top of my React Native file. This results in the error: Cannot find native module 'ExponentAV', js engine: hermes [Component Stack]. This error occurs without me having written any code to use the expo-video package.

Since this package was not working, I attempted to install the react-native-video package. However, this results in a similar error.


Solution

  • Use the react-native-video package:

    import Video from "react-native-video";
    
    <Video source = {{ "uri": exercise.video }} style = {{ "width": "100%", "height": 300 }} resizeMode = "contain" controls = {true} />
    

    Set the Video Source to the location of the video