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

Add iOS and Android basic DRM support #1445

Merged
merged 118 commits into from
Aug 13, 2020

Conversation

danielmarino24i
Copy link
Contributor

This PR adds support for DRM streams on iOS (Fairplay) and Android (Playready, Widevine, Clearkey)

I am neither Android nor iOS developer, so feel free to provide feedback to improve this PR.

Test stream for ANDROID:

testStream = {
        uri: 'http://profficialsite.origin.mediaservices.windows.net/c51358ea-9a5e-4322-8951-897d640fdfd7/tearsofsteel_4k.ism/manifest(format=mpd-time-csf)',
        type: 'mpd',
        drm: {
            type: DRMType.PLAYREADY,
            licenseServer: 'http://test.playready.microsoft.com/service/rightsmanager.asmx?cfg=(persist:false,sl:150)'
        }
    };

or

{
    uri: 'https://media.axprod.net/TestVectors/v7-MultiDRM-SingleKey/Manifest_1080p.mpd',
    drm: {
        type: 'widevine', //or DRMType.WIDEVINE
        licenseServer: 'https://drm-widevine-licensing.axtest.net/AcquireLicense',
        headers: {
            'X-AxDRM-Message': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2ZXJzaW9uIjoxLCJjb21fa2V5X2lkIjoiYjMzNjRlYjUtNTFmNi00YWUzLThjOTgtMzNjZWQ1ZTMxYzc4IiwibWVzc2FnZSI6eyJ0eXBlIjoiZW50aXRsZW1lbnRfbWVzc2FnZSIsImZpcnN0X3BsYXlfZXhwaXJhdGlvbiI6NjAsInBsYXlyZWFkeSI6eyJyZWFsX3RpbWVfZXhwaXJhdGlvbiI6dHJ1ZX0sImtleXMiOlt7ImlkIjoiOWViNDA1MGQtZTQ0Yi00ODAyLTkzMmUtMjdkNzUwODNlMjY2IiwiZW5jcnlwdGVkX2tleSI6ImxLM09qSExZVzI0Y3Iya3RSNzRmbnc9PSJ9XX19.FAbIiPxX8BHi9RwfzD7Yn-wugU19ghrkBFKsaCPrZmU'
        },
    }
}

Test stream for iOS:
Sorry but I can not provide free streams to test. If anyone can provide test streams, or found some we can use, please let me know to also test them.

It has been tested with a private provider and they work, at least with the getLicense override method. (An example implementation is provided in the README)

@rogerkerse
Copy link

What do we need for it to be merged? I think all the requested changes have been made. Also we are successfully using it in production with the DRM streams.

@luiscerqueira
Copy link

I tested this branch in android with dash+widevine (i dont have some fairplay streams to test yet) and it is working.

e.g.
url: 'https://bitmovin-a.akamaihd.net/content/art-of-motion_drm/mpds/11331.mpd'
licenseServer: 'https://widevine-proxy.appspot.com/proxy'

Is there anything missing for this feature to be merged?

@vimalkodoth
Copy link

I'm trying to play encrypted ( DASH + Widevine ) stream and I end up getting as below checking the device logs through adb

ExoPlayerImplInternal: com.google.android.exoplayer2.ExoPlaybackException: java.lang.IllegalStateException: Media requires a DrmSessionManager

@bjacog
Copy link

bjacog commented Jan 28, 2020

@vimalkodoth are you sure your device has DRM support?

@vimalkodoth
Copy link

hey @bjacog , yes, it does have support. I get the same error infact on android for mobile and as well for bigscreen ( android tv ) devices. I'm using DRMInfo application on appstore to verfiy the support for DRM.

@sunnyoui
Copy link

@vimalkodoth, are you able to share the code and I can try debugging

@EyMaddis
Copy link

EyMaddis commented Feb 20, 2020

I can confirm that Fairplay works, however the getLicense does not work because on the device (runnning in JSC) the spc data is empty, not so in v8, here it does work.

I tested based on this commit 24i@32748d5

@canhnm
Copy link

canhnm commented Mar 9, 2020

Hi guys, I would like to check if it's possible to play HLS encrypted with AES-128, example on m3u8 content:

#EXT-X-KEY:METHOD=AES-128,URI="file.key",IV=0x9256b016abc7ad3deaef1f093be826d3

@rogerkerse
Copy link

rogerkerse commented Mar 17, 2020

Who is working on it and can this be merged? And all the following bugs be fixed in future pull requests? 😊

This is working in most cases and it has been in works for over a year.

@rogerkerse
Copy link

After updating to RN 0.62 the subtitles and audios are not returned in this branch anymore

@jenshandersson
Copy link
Contributor

