Merge pull request #1304 from nfb-onf/disable_airplay_for_sideloaded_captions

disable airplay when sideloaded captions
This commit is contained in:
Hampton Maxwell 2018-12-05 17:37:22 -08:00 committed by GitHub
commit 8119cede8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -656,6 +656,8 @@ uri | URL for the text track. Currently, only tracks hosted on a webserver are s
On iOS, sidecar text tracks are only supported for individual files, not HLS playlists. For HLS, you should include the text tracks as part of the playlist. On iOS, sidecar text tracks are only supported for individual files, not HLS playlists. For HLS, you should include the text tracks as part of the playlist.
Note: Due to iOS limitations, sidecar text tracks are not compatible with Airplay. If textTracks are specified, AirPlay support will be automatically disabled.
Example: Example:
``` ```
import { TextTrackType }, Video from 'react-native-video'; import { TextTrackType }, Video from 'react-native-video';

View File

@ -401,10 +401,13 @@ static int const RCTVideoUnset = -1;
- (void)playerItemPrepareText:(AVAsset *)asset assetOptions:(NSDictionary * __nullable)assetOptions withCallback:(void(^)(AVPlayerItem *))handler - (void)playerItemPrepareText:(AVAsset *)asset assetOptions:(NSDictionary * __nullable)assetOptions withCallback:(void(^)(AVPlayerItem *))handler
{ {
if (!_textTracks) { if (!_textTracks || _textTracks.count==0) {
handler([AVPlayerItem playerItemWithAsset:asset]); handler([AVPlayerItem playerItemWithAsset:asset]);
return; return;
} }
// AVPlayer can't airplay AVMutableCompositions
_allowsExternalPlayback = NO;
// sideload text tracks // sideload text tracks
AVMutableComposition *mixComposition = [[AVMutableComposition alloc] init]; AVMutableComposition *mixComposition = [[AVMutableComposition alloc] init];