From 285e9ca8817ff7de4f6ac2d4cf51f944ef5237c9 Mon Sep 17 00:00:00 2001 From: virgil Date: Fri, 15 Apr 2022 17:29:56 +0800 Subject: [PATCH 01/31] =?UTF-8?q?fix:=20=F0=9F=90=9B=20support=20ios=20cam?= =?UTF-8?q?eraroll?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Video.js | 2 +- ios/Video/RCTVideo.m | 64 ++++++++++++++++++++++++++++---------------- 2 files changed, 42 insertions(+), 24 deletions(-) diff --git a/Video.js b/Video.js index b492d48b..6af4fc3a 100644 --- a/Video.js +++ b/Video.js @@ -275,7 +275,7 @@ export default class Video extends Component { } const isNetwork = !!(uri && uri.match(/^https?:/)); - const isAsset = !!(uri && uri.match(/^(assets-library|ipod-library|file|content|ms-appx|ms-appdata):/)); + const isAsset = !!(uri && uri.match(/^(assets-library|ph|ipod-library|file|content|ms-appx|ms-appdata):/)); let nativeResizeMode; const RCTVideoInstance = this.getViewManagerConfig('RCTVideo'); diff --git a/ios/Video/RCTVideo.m b/ios/Video/RCTVideo.m index a757c08a..f2255007 100644 --- a/ios/Video/RCTVideo.m +++ b/ios/Video/RCTVideo.m @@ -5,6 +5,7 @@ #import #include #include +#import static NSString *const statusKeyPath = @"status"; static NSString *const playbackLikelyToKeepUpKeyPath = @"playbackLikelyToKeepUp"; @@ -492,22 +493,22 @@ static int const RCTVideoUnset = -1; handler([AVPlayerItem playerItemWithAsset:mixComposition]); } -- (void)playerItemForSource:(NSDictionary *)source withCallback:(void(^)(AVPlayerItem *))handler -{ +- (void)loadAssetFromSource:(NSDictionary *)source withCallback:(void(^)(AVURLAsset *asset, NSMutableDictionary *assetOptions)) handler { bool isNetwork = [RCTConvert BOOL:[source objectForKey:@"isNetwork"]]; bool isAsset = [RCTConvert BOOL:[source objectForKey:@"isAsset"]]; bool shouldCache = [RCTConvert BOOL:[source objectForKey:@"shouldCache"]]; + NSString *uri = [source objectForKey:@"uri"]; NSString *type = [source objectForKey:@"type"]; - AVURLAsset *asset; + if (!uri || [uri isEqualToString:@""]) { DebugLog(@"Could not find video URL in source '%@'", source); return; } NSURL *url = isNetwork || isAsset - ? [NSURL URLWithString:uri] - : [[NSURL alloc] initFileURLWithPath:[[NSBundle mainBundle] pathForResource:uri ofType:type]]; + ? [NSURL URLWithString:uri] + : [[NSURL alloc] initFileURLWithPath:[[NSBundle mainBundle] pathForResource:uri ofType:type]]; NSMutableDictionary *assetOptions = [[NSMutableDictionary alloc] init]; if (isNetwork) { @@ -529,26 +530,43 @@ static int const RCTVideoUnset = -1; return; } #endif - - asset = [AVURLAsset URLAssetWithURL:url options:assetOptions]; + handler([AVURLAsset URLAssetWithURL:url options:assetOptions], assetOptions); } else if (isAsset) { - asset = [AVURLAsset URLAssetWithURL:url options:nil]; + if ([uri hasPrefix:@"ph://"]) { + NSString *assetId = [uri substringFromIndex:@"ph://".length]; + PHAsset *asset = [[PHAsset fetchAssetsWithLocalIdentifiers:@[assetId] options:nil] firstObject]; + PHVideoRequestOptions *options = [PHVideoRequestOptions new]; + options.networkAccessAllowed = YES; + + [[PHCachingImageManager new] requestAVAssetForVideo:asset options:options resultHandler:^(AVAsset * _Nullable asset, AVAudioMix * _Nullable audioMix, NSDictionary * _Nullable info) { + handler((AVURLAsset *)asset, assetOptions); + }]; + } else { + handler([AVURLAsset URLAssetWithURL:url options:nil], assetOptions); + } } else { - asset = [AVURLAsset URLAssetWithURL:[[NSURL alloc] initFileURLWithPath:[[NSBundle mainBundle] pathForResource:uri ofType:type]] options:nil]; + AVURLAsset *asset = [AVURLAsset URLAssetWithURL:[[NSURL alloc] initFileURLWithPath:[[NSBundle mainBundle] pathForResource:uri ofType:type]] options:nil]; + handler(asset, assetOptions); } - // Reset _loadingRequest - if (_loadingRequest != nil) { - [_loadingRequest finishLoading]; - } - _requestingCertificate = NO; - _requestingCertificateErrored = NO; - // End Reset _loadingRequest - if (self->_drm != nil) { - dispatch_queue_t queue = dispatch_queue_create("assetQueue", nil); - [asset.resourceLoader setDelegate:self queue:queue]; - } - - [self playerItemPrepareText:asset assetOptions:assetOptions withCallback:handler]; +} + +- (void)playerItemForSource:(NSDictionary *)source withCallback:(void(^)(AVPlayerItem *))handler +{ + [self loadAssetFromSource:source withCallback:^(AVURLAsset *asset, NSMutableDictionary *assetOptions) { + // Reset _loadingRequest + if (self->_loadingRequest != nil) { + [self->_loadingRequest finishLoading]; + } + self->_requestingCertificate = NO; + self->_requestingCertificateErrored = NO; + // End Reset _loadingRequest + if (self->_drm != nil) { + dispatch_queue_t queue = dispatch_queue_create("assetQueue", nil); + [asset.resourceLoader setDelegate:self queue:queue]; + } + + [self playerItemPrepareText:asset assetOptions:assetOptions withCallback:handler]; + }]; } #if __has_include() @@ -2028,4 +2046,4 @@ didCancelLoadingRequest:(AVAssetResourceLoadingRequest *)loadingRequest { } #endif -@end +@end \ No newline at end of file From 329df1d91abda9fd882c1ff2c1b7aa69a67bdb54 Mon Sep 17 00:00:00 2001 From: virgil Date: Fri, 15 Apr 2022 17:36:23 +0800 Subject: [PATCH 02/31] =?UTF-8?q?chore:=20=F0=9F=A4=96=20update=20changelo?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc7f5943..6dcc12f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ - Add Google's maven repository to avoid build error [#2552] (https://github.com/react-native-video/react-native-video/pull/2552) +- Fix crash when the source is a cameraroll [#2639] (https://github.com/react-native-video/react-native-video/pull/2639) + ### Version 5.2.0 - Fix for tvOS native audio menu language selector From 8782755cd6bbb99dbbfb2751fddf2125fdad84b1 Mon Sep 17 00:00:00 2001 From: olivier bouillet Date: Wed, 27 Apr 2022 21:26:37 +0200 Subject: [PATCH 03/31] fix(android, exoplayer): ensure playback progress is reported even if paused --- .../exoplayer/ReactExoplayerView.java | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java index b8c9a555..d617ca5e 100644 --- a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java +++ b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java @@ -165,21 +165,30 @@ class ReactExoplayerView extends FrameLayout implements private final AudioManager audioManager; private final AudioBecomingNoisyReceiver audioBecomingNoisyReceiver; + // store last progress event values to avoid sending unnecessary messages + private long lastPos = -1; + private long lastBufferDuration = -1; + private long lastDuration = -1; + private final Handler progressHandler = new Handler() { @Override public void handleMessage(Message msg) { switch (msg.what) { case SHOW_PROGRESS: - if (player != null - && player.getPlaybackState() == Player.STATE_READY - && player.getPlayWhenReady() - ) { - long pos = player.getCurrentPosition(); - long bufferedDuration = player.getBufferedPercentage() * player.getDuration() / 100; + long pos = player.getCurrentPosition(); + long bufferedDuration = player.getBufferedPercentage() * player.getDuration() / 100; + long duration = player.getDuration(); + + if (lastPos != pos + || lastBufferDuration != bufferedDuration + || lastDuration != duration) { + lastPos = pos; + lastBufferDuration = bufferedDuration; + lastDuration = duration; eventEmitter.progressChanged(pos, bufferedDuration, player.getDuration(), getPositionInFirstPeriodMsForCurrentWindow(pos)); - msg = obtainMessage(SHOW_PROGRESS); - sendMessageDelayed(msg, Math.round(mProgressUpdateInterval)); } + msg = obtainMessage(SHOW_PROGRESS); + sendMessageDelayed(msg, Math.round(mProgressUpdateInterval)); break; } } From a019f258267af890f897211bb5f2f0a921aacbe8 Mon Sep 17 00:00:00 2001 From: olivier bouillet Date: Wed, 27 Apr 2022 21:32:26 +0200 Subject: [PATCH 04/31] chore: upgrade changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index edb1f2c6..a544345a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ### Version 6.0.0-alpha1 +- Fix Exoplayer progress not reported when paused [#2664](https://github.com/react-native-video/react-native-video/pull/2664) - Add Google's maven repository to avoid build error [#2552](https://github.com/react-native-video/react-native-video/pull/2552) - Fix iOS 15.4 HLS playback race condition [#2633](https://github.com/react-native-video/react-native-video/pull/2633) - Add fullscreen support on Android [#2073](https://github.com/react-native-video/react-native-video/pull/2073) From c9ecc8e9e03cb68b82ffba6f105f7e282d389de1 Mon Sep 17 00:00:00 2001 From: nbennink Date: Thu, 12 May 2022 14:45:02 +0200 Subject: [PATCH 05/31] fix(texttracks): unable to disable sideloaded texttracks in the AVPlayer --- ios/Video/RCTVideo.m | 73 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 60 insertions(+), 13 deletions(-) diff --git a/ios/Video/RCTVideo.m b/ios/Video/RCTVideo.m index cd01cc4e..b690eb4c 100644 --- a/ios/Video/RCTVideo.m +++ b/ios/Video/RCTVideo.m @@ -65,7 +65,7 @@ static int const RCTVideoUnset = -1; BOOL _paused; BOOL _repeat; BOOL _allowsExternalPlayback; - NSArray * _textTracks; + NSMutableArray * _textTracks; NSDictionary * _selectedTextTrack; NSDictionary * _selectedAudioTrack; BOOL _playbackStalled; @@ -97,7 +97,7 @@ static int const RCTVideoUnset = -1; { if ((self = [super init])) { _eventDispatcher = eventDispatcher; - _automaticallyWaitsToMinimizeStalling = YES; + _automaticallyWaitsToMinimizeStalling = YES; _playbackRateObserverRegistered = NO; _isExternalPlaybackActiveObserverRegistered = NO; _playbackStalled = NO; @@ -418,16 +418,18 @@ static int const RCTVideoUnset = -1; _drm = drm; } -- (NSURL*) urlFilePath:(NSString*) filepath { +- (NSURL*) urlFilePath:(NSString*) filepath searchPath:(enum NSSearchPathDirectory) searchPath { if ([filepath containsString:@"file://"]) { return [NSURL URLWithString:filepath]; } - // if no file found, check if the file exists in the Document directory - NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); + // if no file found, check if the file exists in the given searchPath + NSArray *paths = NSSearchPathForDirectoriesInDomains(searchPath, NSUserDomainMask, YES); NSString* relativeFilePath = [filepath lastPathComponent]; - // the file may be multiple levels below the documents directory - NSArray* fileComponents = [filepath componentsSeparatedByString:@"Documents/"]; + + // the file may be multiple levels below the in the given searchPath + NSString *directoryString = searchPath == NSCachesDirectory ? @"Library/Caches/" : @"Documents/"; + NSArray *fileComponents = [filepath componentsSeparatedByString:directoryString]; if (fileComponents.count > 1) { relativeFilePath = [fileComponents objectAtIndex:1]; } @@ -467,13 +469,22 @@ static int const RCTVideoUnset = -1; error:nil]; NSMutableArray* validTextTracks = [NSMutableArray array]; + + NSMutableDictionary *emptyVttTrack = [self createDisabledVttFile]; + if (emptyVttTrack) [_textTracks addObject:emptyVttTrack]; + for (int i = 0; i < _textTracks.count; ++i) { AVURLAsset *textURLAsset; NSString *textUri = [_textTracks objectAtIndex:i][@"uri"]; if ([[textUri lowercaseString] hasPrefix:@"http"]) { textURLAsset = [AVURLAsset URLAssetWithURL:[NSURL URLWithString:textUri] options:assetOptions]; } else { - textURLAsset = [AVURLAsset URLAssetWithURL:[self urlFilePath:textUri] options:nil]; + BOOL isDisabledTrack = [[_textTracks objectAtIndex:i][@"language"] isEqualToString:@"disabled"]; + + // Search the track to disabled subtitles in the Caches directory, search every other local file in the Documents directory + NSSearchPathDirectory searchPath = isDisabledTrack ? NSCachesDirectory : NSDocumentDirectory; + NSURL *assetUrl = [self urlFilePath:textUri searchPath:searchPath]; + textURLAsset = [AVURLAsset URLAssetWithURL:assetUrl options:nil]; } AVAssetTrack *textTrackAsset = [textURLAsset tracksWithMediaType:AVMediaTypeText].firstObject; if (!textTrackAsset) continue; // fix when there's no textTrackAsset @@ -493,6 +504,36 @@ static int const RCTVideoUnset = -1; handler([AVPlayerItem playerItemWithAsset:mixComposition]); } +/* + * Create an useless / almost empty VTT file in the list with available tracks. This track gets selected when you give type: "disabled" as the selectedTextTrack + * This is needed because there is a bug where sideloaded texttracks cannot be disabled in the AVPlayer. Loading this VTT file instead solves that problem. + * For more info see: https://github.com/react-native-community/react-native-video/issues/1144 + */ +- (NSMutableDictionary*)createDisabledVttFile { + NSError *error; + NSMutableDictionary *emptyVTTDictionary = nil; + + // Write the file into the Caches directory because that directory is available on iOS and tvOS + NSString *filePath = [[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject] stringByAppendingPathComponent:@"empty.vtt"]; + + if (![[NSFileManager defaultManager] isReadableFileAtPath:filePath]){ + // WebVTT should have at least 1 cue to be valid. That's why a small dot is visible for 1 ms at the 99:59:59.000 timestamp + NSString *stringToWrite = @"WEBVTT\n\n1\n99:59:59.000 --> 99:59:59.001\n."; + + [stringToWrite writeToFile:filePath atomically:YES encoding:NSUTF8StringEncoding error:&error]; + } + + if (!error){ + emptyVTTDictionary = [[NSMutableDictionary alloc] init]; + emptyVTTDictionary[@"language"] = @"disabled"; + emptyVTTDictionary[@"title"] = @"EmptyVttFile"; + emptyVTTDictionary[@"uri"] = filePath; + emptyVTTDictionary[@"type"] = @"text/vtt"; + } + + return emptyVTTDictionary; +} + - (void)playerItemForSource:(NSDictionary *)source withCallback:(void(^)(AVPlayerItem *))handler { bool isNetwork = [RCTConvert BOOL:[source objectForKey:@"isNetwork"]]; @@ -1037,8 +1078,8 @@ static int const RCTVideoUnset = -1; - (void)setAutomaticallyWaitsToMinimizeStalling:(BOOL)waits { - _automaticallyWaitsToMinimizeStalling = waits; - _player.automaticallyWaitsToMinimizeStalling = waits; + _automaticallyWaitsToMinimizeStalling = waits; + _player.automaticallyWaitsToMinimizeStalling = waits; } @@ -1183,9 +1224,10 @@ static int const RCTVideoUnset = -1; } int selectedTrackIndex = RCTVideoUnset; - + if ([type isEqualToString:@"disabled"]) { - // Do nothing. We want to ensure option is nil + // Enable the empty texttrack + [_player.currentItem.tracks[_player.currentItem.tracks.count - 1] setEnabled:YES]; } else if ([type isEqualToString:@"language"]) { NSString *selectedValue = _selectedTextTrack[@"value"]; for (int i = 0; i < textTracks.count; ++i) { @@ -1324,17 +1366,22 @@ static int const RCTVideoUnset = -1; mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicLegible]; for (int i = 0; i < group.options.count; ++i) { AVMediaSelectionOption *currentOption = [group.options objectAtIndex:i]; + NSString *language = [currentOption extendedLanguageTag] ? [currentOption extendedLanguageTag] : @""; + + // Ignore the texttrack with language disabled. This is not a real texttrack and can be ignored + if ([language isEqualToString:@"disabled"]) continue; + NSString *title = @""; NSArray *values = [[currentOption commonMetadata] valueForKey:@"value"]; if (values.count > 0) { title = [values objectAtIndex:0]; } - NSString *language = [currentOption extendedLanguageTag] ? [currentOption extendedLanguageTag] : @""; NSDictionary *textTrack = @{ @"index": [NSNumber numberWithInt:i], @"title": title, @"language": language }; + [textTracks addObject:textTrack]; } return textTracks; From 1597d7f7c81e007479af2d6d34f655aa25ec7ba6 Mon Sep 17 00:00:00 2001 From: nbennink Date: Mon, 13 Jun 2022 11:42:12 +0200 Subject: [PATCH 06/31] style: change temporary debug name --- ios/Video/Features/RCTVideoUtils.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/Video/Features/RCTVideoUtils.swift b/ios/Video/Features/RCTVideoUtils.swift index c75d2a1d..d8ec8677 100644 --- a/ios/Video/Features/RCTVideoUtils.swift +++ b/ios/Video/Features/RCTVideoUtils.swift @@ -236,7 +236,7 @@ enum RCTVideoUtils { static func createEmptyVttFile() -> TextTrack? { let fileManager = FileManager.default let cachesDirectoryUrl = fileManager.urls(for: .cachesDirectory, in: .userDomainMask)[0] - let filePath = cachesDirectoryUrl.appendingPathComponent("kaas.vtt").path + let filePath = cachesDirectoryUrl.appendingPathComponent("empty.vtt").path if !fileManager.fileExists(atPath: filePath) { let stringToWrite = "WEBVTT\n\n1\n99:59:59.000 --> 99:59:59.001\n." From e33e2a9cb5abbaf132bcf832469821dc1dca9665 Mon Sep 17 00:00:00 2001 From: olivier bouillet Date: Wed, 15 Jun 2022 22:04:57 +0200 Subject: [PATCH 07/31] chore(exoplayer): ensure no NPE happen --- .../exoplayer/ReactExoplayerView.java | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java index f960dd63..69e0c516 100644 --- a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java +++ b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java @@ -215,20 +215,22 @@ class ReactExoplayerView extends FrameLayout implements public void handleMessage(Message msg) { switch (msg.what) { case SHOW_PROGRESS: - long pos = player.getCurrentPosition(); - long bufferedDuration = player.getBufferedPercentage() * player.getDuration() / 100; - long duration = player.getDuration(); + if (player != null) { + long pos = player.getCurrentPosition(); + long bufferedDuration = player.getBufferedPercentage() * player.getDuration() / 100; + long duration = player.getDuration(); - if (lastPos != pos - || lastBufferDuration != bufferedDuration - || lastDuration != duration) { - lastPos = pos; - lastBufferDuration = bufferedDuration; - lastDuration = duration; - eventEmitter.progressChanged(pos, bufferedDuration, player.getDuration(), getPositionInFirstPeriodMsForCurrentWindow(pos)); + if (lastPos != pos + || lastBufferDuration != bufferedDuration + || lastDuration != duration) { + lastPos = pos; + lastBufferDuration = bufferedDuration; + lastDuration = duration; + eventEmitter.progressChanged(pos, bufferedDuration, player.getDuration(), getPositionInFirstPeriodMsForCurrentWindow(pos)); + } + msg = obtainMessage(SHOW_PROGRESS); + sendMessageDelayed(msg, Math.round(mProgressUpdateInterval)); } - msg = obtainMessage(SHOW_PROGRESS); - sendMessageDelayed(msg, Math.round(mProgressUpdateInterval)); break; } } From f800776508e7aee77dc4d8f7bbf0aa19a77ab0f9 Mon Sep 17 00:00:00 2001 From: Eran Hammer Date: Thu, 23 Jun 2022 13:31:34 -0700 Subject: [PATCH 08/31] Port of #1493. Closes #2478. --- .../main/java/com/brentvatne/exoplayer/ReactExoplayerView.java | 1 + 1 file changed, 1 insertion(+) diff --git a/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java b/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java index 69e0c516..3dccad93 100644 --- a/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java +++ b/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java @@ -956,6 +956,7 @@ class ReactExoplayerView extends FrameLayout implements int playbackState = player.getPlaybackState(); boolean playWhenReady = player.getPlayWhenReady(); String text = "onStateChanged: playWhenReady=" + playWhenReady + ", playbackState="; + eventEmitter.playbackRateChange(playWhenReady && playbackState == ExoPlayer.STATE_READY ? 1.0f : 0.0f); switch (playbackState) { case Player.STATE_IDLE: text += "idle"; From 52eb556c50083b338c79464120e4f033726928b1 Mon Sep 17 00:00:00 2001 From: Eran Hammer Date: Thu, 23 Jun 2022 13:32:16 -0700 Subject: [PATCH 09/31] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8688ad75..7c9bef79 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ### Version 6.0.0-alpha.2 - Fix Exoplayer progress not reported when paused [#2664](https://github.com/react-native-video/react-native-video/pull/2664) +- Call playbackRateChange onPlay and onPause [#1493](https://github.com/react-native-video/react-native-video/pull/1493) ### Version 6.0.0-alpha.1 From a6750e7b483b4f7404e0c6f7d00d5fe8176a3665 Mon Sep 17 00:00:00 2001 From: Eran Hammer Date: Thu, 23 Jun 2022 14:31:01 -0700 Subject: [PATCH 10/31] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c9bef79..f705bdc3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Fix Exoplayer progress not reported when paused [#2664](https://github.com/react-native-video/react-native-video/pull/2664) - Call playbackRateChange onPlay and onPause [#1493](https://github.com/react-native-video/react-native-video/pull/1493) +- Fix being unable to disable sideloaded texttracks in the AVPlayer [#2679](https://github.com/react-native-video/react-native-video/pull/2679) ### Version 6.0.0-alpha.1 From c2b0ce735fa526a1d1f750bbf3e397ffd76afd40 Mon Sep 17 00:00:00 2001 From: Eran Hammer Date: Thu, 23 Jun 2022 21:39:55 +0000 Subject: [PATCH 11/31] Move file --- DRM.md => docs/DRM.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename DRM.md => docs/DRM.md (100%) diff --git a/DRM.md b/docs/DRM.md similarity index 100% rename from DRM.md rename to docs/DRM.md From b10de93128167fad1630fba4d9f18ea2e304fd08 Mon Sep 17 00:00:00 2001 From: olivier bouillet Date: Thu, 23 Jun 2022 23:51:52 +0200 Subject: [PATCH 12/31] fix(android): ensure we don't disable playback when player is ENDED (issue #2690) --- .../java/com/brentvatne/exoplayer/ReactExoplayerView.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java b/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java index 3dccad93..775067bb 100644 --- a/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java +++ b/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java @@ -815,7 +815,10 @@ class ReactExoplayerView extends FrameLayout implements player.setPlayWhenReady(true); } } else { - player.setPlayWhenReady(false); + // ensure playback is not ENDED, else it will trigger another ended event + if (player.getPlaybackState() != Player.STATE_ENDED) { + player.setPlayWhenReady(false); + } } } From 2a54474a18fdd8f8289c0444049ecea2a9ea2f71 Mon Sep 17 00:00:00 2001 From: Igor Tironi Date: Fri, 24 Jun 2022 15:51:26 -0700 Subject: [PATCH 13/31] Added missing NSError initialization params --- ios/Video/Features/RCTPlayerOperations.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/Video/Features/RCTPlayerOperations.swift b/ios/Video/Features/RCTPlayerOperations.swift index 27d085c9..cd0ddfec 100644 --- a/ios/Video/Features/RCTPlayerOperations.swift +++ b/ios/Video/Features/RCTPlayerOperations.swift @@ -178,7 +178,7 @@ enum RCTPlayerOperations { return Promise(on: .global()) { fulfill, reject in guard CMTimeCompare(current, cmSeekTime) != 0 else { - reject(NSError()) + reject(NSError(domain: "", code: 0, userInfo: nil)) return } if !paused { player.pause() } From 85e35f452810c7935105d3b7ae95f476cc716be0 Mon Sep 17 00:00:00 2001 From: Igor Tironi Date: Fri, 24 Jun 2022 15:56:23 -0700 Subject: [PATCH 14/31] added fix to changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f705bdc3..a0778647 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - Fix Exoplayer progress not reported when paused [#2664](https://github.com/react-native-video/react-native-video/pull/2664) - Call playbackRateChange onPlay and onPause [#1493](https://github.com/react-native-video/react-native-video/pull/1493) - Fix being unable to disable sideloaded texttracks in the AVPlayer [#2679](https://github.com/react-native-video/react-native-video/pull/2679) +- Fixed crash when iOS seek method called reject on the promise [#2743](https://github.com/react-native-video/react-native-video/pull/2743) ### Version 6.0.0-alpha.1 From 4a558f4b3252cc4d50935d1e7d61cb1ccfac79d5 Mon Sep 17 00:00:00 2001 From: evkwan Date: Tue, 3 May 2022 14:24:56 +0800 Subject: [PATCH 15/31] #2665 - fix maxbitrate property being ignored on Android due to selected track overwrite --- .../com/brentvatne/exoplayer/ReactExoplayerView.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java b/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java index 3dccad93..34243658 100644 --- a/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java +++ b/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java @@ -1017,9 +1017,15 @@ class ReactExoplayerView extends FrameLayout implements private void videoLoaded() { if (loadVideoStarted) { loadVideoStarted = false; - setSelectedAudioTrack(audioTrackType, audioTrackValue); - setSelectedVideoTrack(videoTrackType, videoTrackValue); - setSelectedTextTrack(textTrackType, textTrackValue); + if (audioTrackType != null) { + setSelectedAudioTrack(audioTrackType, audioTrackValue); + } + if (videoTrackType != null) { + setSelectedVideoTrack(videoTrackType, videoTrackValue); + } + if (textTrackType != null) { + setSelectedTextTrack(textTrackType, textTrackValue); + } Format videoFormat = player.getVideoFormat(); int width = videoFormat != null ? videoFormat.width : 0; int height = videoFormat != null ? videoFormat.height : 0; From 384166b285b8c52b24591dd81b87ffab198e7230 Mon Sep 17 00:00:00 2001 From: evkwan Date: Mon, 4 Jul 2022 01:03:31 +0800 Subject: [PATCH 16/31] - update changelog with pr number --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f705bdc3..85d378bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,7 @@ - Fixed Android seeking bug [#2712](https://github.com/react-native-video/react-native-video/pull/2712) - Fixed `onReadyForDisplay` not being called [#2721](https://github.com/react-native-video/react-native-video/pull/2721) - Fix type of `_eventDispatcher` on iOS target to match `bridge.eventDispatcher()` [#2720](https://github.com/react-native-video/react-native-video/pull/2720) +- Fix maxBitRate property being ignored on Android [#2670](https://github.com/react-native-video/react-native-video/pull/2670) ### Version 5.2.0 From 95a55a255125e70c852915ee5e0112224573e056 Mon Sep 17 00:00:00 2001 From: evkwan Date: Tue, 3 May 2022 14:46:11 +0800 Subject: [PATCH 17/31] - fix spacing --- .../java/com/brentvatne/exoplayer/ReactExoplayerView.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java b/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java index 34243658..9da4fe0c 100644 --- a/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java +++ b/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java @@ -1020,10 +1020,10 @@ class ReactExoplayerView extends FrameLayout implements if (audioTrackType != null) { setSelectedAudioTrack(audioTrackType, audioTrackValue); } - if (videoTrackType != null) { + if (videoTrackType != null) { setSelectedVideoTrack(videoTrackType, videoTrackValue); } - if (textTrackType != null) { + if (textTrackType != null) { setSelectedTextTrack(textTrackType, textTrackValue); } Format videoFormat = player.getVideoFormat(); From 12189a94eb1968d278902948c0db7a8db6e8350d Mon Sep 17 00:00:00 2001 From: evkwan Date: Tue, 3 May 2022 14:47:43 +0800 Subject: [PATCH 18/31] - fix spacing issue --- .../brentvatne/exoplayer/ReactExoplayerView.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java b/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java index 9da4fe0c..fdbbff44 100644 --- a/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java +++ b/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java @@ -1018,14 +1018,14 @@ class ReactExoplayerView extends FrameLayout implements if (loadVideoStarted) { loadVideoStarted = false; if (audioTrackType != null) { - setSelectedAudioTrack(audioTrackType, audioTrackValue); - } - if (videoTrackType != null) { - setSelectedVideoTrack(videoTrackType, videoTrackValue); - } - if (textTrackType != null) { - setSelectedTextTrack(textTrackType, textTrackValue); - } + setSelectedAudioTrack(audioTrackType, audioTrackValue); + } + if (videoTrackType != null) { + setSelectedVideoTrack(videoTrackType, videoTrackValue); + } + if (textTrackType != null) { + setSelectedTextTrack(textTrackType, textTrackValue); + } Format videoFormat = player.getVideoFormat(); int width = videoFormat != null ? videoFormat.width : 0; int height = videoFormat != null ? videoFormat.height : 0; From b64c7dbea5f0d9479267e10d1c125dc26cb66dd8 Mon Sep 17 00:00:00 2001 From: olivier bouillet Date: Tue, 5 Jul 2022 23:58:30 +0200 Subject: [PATCH 19/31] feat: add support of subtitles style configuration --- API.md | 18 +++++++++ Video.js | 7 ++++ .../java/com/brentvatne/ReactBridgeUtils.java | 22 +++++++++++ .../brentvatne/exoplayer/ExoPlayerView.java | 11 ++++++ .../exoplayer/ReactExoplayerView.java | 4 ++ .../exoplayer/ReactExoplayerViewManager.java | 7 ++++ .../brentvatne/exoplayer/SubtitleStyle.java | 38 +++++++++++++++++++ 7 files changed, 107 insertions(+) create mode 100644 android/src/main/java/com/brentvatne/ReactBridgeUtils.java create mode 100644 android/src/main/java/com/brentvatne/exoplayer/SubtitleStyle.java diff --git a/API.md b/API.md index 9ac52616..eb1f2eb0 100644 --- a/API.md +++ b/API.md @@ -304,6 +304,7 @@ var styles = StyleSheet.create({ |[selectedTextTrack](#selectedtexttrack)|Android, iOS| |[selectedVideoTrack](#selectedvideotrack)|Android| |[source](#source)|All| +|[subtitleStyle](#subtitleStyle)|Android| |[textTracks](#texttracks)|Android, iOS| |[trackId](#trackId)|Android| |[useTextureView](#usetextureview)|Android| @@ -835,6 +836,23 @@ The following other types are supported on some platforms, but aren't fully docu `content://, ms-appx://, ms-appdata://, assets-library://` +#### subtitleStyle + +Property | Description | Platforms +--- | --- | --- +fontSizeTrack | Adjust the font size of the subtitles. Default: font size of the device | Android +paddingTop | Adjust the top padding of the subtitles. Default: 0| Android +paddingBottom | Adjust the bottom padding of the subtitles. Default: 0| Android +paddingLeft | Adjust the left padding of the subtitles. Default: 0| Android +paddingRight | Adjust the right padding of the subtitles. Default: 0| Android + + +Example: + +``` +subtitleStyle={{ paddingBottom: 50, fontSize: 20 }} +``` + #### textTracks Load one or more "sidecar" text tracks. This takes an array of objects representing each track. Each object should have the format: diff --git a/Video.js b/Video.js index dad262b9..f3d96278 100644 --- a/Video.js +++ b/Video.js @@ -489,6 +489,13 @@ Video.propTypes = { fullscreenAutorotate: PropTypes.bool, fullscreenOrientation: PropTypes.oneOf(['all', 'landscape', 'portrait']), progressUpdateInterval: PropTypes.number, + subtitleStyle: PropTypes.shape({ + paddingTop: PropTypes.number, + paddingBottom: PropTypes.number, + paddingLeft: PropTypes.number, + paddingRight: PropTypes.number, + fontSize: PropTypes.number, + }), useTextureView: PropTypes.bool, useSecureView: PropTypes.bool, hideShutterView: PropTypes.bool, diff --git a/android/src/main/java/com/brentvatne/ReactBridgeUtils.java b/android/src/main/java/com/brentvatne/ReactBridgeUtils.java new file mode 100644 index 00000000..c3391283 --- /dev/null +++ b/android/src/main/java/com/brentvatne/ReactBridgeUtils.java @@ -0,0 +1,22 @@ +package com.brentvatne; + +import com.facebook.react.bridge.ReadableMap; + +/* +* This file define static helpers to parse in an easier way input props + */ +public class ReactBridgeUtils { + /* + retrieve key from map as int. fallback is returned if not available + */ + static public int safeGetInt(ReadableMap map, String key, int fallback) { + return map != null && map.hasKey(key) && !map.isNull(key) ? map.getInt(key) : fallback; + } + + /* + retrieve key from map as double. fallback is returned if not available + */ + static public double safeGetDouble(ReadableMap map, String key, double fallback) { + return map != null && map.hasKey(key) && !map.isNull(key) ? map.getDouble(key) : fallback; + } +} diff --git a/android/src/main/java/com/brentvatne/exoplayer/ExoPlayerView.java b/android/src/main/java/com/brentvatne/exoplayer/ExoPlayerView.java index a6cd1c4f..8c97298a 100644 --- a/android/src/main/java/com/brentvatne/exoplayer/ExoPlayerView.java +++ b/android/src/main/java/com/brentvatne/exoplayer/ExoPlayerView.java @@ -5,6 +5,7 @@ import android.content.Context; import androidx.core.content.ContextCompat; import android.util.AttributeSet; import android.util.Log; +import android.util.TypedValue; import android.view.Gravity; import android.view.SurfaceView; import android.view.TextureView; @@ -100,6 +101,16 @@ public final class ExoPlayerView extends FrameLayout { player.setVideoSurfaceView((SurfaceView) surfaceView); } } + public void setSubtitleStyle(SubtitleStyle style) { + // ensure we reset subtile style before reapplying it + subtitleLayout.setUserDefaultStyle(); + subtitleLayout.setUserDefaultTextSize(); + + if (style.getFontSize() > 0) { + subtitleLayout.setFixedTextSize(TypedValue.COMPLEX_UNIT_SP, style.getFontSize()); + } + subtitleLayout.setPadding(style.getPaddingLeft(), style.getPaddingTop(), style.getPaddingRight(), style.getPaddingBottom()); + } private void updateSurfaceView() { View view; diff --git a/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java b/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java index 3dccad93..7e77c4e9 100644 --- a/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java +++ b/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java @@ -1838,4 +1838,8 @@ class ReactExoplayerView extends FrameLayout implements } } } + + public void setSubtitleStyle(SubtitleStyle style) { + exoPlayerView.setSubtitleStyle(style); + } } diff --git a/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerViewManager.java b/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerViewManager.java index 3744fcae..ce1d6a8c 100644 --- a/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerViewManager.java +++ b/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerViewManager.java @@ -79,6 +79,8 @@ public class ReactExoplayerViewManager extends ViewGroupManager Date: Wed, 13 Jul 2022 22:42:33 -0700 Subject: [PATCH 20/31] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9fbac5b..2ccff1ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Call playbackRateChange onPlay and onPause [#1493](https://github.com/react-native-video/react-native-video/pull/1493) - Fix being unable to disable sideloaded texttracks in the AVPlayer [#2679](https://github.com/react-native-video/react-native-video/pull/2679) - Fixed crash when iOS seek method called reject on the promise [#2743](https://github.com/react-native-video/react-native-video/pull/2743) +- Fix maxBitRate property being ignored on Android [#2670](https://github.com/react-native-video/react-native-video/pull/2670) ### Version 6.0.0-alpha.1 @@ -53,7 +54,6 @@ - Fixed Android seeking bug [#2712](https://github.com/react-native-video/react-native-video/pull/2712) - Fixed `onReadyForDisplay` not being called [#2721](https://github.com/react-native-video/react-native-video/pull/2721) - Fix type of `_eventDispatcher` on iOS target to match `bridge.eventDispatcher()` [#2720](https://github.com/react-native-video/react-native-video/pull/2720) -- Fix maxBitRate property being ignored on Android [#2670](https://github.com/react-native-video/react-native-video/pull/2670) ### Version 5.2.0 From f7aeb7295064631d2c45e95ec8013ea6289e36c9 Mon Sep 17 00:00:00 2001 From: wood1986 <5212215+wood1986@users.noreply.github.com> Date: Thu, 14 Jul 2022 11:58:50 -0700 Subject: [PATCH 21/31] fix: fix the play button no shown after pausing video at the very first time --- .../com/brentvatne/exoplayer/ReactExoplayerView.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java b/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java index 3dccad93..bf28f998 100644 --- a/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java +++ b/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java @@ -403,6 +403,15 @@ class ReactExoplayerView extends FrameLayout implements eventListener = new Player.Listener() { @Override public void onPlaybackStateChanged(int playbackState) { + View playButton = playerControlView.findViewById(R.id.exo_play); + View pauseButton = playerControlView.findViewById(R.id.exo_pause); + if (playButton != null && playButton.getVisibility() == GONE) { + playButton.setVisibility(INVISIBLE); + } + if (pauseButton != null && pauseButton.getVisibility() == GONE) { + pauseButton.setVisibility(INVISIBLE); + } + reLayout(playPauseControlContainer); //Remove this eventListener once its executed. since UI will work fine once after the reLayout is done player.removeListener(eventListener); From fcea0ffcea051b284135514d11e91ff8269bacec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=9B=A6?= Date: Wed, 27 Jul 2022 21:13:47 +0800 Subject: [PATCH 22/31] =?UTF-8?q?refactor:=20=F0=9F=92=A1=20support=20came?= =?UTF-8?q?ra=20video=20for=20swift?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ios/Video/Features/RCTVideoUtils.swift | 15 ++++++++++++++- ios/Video/RCTVideo.swift | 18 ++++++++++++++---- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/ios/Video/Features/RCTVideoUtils.swift b/ios/Video/Features/RCTVideoUtils.swift index d8ec8677..46cce42a 100644 --- a/ios/Video/Features/RCTVideoUtils.swift +++ b/ios/Video/Features/RCTVideoUtils.swift @@ -1,5 +1,6 @@ import AVFoundation import Promises +import Photos /*! * Collection of pure functions @@ -264,8 +265,20 @@ enum RCTVideoUtils { } } + static func preparePHAsset(uri: String) -> Promise { + return Promise(on: .global()) { fulfill, reject in + let assetId = String(uri[uri.index(uri.startIndex, offsetBy: "ph://".count)...]) + let phAsset = PHAsset.fetchAssets(withLocalIdentifiers: [assetId], options: nil).firstObject + let options = PHVideoRequestOptions() + options.isNetworkAccessAllowed = true + PHCachingImageManager().requestAVAsset(forVideo: phAsset!, options: options) { data, _, _ in + fulfill(data) + } + } + } + static func prepareAsset(source:VideoSource) -> (asset:AVURLAsset?, assetOptions:NSMutableDictionary?)? { - guard source.uri != nil && source.uri != "" else { return nil } + guard let sourceUri = source.uri, sourceUri != "" else { return nil } var asset:AVURLAsset! let bundlePath = Bundle.main.path(forResource: source.uri, ofType: source.type) ?? "" let url = source.isNetwork || source.isAsset diff --git a/ios/Video/RCTVideo.swift b/ios/Video/RCTVideo.swift index 59973a36..a339aff4 100644 --- a/ios/Video/RCTVideo.swift +++ b/ios/Video/RCTVideo.swift @@ -227,10 +227,20 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH RCTVideoUtils.delay() .then{ [weak self] in guard let self = self else {throw NSError(domain: "", code: 0, userInfo: nil)} - guard let source = self._source, - let assetResult = RCTVideoUtils.prepareAsset(source: source), - let asset = assetResult.asset, - let assetOptions = assetResult.assetOptions else { + guard let source = self._source else { + DebugLog("The source not exist") + throw NSError(domain: "", code: 0, userInfo: nil) + } + if let uri = source.uri, uri.starts(with: "ph://") { + return Promise { + RCTVideoUtils.preparePHAsset(uri: uri).then { asset in + return self.playerItemPrepareText(asset:asset, assetOptions:nil) + } + } + } + guard let assetResult = RCTVideoUtils.prepareAsset(source: source), + let asset = assetResult.asset, + let assetOptions = assetResult.assetOptions else { DebugLog("Could not find video URL in source '\(self._source)'") throw NSError(domain: "", code: 0, userInfo: nil) } From cee650c84cb37f31b2596ae1181ea36f0c80bb5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=9B=A6?= Date: Wed, 27 Jul 2022 21:34:08 +0800 Subject: [PATCH 23/31] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20add=20exception=20?= =?UTF-8?q?catch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ios/Video/Features/RCTVideoUtils.swift | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ios/Video/Features/RCTVideoUtils.swift b/ios/Video/Features/RCTVideoUtils.swift index 46cce42a..50df8e3f 100644 --- a/ios/Video/Features/RCTVideoUtils.swift +++ b/ios/Video/Features/RCTVideoUtils.swift @@ -268,10 +268,13 @@ enum RCTVideoUtils { static func preparePHAsset(uri: String) -> Promise { return Promise(on: .global()) { fulfill, reject in let assetId = String(uri[uri.index(uri.startIndex, offsetBy: "ph://".count)...]) - let phAsset = PHAsset.fetchAssets(withLocalIdentifiers: [assetId], options: nil).firstObject + guard let phAsset = PHAsset.fetchAssets(withLocalIdentifiers: [assetId], options: nil).firstObject else { + reject(NSError(domain: "", code: 0, userInfo: nil)) + return + } let options = PHVideoRequestOptions() options.isNetworkAccessAllowed = true - PHCachingImageManager().requestAVAsset(forVideo: phAsset!, options: options) { data, _, _ in + PHCachingImageManager().requestAVAsset(forVideo: phAsset, options: options) { data, _, _ in fulfill(data) } } From f990ec9de12977d87673f587b72d0987d6c61a0b Mon Sep 17 00:00:00 2001 From: olivier bouillet Date: Mon, 1 Aug 2022 15:51:10 +0200 Subject: [PATCH 24/31] fix: invalid doc path --- API.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/API.md b/API.md index 9ac52616..6d276cd0 100644 --- a/API.md +++ b/API.md @@ -436,7 +436,7 @@ Determines if the player needs to throw an error when connection is lost or not Platforms: Android ### DRM -To setup DRM please follow [this guide](./DRM.md) +To setup DRM please follow [this guide](./docs/DRM.md) Platforms: Android, iOS From edd0d4ec83f039bf7114ad35b4fbb8ea5f7a58ab Mon Sep 17 00:00:00 2001 From: olivier bouillet Date: Mon, 1 Aug 2022 15:51:57 +0200 Subject: [PATCH 25/31] chore: add warning in changelog to manage library upgrade to V6 --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0778647..72d42d7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ ### Version 6.0.0-alpha.1 - Remove Android MediaPlayer support [#2724](https://github.com/react-native-video/react-native-video/pull/2724) + **WARNING**: when switching from older version to V6, you need to remove all refrerences of android-exoplayer. This android-exoplayer folder has been renamed to android. Exoplayer is now the only player implementation supported. + - Replace Image.propTypes with ImagePropTypes. [#2718](https://github.com/react-native-video/react-native-video/pull/2718) - Fix iOS build caused by type mismatch [#2720](https://github.com/react-native-video/react-native-video/pull/2720) - ERROR TypeError: undefined is not an object (evaluating '_reactNative.Image.propTypes.resizeMode') [#2714](https://github.com/react-native-video/react-native-video/pull/2714) From efc94d7f2cfa0cb9203c3a8c0aa49f6abfa82557 Mon Sep 17 00:00:00 2001 From: Matthew Leffler Date: Mon, 1 Aug 2022 16:07:25 -0600 Subject: [PATCH 26/31] docs: Fix page path --- API.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/API.md b/API.md index 9ac52616..6d276cd0 100644 --- a/API.md +++ b/API.md @@ -436,7 +436,7 @@ Determines if the player needs to throw an error when connection is lost or not Platforms: Android ### DRM -To setup DRM please follow [this guide](./DRM.md) +To setup DRM please follow [this guide](./docs/DRM.md) Platforms: Android, iOS From 1631e5de5230d1d18b12389c137537e6b602e425 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=9B=A6?= Date: Tue, 2 Aug 2022 15:21:43 +0800 Subject: [PATCH 27/31] =?UTF-8?q?docs:=20=E2=9C=8F=EF=B8=8F=20change=20cha?= =?UTF-8?q?ngelog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index adfb0da5..805868d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Fix being unable to disable sideloaded texttracks in the AVPlayer [#2679](https://github.com/react-native-video/react-native-video/pull/2679) - Fixed crash when iOS seek method called reject on the promise [#2743](https://github.com/react-native-video/react-native-video/pull/2743) - Fix maxBitRate property being ignored on Android [#2670](https://github.com/react-native-video/react-native-video/pull/2670) +- Fix crash when the source is a cameraroll [#2639] (https://github.com/react-native-video/react-native-video/pull/2639) ### Version 6.0.0-alpha.1 @@ -55,8 +56,6 @@ - Fixed `onReadyForDisplay` not being called [#2721](https://github.com/react-native-video/react-native-video/pull/2721) - Fix type of `_eventDispatcher` on iOS target to match `bridge.eventDispatcher()` [#2720](https://github.com/react-native-video/react-native-video/pull/2720) -- Fix crash when the source is a cameraroll [#2639] (https://github.com/react-native-video/react-native-video/pull/2639) - ### Version 5.2.0 - Fix for tvOS native audio menu language selector From e1987e561ab06e96b86396069492ee792943ab5a Mon Sep 17 00:00:00 2001 From: john Date: Fri, 5 Aug 2022 09:53:22 +0800 Subject: [PATCH 28/31] fix rctDelegate is nil --- ios/Video/RCTVideoPlayerViewController.swift | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ios/Video/RCTVideoPlayerViewController.swift b/ios/Video/RCTVideoPlayerViewController.swift index 95c926af..e398e62f 100644 --- a/ios/Video/RCTVideoPlayerViewController.swift +++ b/ios/Video/RCTVideoPlayerViewController.swift @@ -19,8 +19,11 @@ class RCTVideoPlayerViewController: AVPlayerViewController { override func viewDidDisappear(_ animated: Bool) { super.viewDidDisappear(animated) - rctDelegate.videoPlayerViewControllerWillDismiss(playerViewController: self) - rctDelegate.videoPlayerViewControllerDidDismiss(playerViewController: self) + + if rctDelegate != nil { + rctDelegate.videoPlayerViewControllerWillDismiss(playerViewController: self) + rctDelegate.videoPlayerViewControllerDidDismiss(playerViewController: self) + } } #if !TARGET_OS_TV From f32da092b17b912f013da611358302addcea310d Mon Sep 17 00:00:00 2001 From: Olivier Bouillet <62574056+freeboub@users.noreply.github.com> Date: Sat, 6 Aug 2022 14:10:11 +0200 Subject: [PATCH 29/31] Update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 54296c23..223be5ae 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -10,10 +10,12 @@ assignees: '' # Bug ## Platform From 1a53c10c06534a0c2a22d0c6eebcc64cec701706 Mon Sep 17 00:00:00 2001 From: olivier bouillet Date: Sat, 20 Aug 2022 14:26:53 +0200 Subject: [PATCH 30/31] doc: update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c9bef79..c8589cd9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ### Version 6.0.0-alpha.2 +- Fix Android #2690 ensure onEnd is not sent twice [#2690](https://github.com/react-native-video/react-native-video/issues/2690) - Fix Exoplayer progress not reported when paused [#2664](https://github.com/react-native-video/react-native-video/pull/2664) - Call playbackRateChange onPlay and onPause [#1493](https://github.com/react-native-video/react-native-video/pull/1493) From 7fe3b28f26fa90d32a290a5154e1d978f848ec63 Mon Sep 17 00:00:00 2001 From: olivier bouillet Date: Sat, 20 Aug 2022 14:31:15 +0200 Subject: [PATCH 31/31] doc: update changeLog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1968e293..95b2a97e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ### Version 6.0.0-alpha.2 +- Feature add support of subtitle styling on android [#2759](https://github.com/react-native-video/react-native-video/pull/2759) - Fix Android #2690 ensure onEnd is not sent twice [#2690](https://github.com/react-native-video/react-native-video/issues/2690) - Fix Exoplayer progress not reported when paused [#2664](https://github.com/react-native-video/react-native-video/pull/2664) - Call playbackRateChange onPlay and onPause [#1493](https://github.com/react-native-video/react-native-video/pull/1493)