I can't see how this PR will get merged to be honest, I feel we have to streamline the project and add support for addons/plugins before adding DRM support....

@TalhaArshad
Copy link

I'm trying to play encrypted ( DASH + Widevine ) stream and I end up getting as below checking the device logs through adb

ExoPlayerImplInternal: com.google.android.exoplayer2.ExoPlaybackException: java.lang.IllegalStateException: Media requires a DrmSessionManager

I am facing same issue. Did you find any solution?

@TalhaArshad
Copy link

@vimalkodoth I have fixed it. It was my bad. I was using drm and source prop in wrong way. may be you are doing same mistake. Here is the sample code for of video component for widewine

<Video style={{ height: 400, width: 300 }}
source={{
uri: 'https://bitmovin-a.akamaihd.net/content/art-of-motion_drm/mpds/11331.mpd'
}}
drm={{
type: 'widevine', //or DRMType.WIDEVINE
licenseServer: 'https://widevine-proxy.appspot.com/proxy',
}}
/>

yurtaev added a commit to AlphaOTT/react-native-video that referenced this pull request Aug 3, 2020
yurtaev added a commit to AlphaOTT/react-native-video that referenced this pull request Aug 3, 2020
@aprofromindia
Copy link

aprofromindia commented Aug 3, 2020

@vimalkodoth I have fixed it. It was my bad. I was using drm and source prop in wrong way. may be you are doing same mistake. Here is the sample code for of video component for widewine

<Video style={{ height: 400, width: 300 }}
source={{
uri: 'https://bitmovin-a.akamaihd.net/content/art-of-motion_drm/mpds/11331.mpd'
}}
drm={{
type: 'widevine', //or DRMType.WIDEVINE
licenseServer: 'https://widevine-proxy.appspot.com/proxy',
}}
/>

