react-native-video: Error on use Video component

Bug

I have an youtube link, when I try using React-native-video components shows {"error": {"extra": -2147483648, "what": 1}} onError callback.

Platform

  • Android

Environment info

System: OS: Linux 5.3 Ubuntu 18.04.3 LTS (Bionic Beaver) CPU: (8) x64 Intel® Core™ i7-8565U CPU @ 1.80GHz Memory: 188.69 MB / 15.36 GB Shell: 4.4.20 - /bin/bash Binaries: Node: 12.14.0 - ~/.nvm/versions/node/v12.14.0/bin/node npm: 6.13.4 - ~/.nvm/versions/node/v12.14.0/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman npmPackages: react: 16.9.0 => 16.9.0 react-native: 0.61.5 => 0.61.5 npmGlobalPackages: react-native-cli: 2.0.1

Library version: x.x.x “react”: “16.9.0”, “react-native”: “0.61.5”, “react-native-video”: “^5.0.2”,

Code

import React, { memo } from 'react'
import { View } from 'react-native'
import Video from 'react-native-video'

function Preview() {
  
  const onError = (error) => {
    console.log('onError,', error)
  }
  
  const onBuffer = (onBuffer) => {
    console.log('onBuffer,', onBuffer)
  }
  
  const player = useRef()
  
  return (
    <View>
      <Video
        onError={onError}
        onBuffer={onBuffer} 
        source={{uri: "https://www.youtube.com/watch?v=9lnqVP2LJfc"}}
        ref={(ref) => {
          player.current = ref
        }}    
      />
    </View>
  )
}

export default memo(Preview)

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 6
  • Comments: 17

Most upvoted comments

I was able to get around this - it seems that without an extra configuration file to explicitly use Exoplayer the default player is used. I can’t find the issue where I found this work around but if I do I’ll link it back here.

Place this in your root directory for your app and name it react-native.config.js

module.exports = {
  dependencies: {
    'react-native-video': {
      platforms: {
        android: {
          sourceDir: '../node_modules/react-native-video/android-exoplayer',
       },
      },
    },
  },
};

I was able to get around this - it seems that without an extra configuration file to explicitly use Exoplayer the default player is used. I can’t find the issue where I found this work around but if I do I’ll link it back here.

Place this in your root directory for your app and name it react-native.config.js

module.exports = {
  dependencies: {
    'react-native-video': {
      platforms: {
        android: {
          sourceDir: '../node_modules/react-native-video/android-exoplayer',
       },
      },
    },
  },
};

Thanks @skullet! Worked for me as well.

I have found the issue, turns out exo and rate prop don’t get along well. It started working after removing it. Now it sometimes simply cannot download the file randomly, but when it does, it seems like it works fine.