[Solved] Video from static source doesn't load on Android!

#1

Hi! I recently started to implement a very simple video player for a view of my app. I need the videos to be bundled to the app, so added the code to cache the assets and the corresponding assetBundlePatterns on app.json.

I implemented the Video object in my app like this:

<Video
  source={require('../../assets/video.mp4')}
  rate={1.0}
  resizeMode="contain"
  shouldPlay
  isMuted
  isLooping
  style={videoStyles}
/>

With this code, I can watch the video on my iPhone device, but on Android just renders a blank rectangle.

This exact same code works if I load the video from uri:

<Video
   source={{
     uri: 'http://d23dyxeqlo5psv.cloudfront.net/big_buck_bunny.mp4',
   }}
  rate={1.0}
  resizeMode="contain"
  shouldPlay
  isMuted
  isLooping
  style={videoStyles}
/>

This is some of my package.json (created by CRNA and using Expo 25)

...
...
    "@expo/vector-icons": "^6.2.2",
    "expo": "^25.0.0",
    "prop-types": "^15.6.0",
    "react": "16.2.0",
    "react-native": "0.52.0",
...
...

Please take a look at the screenshots
iPhone:

Android:

#2

Well, despite having the same codec info than BigBuckBunny demo video, my videos didn’t load on Android, so I processed all of them using Handbrake with default Android preset and now works!

1 Like
closed #3

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.