Skip to content

Commit

Permalink
fix: bug in multiple audios torrents
Browse files Browse the repository at this point in the history
  • Loading branch information
K3vinb5 committed Sep 12, 2024
1 parent 2e2afb1 commit 5d0e80c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
32 changes: 16 additions & 16 deletions lib/util/mixed_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -152,22 +152,22 @@ class MixedController {
}
if (videoController.player.mediaInfo.audio != null &&
videoController.player.mediaInfo.audio!.length > 1) {
for (int j = 0; j < videoController.player.mediaInfo.audio!.length; j++) {
if (streamData.tracks == null) {
streamData.tracks = [];
for (int i = 0; i < streamData.captions.length; i++) {
AudioStreamInfo audio = videoController.player.mediaInfo.audio![j];
streamData.tracks!.add([
TrackData(
file: "",
lang:
"${audio.metadata["title"] ?? ""} (${audio.metadata["language"]} - Embedded)",
embedded: true,
index: j,
)
]);
}
streamData.tracks ??= [];
for (int i = 0; i < streamData.captions.length; i++) {
List<TrackData> newAudios = [];
for (int j = 0;
j < videoController.player.mediaInfo.audio!.length;
j++) {
AudioStreamInfo audio = videoController.player.mediaInfo.audio![j];
newAudios.add(TrackData(
file: "",
lang:
"${audio.metadata["title"] ?? ""} (${audio.metadata["language"]} - Embedded)",
embedded: true,
index: j,
));
}
streamData.tracks!.add(newAudios);
}
}
canDispose = true;
Expand Down Expand Up @@ -393,7 +393,7 @@ class MixedController {
}

void dispose() {
if (disposed) return;
if (disposed) return;
if (audioSeparate) {
syncTimer.cancel();
audioController.removeListener(() {
Expand Down
1 change: 0 additions & 1 deletion lib/widgets/video/m_video_player_controller.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'dart:async';

import 'package:flutter/material.dart';
import 'package:video_player/video_player.dart';
import 'package:fvp/mdk.dart' as mdk;
Expand Down

0 comments on commit 5d0e80c

Please sign in to comment.