Commit 6c93beb9 authored by Soomin Lee's avatar Soomin Lee Committed by Carola
Browse files

VLCPlaybackController: Call saveVideoSnapshotAt only when the media have a video output


Signed-off-by: Carola's avatarCarola Nitz <nitz.carola@googlemail.com>
parent f55620c0
......@@ -343,18 +343,19 @@ VLCMediaDelegate, VLCRemoteControlServiceDelegate>
if (position > .95)
return;
NSArray *searchPaths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString* newThumbnailPath = [searchPaths[0] stringByAppendingPathComponent:@"VideoSnapshots"];
NSFileManager *fileManager = [NSFileManager defaultManager];
if (![fileManager fileExistsAtPath:newThumbnailPath])
[fileManager createDirectoryAtPath:newThumbnailPath withIntermediateDirectories:YES attributes:nil error:nil];
newThumbnailPath = [newThumbnailPath stringByAppendingPathComponent:fileItem.objectID.URIRepresentation.lastPathComponent];
[_mediaPlayer saveVideoSnapshotAt:newThumbnailPath withWidth:0 andHeight:0];
_recheckForExistingThumbnail = YES;
[self performSelector:@selector(_updateStoredThumbnailForFile:) withObject:fileItem afterDelay:.25];
if (_mediaPlayer.hasVideoOut) {
NSArray *searchPaths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *newThumbnailPath = [searchPaths.firstObject stringByAppendingPathComponent:@"VideoSnapshots"];
NSError *error;
[[NSFileManager defaultManager] createDirectoryAtPath:newThumbnailPath withIntermediateDirectories:YES attributes:nil error:&error];
if (error == nil) {
newThumbnailPath = [newThumbnailPath stringByAppendingPathComponent:fileItem.objectID.URIRepresentation.lastPathComponent];
[_mediaPlayer saveVideoSnapshotAt:newThumbnailPath withWidth:0 andHeight:0];
_recheckForExistingThumbnail = YES;
[self performSelector:@selector(_updateStoredThumbnailForFile:) withObject:fileItem afterDelay:.25];
}
}
}
@catch (NSException *exception) {
APLog(@"failed to save current media state - file removed?");
......
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