react-native-video: Extremely slow on Android

Bug

Hi, I am using the version “react-native-video”: “^4.4.5” and it is extremely slow on android (+15seconds slower than in iOS). I am using the player with the basic capabilities to play remote videos from S3 (videos usually 5-20mb).

Platform

Android

Which player are you experiencing the problem on:

  • Android MediaPlayer

Environment info

React native info output:

System:
    OS: macOS 11.0.1
    CPU: (4) x64 Intel(R) Core(TM) i5-6360U CPU @ 2.00GHz
    Memory: 158.47 MB / 8.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 12.19.0 - /usr/local/bin/node
    Yarn: 1.19.2 - /usr/local/bin/yarn
    npm: 6.14.8 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.9.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.2, DriverKit 20.0, macOS 11.0, tvOS 14.2, watchOS 7.1
    Android SDK: Not Found
  IDEs:
    Android Studio: 3.6 AI-192.7142.36.36.6392135
    Xcode: 12.2/12B45b - /usr/bin/xcodebuild
  Languages:
    Java: 12.0.2 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.11.0 => 16.11.0 
    react-native: 0.62.2 => 0.62.2 
  npmGlobalPackages:
    *react-native*: Not Found

Library version: “^4.4.5”

Expected behaviour

  1. To load faster

Reproducible sample code

    <Video
      source={{ uri: uri }}
      resizeMode={"contain"}
      style={styles.container}
      controls={false}
      paused={false}
      repeat={true}
    />

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 22
  • Comments: 21 (5 by maintainers)

Most upvoted comments

This works for me: Add dependencies in react-native.config.js

module.exports = {
    project: {
        ios: {},
        android: {},
    },
    dependencies: {
        "react-native-video": {
            platforms: {
                android: {
                    sourceDir: "../node_modules/react-native-video/android-exoplayer",
                },
            },
        },
    },
    assets: ['./src/assets/fonts']
};

Also I recommend you to use progressive loading as in your current situation video file is not played until full load 5mb! But with bytes range loading video will start load after for example 200kb loaded and the rest bytes would be on the downloading way. So while playing new bytes would be added to the stream and there would be no delays.

can anyone help me?. i save video on firebase storage. when i load the video link on firebase storage very slow. IOS work well very fast. is that problem of exo player??

@frostyk That should be done on backend server that provide video file and could also support progressive video file stream. You can find more detailes here.