TheWidlarzGroup / react-native-video

A <Video /> component for react-native
https://docs.thewidlarzgroup.com/react-native-video/
MIT License
7.2k stars 2.9k forks source link

Can't reproduce videos on multiple tvOS versions -- Xcode error: AVPlayer:setpreventsDisplaySleepDuringVideoPlayback #2327

Closed sebastianpaz closed 2 years ago

sebastianpaz commented 3 years ago

Bug

I've been experiencing an iOS crash when trying to play a video on tvOS 11.4: the app crashes and Xcode returns an error (see attached images below). The error I'm getting is the same as the one described here. I'm using react-native-video: 5.1.1

Platform

Which player are you experiencing the problem on:

I'm using macOS Big Sur, where I'm practically unable to play videos, but apparently, this error happens much less when running the simulators on macOS Catalina.

Environment info

React native info output:

System:
    OS: macOS 11.1
    CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
    Memory: 131.90 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 12.11.1 - ~/.nvm/versions/node/v12.11.1/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.11.3 - ~/.nvm/versions/node/v12.11.1/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.0 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
    Android SDK:
      API Levels: 23, 28, 29
      Build Tools: 28.0.3, 29.0.2, 29.0.3
      System Images: android-25 | Google Play Intel x86 Atom, android-27 | Android TV Intel x86 Atom, android-29 | Android TV Intel x86 Atom, android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom, android-30 | Google Play Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.1 AI-201.8743.12.41.7199119
    Xcode: 12.4/12D4e - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_275 - /usr/bin/javac
    Python: 2.7.17 - /usr/local/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1
    react-native: Not Found
    react-native-macos: Not Found
    react-native-tvos:  0.63.4-0
  npmGlobalPackages:
    *react-native*: Not Found

react-native-video: 5.1.1

Steps To Reproduce

  1. Clone this repository (which basically is a blank react native project that just imports react-native-video and tries to play a video from a m3u8 file).
  2. npm install
  3. cd ios && pod install
  4. Launch tvOS 11.4 or any Android TV version.

Expected behaviour

The app plays the video in any tvOS version (>11) and Android TV.

Current behaviour

Reproducible sample code

Get to this repository (which basically is a blank react native project that just imports react-native-video and tries to play a video from a m3u8 file), or check my App.js file.

import React from 'react';
import {StyleSheet, View, Text} from 'react-native';
import Video from 'react-native-video';

const styles = StyleSheet.create({
  backgroundVideo: {
    position: 'absolute',
    top: 70,
    left: 10,
    height: 800,
    bottom: 10,
    borderColor: 'black',
    borderWidth: 1,
    right: 10,
  },
});

const App = () => {
  return (
    <View>
      <Text style={{fontSize: 72, color: 'black'}}>Video test</Text>
      <Video
        source={{
          uri: 'https://bitdash-a.akamaihd.net/content/MI201109210084_1/m3u8s/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.m3u8',
        }}
        hls
        resizeMode="contain"
        style={styles.backgroundVideo}
      />
    </View>
  );
};

export default App;

Video sample

Captura de Pantalla 2021-03-23 a la(s) 16 40 39 Captura de Pantalla 2021-03-23 a la(s) 16 40 51 Captura de Pantalla 2021-03-23 a la(s) 16 41 29

francoSimeone commented 3 years ago

I'm having the same issue