TheWidlarzGroup / react-native-video-player

A video player for React Native with controls
MIT License
514 stars 315 forks source link

Video is empty in production build #151

Open franiakat opened 2 years ago

franiakat commented 2 years ago

I am using React Native with Typescript and I added VideoPlayer. In debug build it works properly, although the production build even though it's successful is not fully functional - the area of the player and controls are there, but no vide is shown, I can press play, but nothing happens, also, the duration is "00:00" instead of the duration count. I see no errors in the console, when I start as variant release, installation with adb does not change anything either. Could someone help me?

My package.json dependencies:

  "dependencies": {
    "@react-navigation/native": "^6.0.8",
    "@react-navigation/native-stack": "^6.5.0",
    "i18next": "^21.6.11",
    "react": "17.0.2",
    "react-i18next": "^11.15.4",
    "react-native": "0.67.2",
    "react-native-safe-area-context": "^3.3.2",
    "react-native-screens": "^3.13.1",
    "react-native-vector-icons": "^9.1.0",
    "react-native-video": "^5.2.0",
    "react-native-video-player": "^0.12.0"
  },

My component using VideoPlayer:

export const IntroVideo: React.FC<{
  navigation: NativeStackNavigationProp<RootStackParams>;
}> = ({navigation}) => {
  const {t} = useTranslation('', {keyPrefix: 'introVideo'});

  const onButtonPress = () => {
    navigation.navigate({name: 'Map', params: undefined});
  };

  return (
    <>
      <VideoPlayer
        video={{
          uri: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4',
        }}
        videoWidth={1600}
        videoHeight={800}
        autoplay
        showDuration
        pauseOnPress
      />
      <View style={styles.container}>
        <Button label={t('buttonLabel')} onPress={onButtonPress} />
      </View>
    </>
  );
};

My android/build.gradle:

allprojects {
    repositories {
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }
        mavenCentral {
            // We don't want to fetch react-native from Maven Central as there are
            // older versions over there.
            content {
                excludeGroup "com.facebook.react"
            }
        }
        google()
        maven { url 'https://www.jitpack.io' }
        mavenLocal()
        jcenter() {
            content {
                includeModule("com.yqritc", "android-scalablevideoview")
            }
        }
    }
}