When I try the above, I get the following error in Android logcat and no video playing, It works perfectly with a normal video url (non DRM'ed) : -

E/MediaPlayerNative: error (1, -2147483648)

I have tried react-native link and autolinking and also with add exoplayer in settings.gradle

Anyone has any idea please?

@Ladonasc
Copy link

Ladonasc commented Aug 4, 2020

Hi @aprofromindia,

I guess your issue comes from the wrongly linked "Player", the auto-link capability of react-native (since v0.60.0) link the "classic" player of react-native-video.

Try to add a react-native.config.js in the root directory of your project and put this as the content (this is mine):

module.exports = {
    dependencies: {
        /*
            RN 0.60.X AutoLink wrongly link the react-native-video module. Without custom
            config (as below), the "MediaPlayer" is linked instead of the "ExoPlayer", and thus
            reading Dash stream failed....
         */
        'react-native-video': {
            platforms: {
                android: {
                    sourceDir: `${__dirname}/node_modules/react-native-video/android-exoplayer`,
                    folder: `${__dirname}/node_modules/react-native-video`,
                    packageImportPath:
                        'import com.brentvatne.react.ReactVideoPackage;',
                    packageInstance: 'new ReactVideoPackage()',
                },
            },
        },
    },
}

Copy link
Collaborator

@nickfujita nickfujita left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested on the Android side, and have confirmed it's working as expected with DrmToday.

For those working with DrmToday, please be sure to use the url query param ?specConform=true, when passing in your licenseServer value. This is because DrmToday passes back a non-standard response by default, and this will pass just the license in in the correct format.

Seems like many others have tested as well above and confirmed that this solution is working. As well as for those that it was not working, it seems it mainly has to do with improper usage that has since been resolved.

@cobarx Would it be possible to get this code merged in after the conflicts are resolved?

@sunnyoui
Copy link

Have it working with widevine license server for android and fairplay for iOS for my project.

Would be a good idea to get this merged and made available.

@nickfujita
Copy link
Collaborator

@danielmarino24i Can you please clean up the conflicts and then merge this in?

@cobarx cobarx merged commit 81b42e7 into TheWidlarzGroup:master Aug 13, 2020
@rogerkerse rogerkerse mentioned this pull request Aug 16, 2020
@0xleeaki
Copy link

0xleeaki commented Aug 17, 2020

Hi, I encountered some errors and fixed them.

Error: E/MediaPlayerNative: error (1, -2147483648)

  • Change Media Player to ExoPlayer,
  • Add file react-native.config.js in root folder
  • Coppy code
module.exports = {
  dependencies: {
    'react-native-video': {
      platforms: {
        android: {
          sourceDir: '../node_modules/react-native-video/android-exoplayer'
        }
      }
    }
  }
}

Error: Media requires a DrmSessionManager

  • Update react-native-video to "5.1.0-alpha7" => "react-native-video": "5.1.0-alpha7" in package.json

For test android:

source={{
    uri: 'https://media.axprod.net/TestVectors/v7-MultiDRM-SingleKey/Manifest_1080p.mpd',
}}
drm={{
      type: DRMType.WIDEVINE,
      licenseServer: 'https://drm-widevine-licensing.axtest.net/AcquireLicense',
      headers: {
          'X-AxDRM-Message': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2ZXJzaW9uIjoxLCJjb21fa2V5X2lkIjoiYjMzNjRlYjUtNTFmNi00YWUzLThjOTgtMzNjZWQ1ZTMxYzc4IiwibWVzc2FnZSI6eyJ0eXBlIjoiZW50aXRsZW1lbnRfbWVzc2FnZSIsImZpcnN0X3BsYXlfZXhwaXJhdGlvbiI6NjAsInBsYXlyZWFkeSI6eyJyZWFsX3RpbWVfZXhwaXJhdGlvbiI6dHJ1ZX0sImtleXMiOlt7ImlkIjoiOWViNDA1MGQtZTQ0Yi00ODAyLTkzMmUtMjdkNzUwODNlMjY2IiwiZW5jcnlwdGVkX2tleSI6ImxLM09qSExZVzI0Y3Iya3RSNzRmbnc9PSJ9XX19.FAbIiPxX8BHi9RwfzD7Yn-wugU19ghrkBFKsaCPrZmU'
      },
}}

For play FAIRPLAY in IOS

  • Change Video.js file
const getLicenseOverride = this.props.drm.getLicense(data.spc, data.contentId, data.spcBase64, this.props);

to

const getLicenseOverride = this.props.drm.getLicense(data.spc, data.contentId, data.licenseUrl);
  • Change ios/Video/RCTVideo.m file
NSString *spcStr = [[NSString alloc] initWithData:spcData encoding:NSASCIIStringEncoding];

to

NSString *base64Encoded = [spcData base64EncodedStringWithOptions:0];

and change self.onGetLicense function to

self.onGetLicense(@{@"licenseUrl": licenseUrl,@"contentId": contentId,@"spc": base64Encoded,@"target": self.reactTag});

For test ios(real devices):

drm={
        {
                    type: DrmPlayerComponentConfig.DRMType.FAIRPLAY,
                    certificateUrl: 'YOUR CERTIFICATE URL',
                    headers: {
                      Authorization: 'YOUR_TOKEN',
                      'Content-Type': 'application/x-www-form-urlencoded',
                    },
                    getLicense: (
                      spc: string | Blob,
                      contentId: any,
                      licenseUrl: string,
                    ) => {
                      const formData = new FormData();
                      formData.append('spc', spc);
                      return fetch(licenseUrl.replace('skd', 'https'), {
                        method: 'POST',
                        headers: {
                          Authorization:
                            'YOUR_TOKEN',
                          'Content-Type': 'application/x-www-form-urlencoded',
                        },
                        body: formData,
                      })
                        .then((response) => {
                          return new Promise((resolve, reject) => {
                            response.blob().then((blob) => {
                              new Response(blob).text().then((text) => {
                                resolve(
                                  text
                                    .replace('<ckc>', '')
                                    .replace('</ckc>', ''),
                                );
                              });
                            });
                          });
                        })
                        .catch((error) => {
                          setErrorMessage(error.toString());
                        });
                    },
                  }
            }

Good luck!

@nickfujita
Copy link
Collaborator

nickfujita commented Nov 17, 2020

I've created a new PR with the changes described above by @Hobahung, and additionally support for license fetching without using getLicense for iOS.

#2208

Please have a look if you are already using iOS DRM in your project or are looking to use it in the near future.

brianpmarks pushed a commit to waam-app/react-native-video that referenced this pull request May 28, 2021
This PR adds support for DRM streams on iOS (Fairplay) and Android (Playready, Widevine, Clearkey)

I am neither Android nor iOS developer, so feel free to provide feedback to improve this PR.

**Test stream for ANDROID:**
```
testStream = {
        uri: 'http://profficialsite.origin.mediaservices.windows.net/c51358ea-9a5e-4322-8951-897d640fdfd7/tearsofsteel_4k.ism/manifest(format=mpd-time-csf)',
        type: 'mpd',
        drm: {
            type: DRMType.PLAYREADY,
            licenseServer: 'http://test.playready.microsoft.com/service/rightsmanager.asmx?cfg=(persist:false,sl:150)'
        }
    };
```

or 
```
{
    uri: 'https://media.axprod.net/TestVectors/v7-MultiDRM-SingleKey/Manifest_1080p.mpd',
    drm: {
        type: 'widevine', //or DRMType.WIDEVINE
        licenseServer: 'https://drm-widevine-licensing.axtest.net/AcquireLicense',
        headers: {
            'X-AxDRM-Message': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2ZXJzaW9uIjoxLCJjb21fa2V5X2lkIjoiYjMzNjRlYjUtNTFmNi00YWUzLThjOTgtMzNjZWQ1ZTMxYzc4IiwibWVzc2FnZSI6eyJ0eXBlIjoiZW50aXRsZW1lbnRfbWVzc2FnZSIsImZpcnN0X3BsYXlfZXhwaXJhdGlvbiI6NjAsInBsYXlyZWFkeSI6eyJyZWFsX3RpbWVfZXhwaXJhdGlvbiI6dHJ1ZX0sImtleXMiOlt7ImlkIjoiOWViNDA1MGQtZTQ0Yi00ODAyLTkzMmUtMjdkNzUwODNlMjY2IiwiZW5jcnlwdGVkX2tleSI6ImxLM09qSExZVzI0Y3Iya3RSNzRmbnc9PSJ9XX19.FAbIiPxX8BHi9RwfzD7Yn-wugU19ghrkBFKsaCPrZmU'
        },
    }
}
```

**Test stream for iOS:**
Sorry but I can not provide free streams to test. If anyone can provide test streams, or found some we can use, please let me know to also test them.

It has been tested with a private provider and they work, at least with the `getLicense` override method. (An example implementation is provided in the README)
@mtshv
Copy link

mtshv commented Oct 26, 2021

Hi, @nickfujita!

Could you please share with me your experience with DRMtoday?

I've tested on the Android side, and have confirmed it's working as expected with DrmToday.

I got it working with iOS, but on Android, I am getting

V/error: com.google.android.exoplayer2.ExoPlaybackException: com.google.android.exoplayer2.ParserException: org.xmlpull.v1.XmlPullParserException: unterminated entity ref (position:TEXT @15:190 in java.io.InputStreamReader@f8a2039) 

looks like the player is trying to play an XML text. I think I might be using the wrong headers:

drm={{
      type: DRMType.WIDEVINE,
      licenseServer: 'https://license-server-url-provided-by-drmtoday/cenc/?specConform=true',
      headers: {
          'x-dt-auth-token': '...',
          'x-dt-custom-data': '...',
      },
}}

Do you remember by any chance, if your successful approach was using the same headers, or different?

MeenuDhanoa added a commit to railroadmedia/react-native-video that referenced this pull request Aug 13, 2024
* Fix so background audio from other apps can play when disableFocus is true. requestAudioFocus was being run regardless of there being a src, so I made it so that only gets requested when a src exists.

* Added details to readme and changelog

* update for androidX

* change minSdkVersion back to 16

* update readme

* remove duplicate ReactVideoPackage()

* add readme to migrating to AndroidX

* add read me

* fix read me

* pre androidX, upgrade to 28

* remove duplicated line in example

* change dead code in  example

* Remove calls to [super observe] to fix crash

* Add TheWidlarzGroup#1646 to changelog

* bring back super KVO with selector check

* Fix memory leak when using AVPlayerViewController, make sure to release player

* Updated changelog

* changelog for TheWidlarzGroup#1629

* bump version

* chang maven to google

* fix when controls & muted

* update changelog

* handle racing conditions when props are setted on exoplayer

* fix for setControls

* fix repeat

* comment why postDelayed

* remove extra whitespace

* remove rnpm

* 4.4.4

* Update README.md

Make installation parts easier to link

* Update README.md

fix typo

* Update README.md

Make more obvious the changes needed via using diff

* Update MainApplication.java

fix indent

* remove matchingfallbacks in example

* prepare 5.0.0 version

* cpck androidx

* change minSdkVersion back to 16

(cherry picked from commit a96fa33)

* update readme

(cherry picked from commit 3ddcba3)

* add readme to migrating to AndroidX

(cherry picked from commit 976ebcc)

* cpck readme

* fix read me

(cherry picked from commit ed25b3f)

* chang maven to google

(cherry picked from commit 8a8f215)

* cpck

* ad platform installation to TOC

(cherry picked from commit b0737bd)

* More update info

(cherry picked from commit 2f23cc0)

* 5.0.1

* Fixed Exoplayer doesn't work with mute=true TheWidlarzGroup#1696

* Updated README.md to include instructions for React Native 0.60 and above

* Removing the call to observeValueForKeyPath:ofObject:change:context: on super from RCTVideo.
If the super class is not actually observing the key, the app will crash. Checking to see if
the super class responds to this selector doesn't solve this issue.

react-native-video github issue: TheWidlarzGroup#1515

Discussion about this particular problem: https://stackoverflow.com/questions/6574714/whats-wrong-with-this-observevalueforkeypathofobjectchangecontext-implement

* Updated CHANGELOG to reflect bug fix in PR 1720

* added support for automaticallyWaitsToMinimizeStalling property on iOS

* update readme

* fix invert boolean property

* bumped version & updated changelog

* fix formatting issues

* fix formatting
fix crash iOS9

* changelog for TheWidlarzGroup#1696

* Update issue templates

* Update bug_report.md

* Update bug_report.md

* Fix indent and respect previous rate

* Bring the basic example back to a runnable state

* Remove Exoplayer deprecations

- Bump Exoplayer to 2.10.4
- Remove deprecated usages of Exoplayer methdos
- Add `ReactExoplayerConfig` as extension points to configure the Exoplayer instance

* Update changelog with Exoplayer update (TheWidlarzGroup#1766)

* update package json version

* update changelog version

* Add disableFocus to TOC

* fix typo in README

* Clear progress messages on STATE_IDLE and STATE_BUFFERING (TheWidlarzGroup#1768)

The progress message handler will duplicate recursions of the `onProgressMessage` handler on change of player state from any state to STATE_READY with `playWhenReady` is true (when video is not paused). This clears the messages on STATE_IDLE and STATE_BUFFERING to break the recursion.

* fix README about reportBandwidth (TheWidlarzGroup#1816)

* Fixes a situation when exiting fullscreen, where observed keypath values have not been released

* add try catch block around removal of observer keypaths on playerViewController

* Audio Poster issue fix (TheWidlarzGroup#1779)

* Add full screen support to Android Exoplayer (TheWidlarzGroup#1730)

* Bump version to 5.1.0-alpha

* Fix readme grammar (TheWidlarzGroup#1888)

* Improve Android Audio Focus (TheWidlarzGroup#1897)

Implement audio focus as per android docs:
https://developer.android.com/guide/topics/media-apps/audio-focus
https://medium.com/androiddevelopers/audio-focus-3-cdc09da9c122

AUDIOFOCUS_LOSS should abandon focus and not try resuming audio, this is done with AUDIOFOCUS_LOSS_TRANSIENT

This fixes at least:
- Audio not being paused after focus being taken by some voip applications
- Content resuming and pausing instantly sporadically (some race condition perhaps) when activity was resumed from background.

* Update changelog (TheWidlarzGroup#1913)

* docs(video): fix bufferConfig property name (TheWidlarzGroup#1855)

* Fix play/pause regression after added fullscreen support. (TheWidlarzGroup#1916)

* v5.1.0-alpha4

* Bump javascript dependencies (TheWidlarzGroup#1914)

Also update linting rules to match other community repositories.

* Add support for react-native Windows Cpp/WinRT (TheWidlarzGroup#1893)

This also deprecates the old react-native windows implementation

* Fix the `ref` sample code to remove the syntax error

* Update changelog

* v5.1.0-alpha5

* Don't set reactViewController view frame to whole screen (TheWidlarzGroup#1931)

this fixes the case on any time you have a react view that displays the video, but it's being rendered with controls but not as a full screen (ie. easily reproducible when you have a tabbar for instance - the reactViewController.view frame shouldnt be the whole screen bounds).

* Update onLoad event to include videoTracks info

* add mixWithOthers prop

* Update README.md

* Update index.ios.js

* Fix video dimensions for HLS streams

* Changelog

* Compare CGFloats instead

* Update CHANGELOG.md

* Update CHANGELOG, alpha-6 hasn't been released yet

* Implement pending seek

* Recommend npx pod-install for setup instructions

# Summary

We've been recommending devs use `npx pod-install` since it will attempt to install CocoaPods CLI if it's not available on the computer (cite [React Navigation setup guide](https://reactnavigation.org/docs/getting-started/#installing-dependencies-into-a-bare-react-native-project)). This has proved very useful for Expo users who are now migrating to the bare workflow and want to use community packages in their projects.

## Checklist

- [x] I have tested this on a device and a simulator
- [x] I added the documentation in `README.md`

* Expose currentPlaybackTime when live stream video (TheWidlarzGroup#1944)

* added trackId to exoplayer onLoad callback

* added trackInfo to bandwidth callback

* syntax fix

* syntax fix

* version update

* sending complete logcat for media playback exception ExoPlaybackException

* version bump

* package publish changes

* Live playback fix

* Version bump

* import fix

* version bump

* configurable preferredForwardBufferDuration

* configurable preferredForwardBufferDuration

* version update

* Exposing time

* exo player window current tsp

* return type

* Current window timestamp in epoch

* iOS changes

* version update

* Updated package.json

* updated version

* CurrentTime bug fix

* Updated package.json

* Updated currentPlaybackTime

* Updated currentPlayback logic

* Updated package.json

* Bug fix

* Added semicolon

* updated package.json

* Updated ReactVideoView

* updated verison

* Revert package.json changes

* Update ReactVideoView.java

* Use standard log

* Document preferredForwardBufferDuration (iOS)

* Document currentPlaybackTime

* Document trackId

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update README.md

* Update CHANGELOG.md

Co-authored-by: anubansal <anu.bansal@curefit.com>
Co-authored-by: Sivakumar J <sivakumar@curefit.com>
Co-authored-by: parikshit <parikshit@curefit.com>
Co-authored-by: anubansal92 <40559524+anubansal92@users.noreply.github.com>
Co-authored-by: Rishu Agrawal <rishu.agrawal@v.curefit.com>
Co-authored-by: rishu-curefit <54575330+rishu-curefit@users.noreply.github.com>

* [ios] Adaptive fullscreen in landscape by device orientation (TheWidlarzGroup#1862)

* update UIInterfaceOrientation in fullscreen

* update code

* Revert "[ios] Adaptive fullscreen in landscape by device orientation (TheWidlarzGroup#1862)" (TheWidlarzGroup#2043)

This reverts commit c9096d1.

* Upgrade exoplayer to 2.11.4 (TheWidlarzGroup#2034)

* Removed JS fullscreening for Android (TheWidlarzGroup#2013)

* Always set headers for iOS (TheWidlarzGroup#2014)

* Support preventsDisplaySleepDuringVideoPlayback (TheWidlarzGroup#2019)

* Add flag on iOS

* Add flag in Android

* Add documentation

* Add changelog entry

* Also set setKeepScreenOn

* Fix prop not being set

* add preventsDisplaySleepDuringVideoPlayback to exoplayer

* Update android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java

* Update android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java

Co-authored-by: Jens Andersson <jens@fritan.com>

Co-authored-by: Anton Tanderup <antontandrup@gmail.com>
Co-authored-by: Jens Andersson <jens@fritan.com>

* Fix exoplayer aspect ratio update on source changes (TheWidlarzGroup#2053)

* Fix exoplayer aspect ratio update on source changes

* Update CHANGELOG.md

* Add iOS and Android basic DRM support (TheWidlarzGroup#1445)

This PR adds support for DRM streams on iOS (Fairplay) and Android (Playready, Widevine, Clearkey)

I am neither Android nor iOS developer, so feel free to provide feedback to improve this PR.

**Test stream for ANDROID:**
```
testStream = {
        uri: 'http://profficialsite.origin.mediaservices.windows.net/c51358ea-9a5e-4322-8951-897d640fdfd7/tearsofsteel_4k.ism/manifest(format=mpd-time-csf)',
        type: 'mpd',
        drm: {
            type: DRMType.PLAYREADY,
            licenseServer: 'http://test.playready.microsoft.com/service/rightsmanager.asmx?cfg=(persist:false,sl:150)'
        }
    };
```

or 
```
{
    uri: 'https://media.axprod.net/TestVectors/v7-MultiDRM-SingleKey/Manifest_1080p.mpd',
    drm: {
        type: 'widevine', //or DRMType.WIDEVINE
        licenseServer: 'https://drm-widevine-licensing.axtest.net/AcquireLicense',
        headers: {
            'X-AxDRM-Message': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2ZXJzaW9uIjoxLCJjb21fa2V5X2lkIjoiYjMzNjRlYjUtNTFmNi00YWUzLThjOTgtMzNjZWQ1ZTMxYzc4IiwibWVzc2FnZSI6eyJ0eXBlIjoiZW50aXRsZW1lbnRfbWVzc2FnZSIsImZpcnN0X3BsYXlfZXhwaXJhdGlvbiI6NjAsInBsYXlyZWFkeSI6eyJyZWFsX3RpbWVfZXhwaXJhdGlvbiI6dHJ1ZX0sImtleXMiOlt7ImlkIjoiOWViNDA1MGQtZTQ0Yi00ODAyLTkzMmUtMjdkNzUwODNlMjY2IiwiZW5jcnlwdGVkX2tleSI6ImxLM09qSExZVzI0Y3Iya3RSNzRmbnc9PSJ9XX19.FAbIiPxX8BHi9RwfzD7Yn-wugU19ghrkBFKsaCPrZmU'
        },
    }
}
```

**Test stream for iOS:**
Sorry but I can not provide free streams to test. If anyone can provide test streams, or found some we can use, please let me know to also test them.

It has been tested with a private provider and they work, at least with the `getLicense` override method. (An example implementation is provided in the README)

* Ready 5.1.0-alpha6 for release

* Prepare 5.1.0-alpha7

* Port over fix from 4.x branch

* Prepare 5.1.0-alpha8

* Bugfix: TheWidlarzGroup#1930

* Add ARM64 support for windows (TheWidlarzGroup#2137)

Adding arm64 support for RNW builds.

Nothing in this project is using anything that isn't already supported in arm64 windows libs. It was simply overlooked when RNW was originally added.

We have been using RNW and RNV in our project for 6+ months and just been using a patch-package to apply this change. Figured it was overdue to upstream this change.

You can see this similar code in the RNW repo.
https://github.com/microsoft/react-native-windows/blob/95935e008621778dbcec01363602c19abc060632/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/SampleLibraryCPP.vcxproj#L28
and
https://github.com/microsoft/react-native-windows/blob/master/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/SampleLibraryCPP.vcxproj#L44

* Update README.md (TheWidlarzGroup#2076)

You only need to perform linking for React Native < 0.60

* fix: Xcode 12 compatibility (TheWidlarzGroup#2152)

Latest Xcode 12 fails to build while without a module to depend on React-Core directly hence this change is necessary for native modules on iOS. This change requires to React Native 0.60.2 or newer. For more details please check: facebook/react-native#29633 (comment)

* Renaming Boolean etc to AsBoolean (TheWidlarzGroup#2119)

* Resolved an issue where setting a video to paused would ignore the “silent switch” setting

* iOS DRM Fixes for License Fetching (TheWidlarzGroup#2208)

* Update package.json version number to 5.1.1

* Update ReactNativeVideoCPP.vcxproj (TheWidlarzGroup#2288)

* Exoplayer: Use okhttp version specified in gradle.properties (TheWidlarzGroup#2340)

Because React Native uses okhttp, including exoplayer causes apps to use two different versions of okhttp.  This results in some unpredictable behavior.  Clients of `react-native-video` should be able to specify the same OKHTTP version to react-native and react-native video.

See where it's specified in react-native trunk: 
- https://github.com/facebook/react-native/blob/master/ReactAndroid/gradle.properties#L15
- https://github.com/facebook/react-native/blob/e1b6cd3f756aa034b11af6bf9960efb42bde8692/ReactAndroid/build.gradle#L452-L453

* React Native Windows updates (TheWidlarzGroup#2206)

Various updates for React Native Windows

**Docs**
* Fixed windows installation in readme
* Added local dev setup instructions

**Build**
* Added VS solutions for RNW 0.61, 0.62, and 0.63+
* Added clang-formatting definition

**Features**
* Fixed autolinking for RNW 0.63+
* Added support for `rate` property

**Examples**
* Upgraded examples/basic to RN 0.61 and replaced broken windows app

* Update README.md (TheWidlarzGroup#2292)

Fix broken link for ignoresilentswitch

* Fix AudoFocus pausing video when attempting to play (TheWidlarzGroup#2311)

Fix AudioFocus bug that could cause the player to stop responding to play/pause in some instances.

Fixes issue TheWidlarzGroup#1945

This was caused by the player requesting audio focus on each play (un-pause) and that resulted in a small window of Audio focus loss and then gain. The focus loss results in the player being paused while the player was supposed to play at the time. The solution is to keep track of Audio focus and not request new focus if we already have it.

* Upgrade ExoPlayer to 2.13.2 (TheWidlarzGroup#2317)

Upgrade ExoPlayer from 2.11.4 to 2.13.2 and fix any issues related to the upgrade and deprecated method use.

* update exoplayer to allow pre-init and content clear

* Fix for tvOS native audio menu language selector

* Release 5.2.0-alpha1

* Typo

* Release 5.2.0

* Use prop types from `deprecated-react-native-prop-types`

Starting with React Native 0.68, using Prop Types from `react-native` emits a warning.

* Update Video.js

Co-authored-by: Elliott Kember <elliott.kember@gmail.com>
# Conflicts:
#	Video.js

* Replace Image.propTypes with ImagePropTypes.
# Conflicts:
#	Video.js

* fix(Exoplayer): fix exoplayer version tà 2.13.3

* chore: fix build without exoplayer

* v5.2.1

* docs: update Android installation

* * removed duplicate method

* * fix onRemotePlayPause in android

* * remove duplicate code

* * fix cannot find symbol after RN update

---------

Co-authored-by: Kurt Johnson <kurt.johnson@lightmaker.com>
Co-authored-by: Kurt Johnson <kurtjohnson8@gmail.com>
Co-authored-by: vok <admin@MacOnes-MacBook-Pro-2.local>
Co-authored-by: Zaid Daghestani <zaid.daghestani@gmail.com>
Co-authored-by: Jens Andersson <jens@fritan.com>
Co-authored-by: Daniel Mariño Ruiz <1237997+CHaNGeTe@users.noreply.github.com>
Co-authored-by: Daniel Mariño <daniel.marino@24imedia.com>
Co-authored-by: Ash Mishra <a.mishra@nfb.ca>
Co-authored-by: Andrew Chae <asjchae@gmail.com>
Co-authored-by: Jamie Halvorson <jamie@halvorson.co.uk>
Co-authored-by: Nahuel Marisi <nahuel.marisi@klarna.com>
Co-authored-by: Jovan Stanimirovic <jovan@netlog.com>
Co-authored-by: Benoit Dion <unknown>
Co-authored-by: Benoit Dion <573574+benoitdion@users.noreply.github.com>
Co-authored-by: Bader Serhan <baderserhan@gmail.com>
Co-authored-by: Tsukasa Setoguchi <tsukasa.setoguchi@gmail.com>
Co-authored-by: Learnyst <shankar@karaokegarage.com>
Co-authored-by: IbrahimSulai <33604125+IbrahimSulai@users.noreply.github.com>
Co-authored-by: Benoit Dion <benoit@eliteness.app>
Co-authored-by: Mohammed Salman <msal4@outlook.com>
Co-authored-by: Michael Tintiuc <michaeltintiuc@users.noreply.github.com>
Co-authored-by: Piotr Błażejewicz (Peter Blazejewicz) <peterblazejewicz@users.noreply.github.com>
Co-authored-by: Benoit Dion <benoitdion@gmail.com>
Co-authored-by: Di Da <dida@microsoft.com>
Co-authored-by: Brandon Faulkner <college.bfaulk96@yahoo.com>
Co-authored-by: Marlon Andrade <marlonmandrade@gmail.com>
Co-authored-by: Hampton Maxwell <me@hamptonmaxwell.com>
Co-authored-by: Harrison Mendonça <harrisonmendonca@gmail.com>
Co-authored-by: Evan Bacon <baconbrix@gmail.com>
Co-authored-by: Param Aggarwal <paramaggarwal@gmail.com>
Co-authored-by: anubansal <anu.bansal@curefit.com>
Co-authored-by: Sivakumar J <sivakumar@curefit.com>
Co-authored-by: parikshit <parikshit@curefit.com>
Co-authored-by: anubansal92 <40559524+anubansal92@users.noreply.github.com>
Co-authored-by: Rishu Agrawal <rishu.agrawal@v.curefit.com>
Co-authored-by: rishu-curefit <54575330+rishu-curefit@users.noreply.github.com>
Co-authored-by: Tuan Luong <tuanluong.it@gmail.com>
Co-authored-by: limaAniceto <lima.aniceto@gmail.com>
Co-authored-by: Anders Lemke <mail@anderslemke.dk>
Co-authored-by: Anton Tanderup <antontandrup@gmail.com>
Co-authored-by: Jeferson Daniel <contato@jefersondaniel.com>
Co-authored-by: Daniel Mariño <35027703+danielmarino24i@users.noreply.github.com>
Co-authored-by: Hampton Maxwell <hmaxwell@ellation.com>
Co-authored-by: Nick Fujita <nickfujita@gmail.com>
Co-authored-by: redspear <willkoia@gmail.com>
Co-authored-by: Adam Gorman <namrog84@users.noreply.github.com>
Co-authored-by: Irwin <irwinwilliams@users.noreply.github.com>
Co-authored-by: Radek Czemerys <7029942+radko93@users.noreply.github.com>
Co-authored-by: Tero Paananen <54746036+tero-paananen@users.noreply.github.com>
Co-authored-by: Cameron Perry <cameron.perry@valtech.com>
Co-authored-by: Alexander Sklar <asklar@microsoft.com>
Co-authored-by: Sean Holbert <sdholbs@gmail.com>
Co-authored-by: Jon Thysell <thysell@gmail.com>
Co-authored-by: Milan Susnjar <milanrs@gmail.com>
Co-authored-by: Armands Malejev <armands.malejevs@gmail.com>
Co-authored-by: Jonas Dalesjö <jonas.dalesjo@gmail.com>
Co-authored-by: Shane Mckenna <shanemckennadev@gmail.com>
Co-authored-by: Renaud Chaput <renchap@gmail.com>
Co-authored-by: olivier bouillet <olivier.bouillet@ifeelsmart.com>
Co-authored-by: Omar Diop <accounts@omardiop.com>
Co-authored-by: Olivier Bouillet <62574056+freeboub@users.noreply.github.com>
Co-authored-by: ARTSOFT\csillaj <jenei_csilla@yahoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature help wanted The issue has been reviewed and is valid, and is waiting for someone to work on it. Platform: iOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.