Commit 85d5a264 authored by Felix Paul Kühne's avatar Felix Paul Kühne
Browse files

Movie Player: set playback options on the VLCMedia object instead of the...

Movie Player: set playback options on the VLCMedia object instead of the VLCMediaPlayer and init the latter with an empty options array so we get the shared library

This is more efficient and less prone to trigger crashes in the iOS 6 pthread library (close #8739)
parent 7a0a7123
......@@ -102,12 +102,7 @@
- (void)viewWillAppear:(BOOL)animated
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSArray *options = @[[[defaults objectForKey:kVLCSettingVerboseOutput] boolValue] ? kVLCSettingVerboseOutputOnValue : kVLCSettingVerboseOutputOffValue,
[[defaults objectForKey:kVLCSettingStretchAudio] boolValue] ? kVLCSettingStretchAudioOnValue : kVLCSettingStretchAudioOffValue,
[NSString stringWithFormat:@"--subsdec-encoding=%@",[defaults objectForKey:kVLCSettingTextEncoding]]];
_mediaPlayer = [[VLCMediaPlayer alloc] initWithOptions:options];
_mediaPlayer = [[VLCMediaPlayer alloc] init];
[_mediaPlayer setDelegate:self];
[_mediaPlayer setDrawable:self.movieView];
......@@ -118,15 +113,24 @@
if (!self.mediaItem && !self.url)
return;
VLCMedia *media;
if (self.mediaItem) {
self.title = [self.mediaItem title];
[_mediaPlayer setMedia:[VLCMedia mediaWithURL:[NSURL URLWithString:self.mediaItem.url]]];
media = [VLCMedia mediaWithURL:[NSURL URLWithString:self.mediaItem.url]];
self.mediaItem.unread = @(NO);
} else {
[_mediaPlayer setMedia:[VLCMedia mediaWithURL:self.url]];
media = [VLCMedia mediaWithURL:self.url];
self.title = @"Network Stream";
}
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[media addOptions:
@{kVLCSettingStretchAudio :
[[defaults objectForKey:kVLCSettingStretchAudio] boolValue] ? kVLCSettingStretchAudioOnValue : kVLCSettingStretchAudioOffValue,
kVLCSettingTextEncoding : [defaults objectForKey:kVLCSettingTextEncoding]}];
[_mediaPlayer setMedia:media];
self.positionSlider.value = 0.;
[super viewWillAppear:animated];
......
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