From 4cf176e05569c1d53b4f09c931d6d85ec2a6e7d5 Mon Sep 17 00:00:00 2001 From: jochem725 Date: Tue, 12 May 2020 12:16:35 +0200 Subject: [PATCH 01/16] Android changes --- README.md | 702 +++++++++++------- .../src/main/AndroidManifest.xml | 2 +- .../exoplayer/AspectRatioFrameLayout.java | 2 +- .../exoplayer/DataSourceUtil.java | 2 +- .../DefaultReactExoplayerConfig.java | 2 +- .../exoplayer/ExoPlayerCache.java | 2 +- .../exoplayer/ExoPlayerView.java | 2 +- .../exoplayer/ExoplayerCacheKeyFactory.java | 2 +- .../RawResourceDataSourceFactory.java | 2 +- .../exoplayer/ReactExoplayerConfig.java | 2 +- .../exoplayer/ReactExoplayerView.java | 8 +- .../exoplayer/ReactExoplayerViewManager.java | 2 +- .../exoplayer/ResizeMode.java | 2 +- .../exoplayer/VideoCache.java | 2 +- .../exoplayer/VideoEventEmitter.java | 2 +- .../react/ReactVideoPackage.java | 10 +- .../receiver/AudioBecomingNoisyReceiver.java | 2 +- .../receiver/BecomingNoisyListener.java | 2 +- android/src/main/AndroidManifest.xml | 2 +- .../react/ReactVideoPackage.java | 2 +- .../react/ReactVideoView.java | 2 +- .../react/ReactVideoViewManager.java | 4 +- .../java/com/videoplayer/MainApplication.java | 2 +- 23 files changed, 449 insertions(+), 313 deletions(-) rename android-exoplayer/src/main/java/com/{brentvatne => brentvatne_exp}/exoplayer/AspectRatioFrameLayout.java (99%) rename android-exoplayer/src/main/java/com/{brentvatne => brentvatne_exp}/exoplayer/DataSourceUtil.java (98%) rename android-exoplayer/src/main/java/com/{brentvatne => brentvatne_exp}/exoplayer/DefaultReactExoplayerConfig.java (95%) rename android-exoplayer/src/main/java/com/{brentvatne => brentvatne_exp}/exoplayer/ExoPlayerCache.java (99%) rename android-exoplayer/src/main/java/com/{brentvatne => brentvatne_exp}/exoplayer/ExoPlayerView.java (99%) rename android-exoplayer/src/main/java/com/{brentvatne => brentvatne_exp}/exoplayer/ExoplayerCacheKeyFactory.java (93%) rename android-exoplayer/src/main/java/com/{brentvatne => brentvatne_exp}/exoplayer/RawResourceDataSourceFactory.java (92%) rename android-exoplayer/src/main/java/com/{brentvatne => brentvatne_exp}/exoplayer/ReactExoplayerConfig.java (90%) rename android-exoplayer/src/main/java/com/{brentvatne => brentvatne_exp}/exoplayer/ReactExoplayerView.java (99%) rename android-exoplayer/src/main/java/com/{brentvatne => brentvatne_exp}/exoplayer/ReactExoplayerViewManager.java (99%) rename android-exoplayer/src/main/java/com/{brentvatne => brentvatne_exp}/exoplayer/ResizeMode.java (97%) rename android-exoplayer/src/main/java/com/{brentvatne => brentvatne_exp}/exoplayer/VideoCache.java (96%) rename android-exoplayer/src/main/java/com/{brentvatne => brentvatne_exp}/exoplayer/VideoEventEmitter.java (99%) rename android-exoplayer/src/main/java/com/{brentvatne => brentvatne_exp}/react/ReactVideoPackage.java (82%) rename android-exoplayer/src/main/java/com/{brentvatne => brentvatne_exp}/receiver/AudioBecomingNoisyReceiver.java (97%) rename android-exoplayer/src/main/java/com/{brentvatne => brentvatne_exp}/receiver/BecomingNoisyListener.java (86%) rename android/src/main/java/com/{brentvatne => brentvatne_exp}/react/ReactVideoPackage.java (96%) rename android/src/main/java/com/{brentvatne => brentvatne_exp}/react/ReactVideoView.java (99%) rename android/src/main/java/com/{brentvatne => brentvatne_exp}/react/ReactVideoViewManager.java (98%) diff --git a/README.md b/README.md index a1c7ebc989..622ac42131 100644 --- a/README.md +++ b/README.md @@ -14,28 +14,30 @@ Version 3.x requires react-native >= 0.40.0 Version 5 introduces breaking changes on Android, please check carefully the steps described there: [Android Installation](#Android-installation) ### Version 4.0.0 breaking changes -Version 4.0.0 changes some behaviors and may require updates to your Gradle files. See [Updating](#updating) for details. + +Version 4.0.0 changes some behaviors and may require updates to your Gradle files. See [Updating](#updating) for details. Version 4.0.0 now requires Android target SDK 26+ and Gradle 3 plugin in order to support ExoPlayer 2.9.0. Google is dropping support for apps using target SDKs older than 26 as of October 2018 and Gradle 2 as of January 2019. React Native 0.57 defaults to Gradle 3 & SDK 27. If you need to support an older React Native version, you should use react-native-video 3.2.1. ### Version 3.0.0 breaking changes + Version 3.0 features a number of changes to existing behavior. See [Updating](#updating) for changes. ## Table of Contents -* [Installation](#installation) - * [iOS](#ios-installation) - * [tvOS](#tvos-installation) - * [Android](#android-installation) - * [Windows](#windows-installation) - * [react-native-dom](#react-native-dom-installation) -* [Usage](#usage) -* [iOS App Transport Security](#ios-app-transport-security) -* [Audio Mixing](#audio-mixing) -* [Android Expansion File Usage](#android-expansion-file-usage) -* [Updating](#updating) +- [Installation](#installation) + - [iOS](#ios-installation) + - [tvOS](#tvos-installation) + - [Android](#android-installation) + - [Windows](#windows-installation) + - [react-native-dom](#react-native-dom-installation) +- [Usage](#usage) +- [iOS App Transport Security](#ios-app-transport-security) +- [Audio Mixing](#audio-mixing) +- [Android Expansion File Usage](#android-expansion-file-usage) +- [Updating](#updating) ## Installation @@ -54,6 +56,7 @@ yarn add react-native-video Then follow the instructions for your platform to link react-native-video into your project: ### iOS installation +
iOS details @@ -69,7 +72,7 @@ Run `react-native link react-native-video` to link the react-native-video librar #### Using CocoaPods (required to enable caching) -Setup your Podfile like it is described in the [react-native documentation](https://facebook.github.io/react-native/docs/integration-with-existing-apps#configuring-cocoapods-dependencies). +Setup your Podfile like it is described in the [react-native documentation](https://facebook.github.io/react-native/docs/integration-with-existing-apps#configuring-cocoapods-dependencies). Depending on your requirements you have to choose between the two possible subpodspecs: @@ -92,6 +95,7 @@ end
### tvOS installation +
tvOS details @@ -115,6 +119,7 @@ Select RCTVideo-tvOS
### Android installation +
Android details @@ -166,7 +171,7 @@ android.enableJetifier=true On top, where imports are: ```java -import com.brentvatne.react.ReactVideoPackage; +import com.brentvatne_exp.react.ReactVideoPackage; ``` Add the `ReactVideoPackage` class to your list of exported packages. @@ -180,9 +185,11 @@ protected List getPackages() { ); } ``` +
### Windows installation +
Windows details @@ -194,20 +201,23 @@ Add the `ReactNativeVideo` project to your solution. 1. Open the solution in Visual Studio 2015 2. Right-click Solution icon in Solution Explorer > Add > Existing Project - * UWP: Select `node_modules\react-native-video\windows\ReactNativeVideo\ReactNativeVideo.csproj` - * WPF: Select `node_modules\react-native-video\windows\ReactNativeVideo.Net46\ReactNativeVideo.Net46.csproj` + +- UWP: Select `node_modules\react-native-video\windows\ReactNativeVideo\ReactNativeVideo.csproj` +- WPF: Select `node_modules\react-native-video\windows\ReactNativeVideo.Net46\ReactNativeVideo.Net46.csproj` #### **windows/myapp/myapp.csproj** Add a reference to `ReactNativeVideo` to your main application project. From Visual Studio 2015: 1. Right-click main application project > Add > Reference... - * UWP: Check `ReactNativeVideo` from Solution Projects. - * WPF: Check `ReactNativeVideo.Net46` from Solution Projects. + +- UWP: Check `ReactNativeVideo` from Solution Projects. +- WPF: Check `ReactNativeVideo.Net46` from Solution Projects. #### **MainPage.cs** Add the `ReactVideoPackage` class to your list of exported packages. + ```cs using ReactNative; using ReactNative.Modules.Core; @@ -230,9 +240,11 @@ using System.Collections.Generic; ... ``` +
### react-native-dom installation +
react-native-dom details @@ -245,7 +257,7 @@ Import RCTVideoManager and add it to the list of nativeModules: ```javascript import { RNDomInstance } from "react-native-dom"; import { name as appName } from "../app.json"; -import RCTVideoManager from 'react-native-video/dom/RCTVideoManager'; // Add this +import RCTVideoManager from "react-native-video/dom/RCTVideoManager"; // Add this // Path to RN Bundle Entrypoint ================================================ const rnBundlePath = "./entry.bundle?platform=dom&dev=true"; @@ -253,9 +265,10 @@ const rnBundlePath = "./entry.bundle?platform=dom&dev=true"; // React Native DOM Runtime Options ============================================= const ReactNativeDomOptions = { enableHotReload: false, - nativeModules: [RCTVideoManager] // Add this + nativeModules: [RCTVideoManager], // Add this }; ``` +
## Usage @@ -263,24 +276,26 @@ const ReactNativeDomOptions = { ```javascript // Load the module -import Video from 'react-native-video'; +import Video from "react-native-video"; // Within your render function, assuming you have a file called // "background.mp4" in your project. You can include multiple videos // on a single screen if you like. -