File tree Expand file tree Collapse file tree 3 files changed +5
-1
lines changed
android/src/main/java/com/appgoalz/rnjwplayer Expand file tree Collapse file tree 3 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -541,7 +541,8 @@ public static PlaylistItem getPlaylistItem (ReadableMap playlistItem) {
541541 if (trackProp .hasKey ("file" )) {
542542 String file = trackProp .getString ("file" );
543543 String label = trackProp .getString ("label" );
544- Caption caption = new Caption .Builder ().file (file ).label (label ).kind (CaptionType .CAPTIONS ).isDefault (false ).build ();
544+ boolean isDefault = trackProp .getBoolean ("default" );
545+ Caption caption = new Caption .Builder ().file (file ).label (label ).kind (CaptionType .CAPTIONS ).isDefault (isDefault ).build ();
545546 tracks .add (caption );
546547 }
547548 }
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ declare module "react-native-jw-media-player" {
2121 interface Track {
2222 file : string ;
2323 label : string ;
24+ default ?: boolean ;
2425 }
2526 interface AdSchedule {
2627 tag : string ;
Original file line number Diff line number Diff line change @@ -407,11 +407,13 @@ -(JWPlayerItem*)getPlayerItem:item
407407 NSString *file = [item objectForKey: @" file" ];
408408 NSURL *fileUrl = [NSURL URLWithString: file];
409409 NSString *label = [item objectForKey: @" label" ];
410+ bool isDefault = [item objectForKey: @" default" ];
410411
411412 JWCaptionTrackBuilder* trackBuilder = [[JWCaptionTrackBuilder alloc ] init ];
412413
413414 [trackBuilder file: fileUrl];
414415 [trackBuilder label: label];
416+ [trackBuilder defaultTrack: isDefault];
415417
416418 JWMediaTrack *trackItem = [trackBuilder buildAndReturnError: &error];
417419
You can’t perform that action at this time.
0 commit comments