Skip to content

Commit

Permalink
fix track change
Browse files Browse the repository at this point in the history
  • Loading branch information
lKinderBueno committed Feb 2, 2024
1 parent 07fb2d1 commit ae1d6ea
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions lib/src/video_player_mdk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,7 @@ class MdkVideoPlayerPlatform extends VideoPlayerPlatform {
int trackLength = _players[textureId]?.mediaInfo.audio?.length ?? 0;
if (trackLength == 0) return Future(() => null);

List<int> tracks = List<int>.generate(trackLength, (index) => 0);
tracks[index] = 1;
_players[textureId]?.setActiveTracks(MediaType.audio, tracks);
_players[textureId]?.setActiveTracks(MediaType.audio, [index]);
return Future(() => null);
}

Expand All @@ -316,9 +314,7 @@ class MdkVideoPlayerPlatform extends VideoPlayerPlatform {
int trackLength = _players[textureId]?.mediaInfo.video?.length ?? 0;
if (trackLength == 0) return Future(() => null);

List<int> tracks = List<int>.generate(trackLength, (index) => 0);
tracks[index] = 1;
_players[textureId]?.setActiveTracks(MediaType.video, tracks);
_players[textureId]?.setActiveTracks(MediaType.video, [index]);
return Future(() => null);
}

Expand All @@ -337,9 +333,7 @@ class MdkVideoPlayerPlatform extends VideoPlayerPlatform {
int trackLength = _players[textureId]?.mediaInfo.video?.length ?? 0;
if (trackLength == 0 || embeddedSubtitle == null || embeddedSubtitle.trackIndex == null) return Future(() => null);

List<int> tracks = List<int>.generate(trackLength, (index) => 0);
tracks[embeddedSubtitle.trackIndex!] = 1;
_players[textureId]?.setActiveTracks(MediaType.subtitle, tracks);
_players[textureId]?.setActiveTracks(MediaType.subtitle, [embeddedSubtitle.trackIndex!]);
return Future(() => null);
}

Expand Down

0 comments on commit ae1d6ea

Please sign in to comment.