Commit 4995cd45 authored by Carola's avatar Carola

Revert "VLCPlaybackController: Fix restoration of audio and subtitle track(closes #19351)"

This reverts commit d4681606.
for now till we have a new VLCKit version
parent d4681606
...@@ -706,52 +706,36 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) { ...@@ -706,52 +706,36 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) {
{ {
VLCMediaPlayerState currentState = _mediaPlayer.state; VLCMediaPlayerState currentState = _mediaPlayer.state;
switch (currentState) { if (currentState == VLCMediaPlayerStateBuffering) {
case VLCMediaPlayerStateBuffering: { /* attach delegate */
/* attach delegate */ _mediaPlayer.media.delegate = self;
_mediaPlayer.media.delegate = self;
/* on-the-fly values through hidden API */
/* on-the-fly values through hidden API */ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; [_mediaPlayer performSelector:@selector(setTextRendererFont:) withObject:[defaults objectForKey:kVLCSettingSubtitlesFont]];
[_mediaPlayer performSelector:@selector(setTextRendererFont:) withObject:[defaults objectForKey:kVLCSettingSubtitlesFont]]; [_mediaPlayer performSelector:@selector(setTextRendererFontSize:) withObject:[defaults objectForKey:kVLCSettingSubtitlesFontSize]];
[_mediaPlayer performSelector:@selector(setTextRendererFontSize:) withObject:[defaults objectForKey:kVLCSettingSubtitlesFontSize]]; [_mediaPlayer performSelector:@selector(setTextRendererFontColor:) withObject:[defaults objectForKey:kVLCSettingSubtitlesFontColor]];
[_mediaPlayer performSelector:@selector(setTextRendererFontColor:) withObject:[defaults objectForKey:kVLCSettingSubtitlesFontColor]]; [_mediaPlayer performSelector:@selector(setTextRendererFontForceBold:) withObject:[defaults objectForKey:kVLCSettingSubtitlesBoldFont]];
[_mediaPlayer performSelector:@selector(setTextRendererFontForceBold:) withObject:[defaults objectForKey:kVLCSettingSubtitlesBoldFont]]; } else if (currentState == VLCMediaPlayerStateError) {
} break; APLog(@"Playback failed");
dispatch_async(dispatch_get_main_queue(),^{
case VLCMediaPlayerStateError: { [[NSNotificationCenter defaultCenter] postNotificationName:VLCPlaybackControllerPlaybackDidFail object:self];
APLog(@"Playback failed"); });
dispatch_async(dispatch_get_main_queue(),^{ _sessionWillRestart = NO;
[[NSNotificationCenter defaultCenter] postNotificationName:VLCPlaybackControllerPlaybackDidFail object:self]; [self stopPlayback];
}); } else if (currentState == VLCMediaPlayerStateEnded || currentState == VLCMediaPlayerStateStopped) {
[_listPlayer.mediaList lock];
NSUInteger listCount = _listPlayer.mediaList.count;
if ([_listPlayer.mediaList indexOfMedia:_mediaPlayer.media] == listCount - 1 && self.repeatMode == VLCDoNotRepeat) {
[_listPlayer.mediaList unlock];
_sessionWillRestart = NO; _sessionWillRestart = NO;
[self stopPlayback]; [self stopPlayback];
} break; return;
case VLCMediaPlayerStateEnded: } else if (listCount > 1) {
case VLCMediaPlayerStateStopped: { [_listPlayer.mediaList unlock];
[_listPlayer.mediaList lock]; [_listPlayer next];
NSUInteger listCount = _listPlayer.mediaList.count; } else
if ([_listPlayer.mediaList indexOfMedia:_mediaPlayer.media] == listCount - 1 && self.repeatMode == VLCDoNotRepeat) { [_listPlayer.mediaList unlock];
[_listPlayer.mediaList unlock];
_sessionWillRestart = NO;
[self stopPlayback];
return;
} else if (listCount > 1) {
[_listPlayer.mediaList unlock];
[_listPlayer next];
} else
[_listPlayer.mediaList unlock];
} break;
case VLCMediaPlayerStateESAdded: {
MLFile *item = [MLFile fileForURL:_mediaPlayer.media.url].firstObject;
if (item) {
_mediaPlayer.currentAudioTrackIndex = item.lastAudioTrack.intValue;
_mediaPlayer.currentVideoSubTitleIndex = item.lastSubtitleTrack.intValue;
}
} break;
default:
break;
} }
if ([self.delegate respondsToSelector:@selector(mediaPlayerStateChanged:isPlaying:currentMediaHasTrackToChooseFrom:currentMediaHasChapters:forPlaybackController:)]) if ([self.delegate respondsToSelector:@selector(mediaPlayerStateChanged:isPlaying:currentMediaHasTrackToChooseFrom:currentMediaHasChapters:forPlaybackController:)])
...@@ -1095,6 +1079,15 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) { ...@@ -1095,6 +1079,15 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) {
- (void)_recoverLastPlaybackStateOfItem:(MLFile *)item - (void)_recoverLastPlaybackStateOfItem:(MLFile *)item
{ {
if (item) { if (item) {
if (_mediaPlayer.numberOfAudioTracks > 2) {
if (item.lastAudioTrack.intValue > 0)
_mediaPlayer.currentAudioTrackIndex = item.lastAudioTrack.intValue;
}
if (_mediaPlayer.numberOfSubtitlesTracks > 2) {
if (item.lastSubtitleTrack.intValue > 0)
_mediaPlayer.currentVideoSubTitleIndex = item.lastSubtitleTrack.intValue;
}
CGFloat lastPosition = .0; CGFloat lastPosition = .0;
NSInteger duration = 0; NSInteger duration = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment