Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes for gb mobile upgrade to rn 0.61 #4

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
739a636
Fix so background audio from other apps can play when disableFocus is…
Feb 7, 2019
a55b7e5
Added details to readme and changelog
Feb 7, 2019
3d80bfd
Merge branch 'master' into bugfix/android-disablefocus-audio
KurtMakesWeb Mar 15, 2019
fccbc93
Adds onPlaybackRateChange to README
May 3, 2019
3989d73
react-native 0.59 support
yjb94 May 24, 2019
327d862
simplified logic
yjb94 May 24, 2019
d61a0d7
update other vulnerable
yjb94 May 24, 2019
4efd0b5
Updates README description
Jun 11, 2019
5f42e0f
Update CHANGELOG.md
CHaNGeTe Jun 12, 2019
4223f5d
Update CHANGELOG.md
CHaNGeTe Jun 12, 2019
e28ae17
Merge pull request #1578 from JoeM-RP/master
CHaNGeTe Jun 12, 2019
a0bb083
Remove video layer when entering background correctly, both if using …
jenshandersson Jun 10, 2019
0a15579
Update CHANGELOG.md
jenshandersson Jun 17, 2019
112608c
RCTDirectEventBlock
Jun 18, 2019
32796e9
Change also RCTVideo.h
Jun 19, 2019
9c04bd2
Update CHANGELOG
Jun 19, 2019
4f36eb1
update for androidX
Jun 19, 2019
a96fa33
change minSdkVersion back to 16
Jun 19, 2019
3ddcba3
update readme
Jun 19, 2019
6d3936d
Fixes bug where poster and video was displayed simultaneously
jenshandersson Jun 19, 2019
cc7db91
Improved handling of poster, fading it out on load
jenshandersson Jun 19, 2019
420332e
Implemented onReadyForDisplay for iOS when using controls
jenshandersson Jun 19, 2019
b193baa
Hide poster at the right time ie in onReadyForDisplay
jenshandersson Jun 19, 2019
e5b5bbe
Updated changelog and readme
jenshandersson Jun 19, 2019
fcef441
Added onReadyForDisplay to web/dom
jenshandersson Jun 19, 2019
a3b32ac
Merge pull request #1625 from 24i/feature/avoid-event-collision-3
CHaNGeTe Jun 19, 2019
92f7459
Merge pull request #1614 from jenshandersson/master
CHaNGeTe Jun 19, 2019
3762a32
remove duplicate ReactVideoPackage()
Jun 20, 2019
976ebcc
add readme to migrating to AndroidX
Jun 20, 2019
e5bc715
add read me
Jun 20, 2019
cad807d
Merge pull request #1592 from yjb94/master
CHaNGeTe Jun 20, 2019
e033fc4
update changelog for #1592
Jun 20, 2019
88d2aed
bump version
Jun 20, 2019
cb3e8c8
Merge branch 'release/4.4.2' into posterfix
jenshandersson Jun 20, 2019
6ea6583
Make sure to hide poster for Windows, even though onReadyForDisplay i…
jenshandersson Jun 20, 2019
ed25b3f
fix read me
Jun 21, 2019
a203aea
pre androidX, upgrade to 28
Jun 21, 2019
3a7be63
Merge pull request #1627 from jenshandersson/posterfix
CHaNGeTe Jun 22, 2019
1cd9796
remove duplicated line in example
Jun 25, 2019
438df8b
change dead code in example
Jun 25, 2019
6de06f1
Remove calls to [super observe] to fix crash
reaperdtme Jul 1, 2019
6876179
Add #1646 to changelog
reaperdtme Jul 2, 2019
4a3ea93
bring back super KVO with selector check
reaperdtme Jul 2, 2019
3d2a58a
Fix memory leak when using AVPlayerViewController, make sure to relea…
jenshandersson Jul 3, 2019
666c26d
Updated changelog
jenshandersson Jul 3, 2019
2b067f1
Merge branch 'master' into bugfix/android-disablefocus-audio
KurtMakesWeb Jul 3, 2019
22a3961
Merge pull request #1646 from kidcosmic/master
CHaNGeTe Jul 4, 2019
7949c55
Merge pull request #1629 from vokhuyetOz/android-28
CHaNGeTe Jul 4, 2019
6c7a0b4
changelog for #1629
Jul 4, 2019
9bc709f
Merge branch 'release/4.4.3' into master
CHaNGeTe Jul 4, 2019
1433d16
Merge pull request #1647 from jenshandersson/master
CHaNGeTe Jul 4, 2019
d4313e2
bump version
Jul 4, 2019
8a8f215
chang maven to google
Jul 6, 2019
9dec6ae
Merge branch 'release/4.4.3' into bugfix/android-disablefocus-audio
CHaNGeTe Jul 6, 2019
be3c8b6
Merge pull request #1469 from KurtMakesWeb/bugfix/android-disablefocu…
CHaNGeTe Jul 6, 2019
576273d
fix when controls & muted
Jul 6, 2019
61a72ad
update changelog
Jul 6, 2019
466c004
handle racing conditions when props are setted on exoplayer
Jul 7, 2019
40c7371
fix for setControls
Jul 7, 2019
eae487c
Merge branch 'release/4.4.3' into feature/fix-when-muted-and-controls
CHaNGeTe Jul 8, 2019
77c9ad3
Merge pull request #1654 from 24i/feature/fix-when-muted-and-controls
CHaNGeTe Jul 8, 2019
cb3cff7
fix repeat
Jul 8, 2019
b7d1139
Merge pull request #1652 from react-native-community/release/4.4.3
CHaNGeTe Jul 9, 2019
cde2432
Merge branch 'rnv-master' into feature/handle-props-racing-conditions…
Jul 9, 2019
f60aff7
comment why postDelayed
Jul 9, 2019
f58ae34
remove extra whitespace
Jul 9, 2019
47e1630
remove rnpm
Jul 10, 2019
03114bc
Merge pull request #1655 from 24i/feature/handle-props-racing-conditi…
ashnfb Jul 11, 2019
6bdbaec
4.4.4
Jul 12, 2019
95060d7
Update README.md
CHaNGeTe Jul 23, 2019
66a85ae
Update README.md
CHaNGeTe Jul 23, 2019
62ff44a
Update README.md
CHaNGeTe Jul 23, 2019
d748d17
Update MainApplication.java
CHaNGeTe Jul 23, 2019
222adf5
remove matchingfallbacks in example
Jul 24, 2019
a45e857
Merge branch 'release/5.0.0' into update-androidx
CHaNGeTe Jul 25, 2019
1fb07b5
Merge pull request #1626 from vokhuyetOz/update-androidx
CHaNGeTe Jul 25, 2019
917f9cb
prepare 5.0.0 version
Jul 25, 2019
c29244b
Merge pull request #1683 from react-native-community/release/5.0.0
CHaNGeTe Jul 25, 2019
88d3a4a
cpck androidx
Jul 28, 2019
6bd8f33
change minSdkVersion back to 16
Jun 19, 2019
45b806d
update readme
Jun 19, 2019
991fd59
add readme to migrating to AndroidX
Jun 20, 2019
e6e57ec
cpck readme
Jun 20, 2019
2f8746c
fix read me
Jun 21, 2019
a1679ef
chang maven to google
Jul 6, 2019
4f9f793
cpck
CHaNGeTe Jul 23, 2019
e38149b
ad platform installation to TOC
Jul 23, 2019
aad75d4
More update info
Jul 25, 2019
c38ff02
5.0.1
Jul 28, 2019
d858bf7
Merge pull request #1690 from 24i/feature/androidx-cherry-pick
CHaNGeTe Sep 8, 2019
c85e060
Merge tag '5.0.1' into experiment/android_x_migration-upstream5.0.2
hypest Dec 20, 2019
a243cfd
Merge branch 'experiment/android_x_migration' into experiment/android…
hypest Dec 20, 2019
acd40d6
Merge branch 'fork-for-gutenberg-mobile' into try/changes-for-gb-mobi…
hypest Jan 22, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
## Changelog

