File tree 3 files changed +5
-1
lines changed
android/src/main/java/com/appgoalz/rnjwplayer
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) {
541
541
if (trackProp .hasKey ("file" )) {
542
542
String file = trackProp .getString ("file" );
543
543
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 ();
545
546
tracks .add (caption );
546
547
}
547
548
}
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ declare module "react-native-jw-media-player" {
21
21
interface Track {
22
22
file : string ;
23
23
label : string ;
24
+ default ?: boolean ;
24
25
}
25
26
interface AdSchedule {
26
27
tag : string ;
Original file line number Diff line number Diff line change @@ -407,11 +407,13 @@ -(JWPlayerItem*)getPlayerItem:item
407
407
NSString *file = [item objectForKey: @" file" ];
408
408
NSURL *fileUrl = [NSURL URLWithString: file];
409
409
NSString *label = [item objectForKey: @" label" ];
410
+ bool isDefault = [item objectForKey: @" default" ];
410
411
411
412
JWCaptionTrackBuilder* trackBuilder = [[JWCaptionTrackBuilder alloc ] init ];
412
413
413
414
[trackBuilder file: fileUrl];
414
415
[trackBuilder label: label];
416
+ [trackBuilder defaultTrack: isDefault];
415
417
416
418
JWMediaTrack *trackItem = [trackBuilder buildAndReturnError: &error];
417
419
You can’t perform that action at this time.
0 commit comments