Skip to content

Commit

Permalink
VPS: never restore audio as disabled
Browse files Browse the repository at this point in the history
This should finally solve the regression introduced in 3.6.2
  • Loading branch information
fkuehne committed Aug 21, 2024
1 parent b78b8cd commit c4d7179
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Sources/Playback/Control/VLCPlaybackService.m
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,16 @@ - (void)restoreAudioAndSubtitleTrack
if (media.isNew)
return;

[self selectAudioTrackAtIndex:media.audioTrackIndex];
SInt64 audioIndex = media.audioTrackIndex;
NSArray *audioTrackIndexes = _mediaPlayer.audioTrackIndexes;
if (audioIndex >= 0 && audioIndex < audioTrackIndexes.count) {
// we can cast this cause we won't have more than 2 million audiotracks
int actualAudioIndex = [audioTrackIndexes[audioIndex] intValue];
// never restore silence
if (actualAudioIndex != -1) {
_mediaPlayer.currentAudioTrackIndex = actualAudioIndex;
}
}

if ([[NSUserDefaults standardUserDefaults] boolForKey:kVLCSettingDisableSubtitles]) {
_mediaPlayer.currentVideoSubTitleIndex = -1;
Expand Down

0 comments on commit c4d7179

Please sign in to comment.