### Version 5.0.1
* Fix AndroidX Support bad merge

### Version 5.0.0 [Deprecated]
* AndroidX Support

### Version 4.4.4
* Handle racing conditions when props are setted on exoplayer

### Version 4.4.3
* Fix mute/unmute when controls are present (iOS) [#1654](https://github.com/react-native-community/react-native-video/pull/1654)
* Fix Android videos being able to play with background music/audio from other apps.
* Fixed memory leak on iOS when using `controls` [#1647](https://github.com/react-native-community/react-native-video/pull/1647)
* (Android) Update gradle and target SDK [#1629](https://github.com/react-native-community/react-native-video/pull/1629)
* Fix iOS stressed mount/unmount crash [#1646](https://github.com/react-native-community/react-native-video/pull/1646)

### Version 4.4.2
* Change compileOnly to implementation on gradle (for newer gradle versions and react-native 0.59 support) [#1592](https://github.com/react-native-community/react-native-video/pull/1592)
* Replaced RCTBubblingEventBlock events by RCTDirectEventBlock to avoid event name collisions [#1625](https://github.com/react-native-community/react-native-video/pull/1625)
* Added `onPlaybackRateChange` to README [#1578](https://github.com/react-native-community/react-native-video/pull/1578)
* Added `onReadyForDisplay` to README [#1627](https://github.com/react-native-community/react-native-video/pull/1627)
* Improved handling of poster image. Fixes bug with displaying video and poster simultaneously. [#1627](https://github.com/react-native-community/react-native-video/pull/1627)
* Fix background audio stopping on iOS when using `controls` [#1614](https://github.com/react-native-community/react-native-video/pull/1614)

### Version 4.4.1
* Fix tvOS picture-in-picture compilation regression [#1518](https://github.com/react-native-community/react-native-video/pull/1518)
* fullscreen rotation issues with iOS built-in controls [#1441](https://github.com/react-native-community/react-native-video/pull/1441)
Expand Down
132 changes: 115 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@
A `<Video>` component for react-native, as seen in
[react-native-login](https://github.com/brentvatne/react-native-login)!

Version 5.x recommends react-native >= 0.60.0 for Android 64bit builds and Android X support.

Version 4.x requires react-native >= 0.57.0

Version 3.x requires react-native >= 0.40.0

### Version 5.0.0 breaking changes

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.

Expand All @@ -20,6 +26,11 @@ Version 3.0 features a number of changes to existing behavior. See [Updating](#u
## 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)
Expand All @@ -42,14 +53,15 @@ yarn add react-native-video

Then follow the instructions for your platform to link react-native-video into your project:

### iOS installation
<details>
<summary>iOS</summary>
<summary>iOS details</summary>

### Standard Method
#### Standard Method

Run `react-native link react-native-video` to link the react-native-video library.

### Using CocoaPods (required to enable caching)
#### 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).

Expand All @@ -73,8 +85,9 @@ end

</details>

<details>
<summary>tvOS</summary>
### tvOS installation
<details>
<summary>tvOS details</summary>

`react-native link react-native-video` doesn’t work properly with the tvOS target so we need to add the library manually.

Expand All @@ -95,14 +108,15 @@ Select RCTVideo-tvOS
<img src="./docs/tvOS-step-4.jpg" width="40%">
</details>

### Android installation
<details>
<summary>Android</summary>
<summary>Android details</summary>

Run `react-native link react-native-video` to link the react-native-video library.

Or if you have trouble, make the following additions to the given files manually:

**android/settings.gradle**
#### **android/settings.gradle**

The newer ExoPlayer library will work for most people.

Expand All @@ -118,17 +132,30 @@ include ':react-native-video'
project(':react-native-video').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-video/android')
```

#### **android/app/build.gradle**

**android/app/build.gradle**
From version >= 5.0.0, you have to apply this changes:

```gradle
```diff
dependencies {
...
compile project(':react-native-video')
compile project(':react-native-video')
+ implementation "androidx.appcompat:appcompat:1.0.0"
- implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"

}
```

**MainApplication.java**
#### **android/gradle.properties**

Migrating to AndroidX (needs version >= 5.0.0):

```gradle.properties
android.useAndroidX=true
android.enableJetifier=true
```

#### **MainApplication.java**

On top, where imports are:

Expand All @@ -149,12 +176,13 @@ protected List<ReactPackage> getPackages() {
```
</details>

### Windows installation
<details>
<summary>Windows</summary>
<summary>Windows details</summary>

Make the following additions to the given files manually:

**windows/myapp.sln**
#### **windows/myapp.sln**

Add the `ReactNativeVideo` project to your solution.

Expand All @@ -163,15 +191,15 @@ Add the `ReactNativeVideo` project to your solution.
* 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**
#### **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.

**MainPage.cs**
#### **MainPage.cs**

Add the `ReactVideoPackage` class to your list of exported packages.
```cs
Expand All @@ -198,12 +226,13 @@ using System.Collections.Generic;
```
</details>

### react-native-dom installation
<details>
<summary>react-native-dom</summary>
<summary>react-native-dom details</summary>

Make the following additions to the given files manually:

**dom/bootstrap.js**
#### **dom/bootstrap.js**

Import RCTVideoManager and add it to the list of nativeModules:

Expand Down Expand Up @@ -302,7 +331,9 @@ var styles = StyleSheet.create({
* [onFullscreenPlayerDidDismiss](#onfullscreenplayerdiddismiss)
* [onLoad](#onload)
* [onLoadStart](#onloadstart)
* [onReadyForDisplay](#onreadyfordisplay)
* [onPictureInPictureStatusChanged](#onpictureinpicturestatuschanged)
* [onPlaybackRateChange](#onplaybackratechange)
* [onProgress](#onprogress)
* [onSeek](#onseek)
* [onRestoreUserInterfaceForPictureInPictureStop](#onrestoreuserinterfaceforpictureinpicturestop)
Expand Down Expand Up @@ -368,6 +399,13 @@ For Android MediaPlayer, you will need to build your own controls or use a packa

Platforms: Android ExoPlayer, iOS, react-native-dom

#### disableFocus
Determines whether video audio should override background music/audio in Android devices.
* ** false (default)** - Override background audio/music
* **true** - Let background audio/music from other apps play

Platforms: Android Exoplayer

#### filter
Add video filter
* **FilterType.NONE (default)** - No Filter
Expand Down Expand Up @@ -953,6 +991,17 @@ Example:

Platforms: all

#### onReadyForDisplay
Callback function that is called when the first video frame is ready for display. This is when the poster is removed.

Payload: none

* iOS: [readyForDisplay](https://developer.apple.com/documentation/avkit/avplayerviewcontroller/1615830-readyfordisplay?language=objc)
* Android: [MEDIA_INFO_VIDEO_RENDERING_START](https://developer.android.com/reference/android/media/MediaPlayer#MEDIA_INFO_VIDEO_RENDERING_START)
* Android ExoPlayer [STATE_READY](https://exoplayer.dev/doc/reference/com/google/android/exoplayer2/Player.html#STATE_READY)

Platforms: Android ExoPlayer, Android MediaPlayer, iOS, Web

#### onPictureInPictureStatusChanged
Callback function that is called when picture in picture becomes active or inactive.

Expand All @@ -969,6 +1018,23 @@ isActive: true

Platforms: iOS

#### onPlaybackRateChange
Callback function that is called when the rate of playback changes - either paused or starts/resumes.

Property | Type | Description
--- | --- | ---
playbackRate | number | 0 when playback is paused, 1 when playing at normal speed. Other values when playback is slowed down or sped up

Example:
```
{
playbackRate: 0, // indicates paused
}
```

Platforms: all


#### onProgress
Callback function that is called every progressUpdateInterval seconds with info about which position the media is currently playing.

Expand Down Expand Up @@ -1231,6 +1297,38 @@ To enable audio to play in background on iOS the audio session needs to be set t

## Updating

### Version 5.0.0

Probably you want to update your gradle version:
#### gradle-wrapper.properties
```diff
- distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
+ distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
```

#### **android/app/build.gradle**

From version >= 5.0.0, you have to apply this changes:

```diff
dependencies {
...
compile project(':react-native-video')
+ implementation "androidx.appcompat:appcompat:1.0.0"
- implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"

}
```

#### **android/gradle.properties**

Migrating to AndroidX (needs version >= 5.0.0):

```gradle.properties
android.useAndroidX=true
android.enableJetifier=true
```

### Version 4.0.0

#### Gradle 3 and target SDK 26 requirement
Expand Down
40 changes: 22 additions & 18 deletions Video.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default class Video extends Component {
super(props);

this.state = {
showPoster: true,
showPoster: !!props.poster
};
}

Expand Down Expand Up @@ -86,13 +86,23 @@ export default class Video extends Component {
this._root = component;
};

_hidePoster = () => {
if (this.state.showPoster) {
this.setState({showPoster: false});
}
}

_onLoadStart = (event) => {
if (this.props.onLoadStart) {
this.props.onLoadStart(event.nativeEvent);
}
};

_onLoad = (event) => {
// Need to hide poster here for windows as onReadyForDisplay is not implemented
if (Platform.OS === 'windows') {
this._hidePoster();
}
if (this.props.onLoad) {
this.props.onLoad(event.nativeEvent);
}
Expand All @@ -117,10 +127,6 @@ export default class Video extends Component {
};

_onSeek = (event) => {
if (this.state.showPoster && !this.props.audioOnly) {
this.setState({showPoster: false});
}

if (this.props.onSeek) {
this.props.onSeek(event.nativeEvent);
}
Expand Down Expand Up @@ -163,6 +169,7 @@ export default class Video extends Component {
};

_onReadyForDisplay = (event) => {
this._hidePoster();
if (this.props.onReadyForDisplay) {
this.props.onReadyForDisplay(event.nativeEvent);
}
Expand All @@ -181,10 +188,6 @@ export default class Video extends Component {
};

_onPlaybackRateChange = (event) => {
if (this.state.showPoster && event.nativeEvent.playbackRate !== 0 && !this.props.audioOnly) {
this.setState({showPoster: false});
}

if (this.props.onPlaybackRateChange) {
this.props.onPlaybackRateChange(event.nativeEvent);
}
Expand Down Expand Up @@ -308,15 +311,16 @@ export default class Video extends Component {
};

return (
<React.Fragment>
<RCTVideo ref={this._assignRoot} {...nativeProps} />
{this.props.poster &&
this.state.showPoster && (
<View style={nativeProps.style}>
<Image style={posterStyle} source={{ uri: this.props.poster }} />
</View>
)}
</React.Fragment>
<View style={nativeProps.style}>
<RCTVideo
ref={this._assignRoot}
{...nativeProps}
style={StyleSheet.absoluteFill}
/>
{this.state.showPoster && (
<Image style={posterStyle} source={{ uri: this.props.poster }} />
)}
</View>
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion android-exoplayer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ repositories {

dependencies {

implementation 'com.facebook.react:react-native:0.60.0-patched'
implementation 'com.facebook.react:react-native:0.61.5'

implementation('com.google.android.exoplayer:exoplayer:2.9.3') {
exclude group: 'com.android.support'
Expand Down
Loading