2022-05-19 07:29:25 -06:00
|
|
|
#import "React/RCTViewManager.h"
|
2024-07-12 02:27:42 -06:00
|
|
|
#import <React/RCTBridgeModule.h>
|
2015-03-30 23:07:55 -06:00
|
|
|
|
2023-12-07 00:47:40 -07:00
|
|
|
@interface RCT_EXTERN_MODULE (RCTVideoManager, RCTViewManager)
|
2015-07-10 17:03:17 -06:00
|
|
|
|
2015-04-08 00:49:14 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(src, NSDictionary);
|
Add iOS and Android basic DRM support (#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)
2020-08-12 19:56:21 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(drm, NSDictionary);
|
2018-11-26 15:50:31 -07:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(maxBitRate, float);
|
2015-04-04 18:55:37 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(resizeMode, NSString);
|
2015-03-31 00:29:15 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(repeat, BOOL);
|
2019-08-22 02:10:39 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(automaticallyWaitsToMinimizeStalling, BOOL);
|
2018-06-05 19:40:12 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(allowsExternalPlayback, BOOL);
|
2018-06-21 10:08:37 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(textTracks, NSArray);
|
2018-06-02 03:24:13 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(selectedTextTrack, NSDictionary);
|
2018-07-17 15:14:21 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(selectedAudioTrack, NSDictionary);
|
2023-08-12 16:01:27 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(chapters, NSArray);
|
2015-04-07 21:38:16 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(paused, BOOL);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(muted, BOOL);
|
2015-12-22 16:39:04 -07:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(controls, BOOL);
|
2023-04-02 12:02:56 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(audioOutput, NSString);
|
2015-04-07 21:38:16 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(volume, float);
|
2015-10-30 03:34:54 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(playInBackground, BOOL);
|
2020-06-16 06:31:23 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(preventsDisplaySleepDuringVideoPlayback, BOOL);
|
2020-05-15 01:25:19 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(preferredForwardBufferDuration, float);
|
2016-04-29 06:16:21 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(playWhenInactive, BOOL);
|
2018-11-26 15:23:04 -07:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(pictureInPicture, BOOL);
|
2017-04-20 12:10:06 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(ignoreSilentSwitch, NSString);
|
2020-04-20 14:25:59 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(mixWithOthers, NSString);
|
2015-04-07 21:38:16 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(rate, float);
|
2016-03-31 12:36:39 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(fullscreen, BOOL);
|
2018-10-18 16:21:46 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(fullscreenAutorotate, BOOL);
|
2018-10-07 21:24:50 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(fullscreenOrientation, NSString);
|
2018-10-25 07:56:20 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(filter, NSString);
|
2018-12-13 20:30:38 -07:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(filterEnabled, BOOL);
|
2016-10-01 12:23:50 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(progressUpdateInterval, float);
|
2018-10-26 14:33:03 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(restoreUserInterfaceForPIPStopCompletionHandler, BOOL);
|
2022-05-19 07:29:25 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(localSourceEncryptionKeyScheme, NSString);
|
2024-03-14 04:29:50 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(subtitleStyle, NSDictionary);
|
2024-07-12 02:27:42 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(showNotificationControls, BOOL);
|
2016-12-12 17:16:11 -07:00
|
|
|
/* Should support: onLoadStart, onLoad, and onError to stay consistent with Image */
|
2019-06-17 23:31:17 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onVideoLoadStart, RCTDirectEventBlock);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onVideoLoad, RCTDirectEventBlock);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onVideoBuffer, RCTDirectEventBlock);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onVideoError, RCTDirectEventBlock);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onVideoProgress, RCTDirectEventBlock);
|
2023-11-08 14:06:29 -07:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onVideoBandwidthUpdate, RCTDirectEventBlock);
|
2019-06-17 23:31:17 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onVideoSeek, RCTDirectEventBlock);
|
2024-08-06 00:11:17 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onVideoSeekComplete, RCTDirectEventBlock);
|
2019-06-17 23:31:17 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onVideoEnd, RCTDirectEventBlock);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onTimedMetadata, RCTDirectEventBlock);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onVideoAudioBecomingNoisy, RCTDirectEventBlock);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onVideoFullscreenPlayerWillPresent, RCTDirectEventBlock);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onVideoFullscreenPlayerDidPresent, RCTDirectEventBlock);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onVideoFullscreenPlayerWillDismiss, RCTDirectEventBlock);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onVideoFullscreenPlayerDidDismiss, RCTDirectEventBlock);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onReadyForDisplay, RCTDirectEventBlock);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onPlaybackStalled, RCTDirectEventBlock);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onPlaybackResume, RCTDirectEventBlock);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onPlaybackRateChange, RCTDirectEventBlock);
|
2023-11-04 11:11:54 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onVolumeChange, RCTDirectEventBlock);
|
2023-10-23 10:23:57 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onVideoPlaybackStateChanged, RCTDirectEventBlock);
|
2019-06-17 23:31:17 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onVideoExternalPlaybackChange, RCTDirectEventBlock);
|
Add iOS and Android basic DRM support (#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)
2020-08-12 19:56:21 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onGetLicense, RCTDirectEventBlock);
|
2022-05-19 07:29:25 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onPictureInPictureStatusChanged, RCTDirectEventBlock);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onRestoreUserInterfaceForPictureInPictureStop, RCTDirectEventBlock);
|
2021-07-26 07:11:37 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onReceiveAdEvent, RCTDirectEventBlock);
|
2024-02-01 00:56:00 -07:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onTextTracks, RCTDirectEventBlock);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onAudioTracks, RCTDirectEventBlock);
|
2024-02-29 06:41:04 -07:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onTextTrackDataChanged, RCTDirectEventBlock);
|
2022-05-19 07:29:25 -06:00
|
|
|
|
2024-07-12 02:27:42 -06:00
|
|
|
RCT_EXTERN_METHOD(seekCmd : (nonnull NSNumber*)reactTag time : (nonnull NSNumber*)time tolerance : (nonnull NSNumber*)tolerance)
|
2024-08-02 02:42:20 -06:00
|
|
|
RCT_EXTERN_METHOD(setLicenseResultCmd : (nonnull NSNumber*)reactTag license : (NSString*)license licenseUrl : (NSString*)licenseUrl)
|
2024-07-12 02:27:42 -06:00
|
|
|
RCT_EXTERN_METHOD(setLicenseResultErrorCmd : (nonnull NSNumber*)reactTag error : (NSString*)error licenseUrl : (NSString*)licenseUrl)
|
|
|
|
RCT_EXTERN_METHOD(setPlayerPauseStateCmd : (nonnull NSNumber*)reactTag paused : (nonnull BOOL)paused)
|
|
|
|
RCT_EXTERN_METHOD(setVolumeCmd : (nonnull NSNumber*)reactTag volume : (nonnull float*)volume)
|
|
|
|
RCT_EXTERN_METHOD(setFullScreenCmd : (nonnull NSNumber*)reactTag fullscreen : (nonnull BOOL)fullScreen)
|
2024-10-10 14:59:41 -06:00
|
|
|
RCT_EXTERN_METHOD(setSourceCmd : (nonnull NSNumber*)reactTag source : (NSDictionary*)source)
|
2024-07-12 02:27:42 -06:00
|
|
|
|
2023-12-07 00:47:40 -07:00
|
|
|
RCT_EXTERN_METHOD(save
|
2024-07-12 02:27:42 -06:00
|
|
|
: (nonnull NSNumber*)reactTag options
|
|
|
|
: (NSDictionary*)options resolve
|
|
|
|
: (RCTPromiseResolveBlock)resolve reject
|
2023-12-07 00:47:40 -07:00
|
|
|
: (RCTPromiseRejectBlock)reject)
|
2024-05-28 03:00:38 -06:00
|
|
|
RCT_EXTERN_METHOD(getCurrentPosition
|
2024-07-12 02:27:42 -06:00
|
|
|
: (nonnull NSNumber*)reactTag resolve
|
|
|
|
: (RCTPromiseResolveBlock)resolve reject
|
2024-05-28 03:00:38 -06:00
|
|
|
: (RCTPromiseRejectBlock)reject)
|
2024-06-10 14:41:26 -06:00
|
|
|
|
2015-04-06 13:17:32 -06:00
|
|
|
@end
|