Commit 4995cd45 authored by Carola Nitz's avatar Carola Nitz

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) {
{
VLCMediaPlayerState currentState = _mediaPlayer.state;
switch (currentState) {
case VLCMediaPlayerStateBuffering: {
/* attach delegate */
_mediaPlayer.media.delegate = self;
/* on-the-fly values through hidden API */
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[_mediaPlayer performSelector:@selector(setTextRendererFont:) withObject:[defaults objectForKey:kVLCSettingSubtitlesFont]];
[_mediaPlayer performSelector:@selector(setTextRendererFontSize:) withObject:[defaults objectForKey:kVLCSettingSubtitlesFontSize]];
[_mediaPlayer performSelector:@selector(setTextRendererFontColor:) withObject:[defaults objectForKey:kVLCSettingSubtitlesFontColor]];
[_mediaPlayer performSelector:@selector(setTextRendererFontForceBold:) withObject:[defaults objectForKey:kVLCSettingSubtitlesBoldFont]];
} break;
case VLCMediaPlayerStateError: {
APLog(@"Playback failed");
dispatch_async(dispatch_get_main_queue(),^{
[[NSNotificationCenter defaultCenter] postNotificationName:VLCPlaybackControllerPlaybackDidFail object:self];
});
if (currentState == VLCMediaPlayerStateBuffering) {
/* attach delegate */
_mediaPlayer.media.delegate = self;
/* on-the-fly values through hidden API */
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[_mediaPlayer performSelector:@selector(setTextRendererFont:) withObject:[defaults objectForKey:kVLCSettingSubtitlesFont]];
[_mediaPlayer performSelector:@selector(setTextRendererFontSize:) withObject:[defaults objectForKey:kVLCSettingSubtitlesFontSize]];
[_mediaPlayer performSelector:@selector(setTextRendererFontColor:) withObject:[defaults objectForKey:kVLCSettingSubtitlesFontColor]];
[_mediaPlayer performSelector:@selector(setTextRendererFontForceBold:) withObject:[defaults objectForKey:kVLCSettingSubtitlesBoldFont]];
} else if (currentState == VLCMediaPlayerStateError) {
APLog(@"Playback failed");
dispatch_async(dispatch_get_main_queue(),^{
[[NSNotificationCenter defaultCenter] postNotificationName:VLCPlaybackControllerPlaybackDidFail object:self];
});
_sessionWillRestart = NO;
[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;
[self stopPlayback];
} break;
case VLCMediaPlayerStateEnded:
case 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;
[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;
return;
} else if (listCount > 1) {
[_listPlayer.mediaList unlock];
[_listPlayer next];
} else
[_listPlayer.mediaList unlock];
}
if ([self.delegate respondsToSelector:@selector(mediaPlayerStateChanged:isPlaying:currentMediaHasTrackToChooseFrom:currentMediaHasChapters:forPlaybackController:)])
......@@ -1095,6 +1079,15 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) {
- (void)_recoverLastPlaybackStateOfItem:(MLFile *)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;
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