Skip to content

Commit

Permalink
Merge pull request #1304 from nfb-onf/disable_airplay_for_sideloaded_…
Browse files Browse the repository at this point in the history
…captions

disable airplay when sideloaded captions
  • Loading branch information
cobarx authored Dec 6, 2018
2 parents e1c1eb6 + 06b5d50 commit 8119ced
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Note: Due to iOS limitations, sidecar text tracks are not compatible with Airplay. If textTracks are specified, AirPlay support will be automatically disabled.

Example:
```
import { TextTrackType }, Video from 'react-native-video';
Expand Down
5 changes: 4 additions & 1 deletion ios/Video/RCTVideo.m
Original file line number Diff line number Diff line change
Expand Up @@ -401,10 +401,13 @@ - (NSURL*) urlFilePath:(NSString*) filepath {

- (void)playerItemPrepareText:(AVAsset *)asset assetOptions:(NSDictionary * __nullable)assetOptions withCallback:(void(^)(AVPlayerItem *))handler
{
if (!_textTracks) {
if (!_textTracks || _textTracks.count==0) {
handler([AVPlayerItem playerItemWithAsset:asset]);
return;
}

// AVPlayer can't airplay AVMutableCompositions
_allowsExternalPlayback = NO;

// sideload text tracks
AVMutableComposition *mixComposition = [[AVMutableComposition alloc] init];
Expand Down

0 comments on commit 8119ced

Please sign in to comment.