Commit 17522da7 authored by Felix Paul Kühne's avatar Felix Paul Kühne

Enable playback of audio-only media (refs #9044)

Note that there is no suitable UI yet, so the user experience is very so-so
parent d708d116
......@@ -13,6 +13,7 @@
@interface NSString (SupportedMedia)
- (BOOL)isSupportedMediaFormat;
- (BOOL)isSupportedAudioMediaFormat;
- (BOOL)isSupportedSubtitleFormat;
@end
......@@ -18,6 +18,12 @@
return ([self rangeOfString:kSupportedFileExtensions options:options].location != NSNotFound);
}
- (BOOL)isSupportedAudioMediaFormat
{
NSUInteger options = NSRegularExpressionSearch | NSCaseInsensitiveSearch;
return ([self rangeOfString:kSupportedAudioFileExtensions options:options].location != NSNotFound);
}
- (BOOL)isSupportedSubtitleFormat
{
NSUInteger options = NSRegularExpressionSearch | NSCaseInsensitiveSearch;
......
......@@ -212,7 +212,7 @@
NSMutableArray *filePaths = [NSMutableArray arrayWithCapacity:[foundFiles count]];
NSURL *fileURL;
for (NSString *fileName in foundFiles) {
if ([fileName isSupportedMediaFormat]) {
if ([fileName isSupportedMediaFormat] || [fileName isSupportedAudioMediaFormat]) {
[filePaths addObject:[directoryPath stringByAppendingPathComponent:fileName]];
/* exclude media files from backup (QA1719) */
......
......@@ -99,7 +99,7 @@
#pragma mark - restClient delegate
- (BOOL)_supportedFileExtension:(NSString *)filename
{
if ([filename isSupportedMediaFormat] || [filename isSupportedSubtitleFormat])
if ([filename isSupportedMediaFormat] || [filename isSupportedAudioMediaFormat] || [filename isSupportedSubtitleFormat])
return YES;
return NO;
......
......@@ -64,7 +64,7 @@ const float MediaTimerInterval = 2.f;
- (void)notifyFileDeleted:(NSString *)fileName
{
if (![fileName isSupportedMediaFormat])
if (![fileName isSupportedMediaFormat] && ![fileName isSupportedAudioMediaFormat])
return;
for (id<VLCMediaFileDiscovererDelegate> delegate in _observers) {
......@@ -143,7 +143,7 @@ const float MediaTimerInterval = 2.f;
NSArray *addedFiles = [foundFiles filteredArrayUsingPredicate:filterPredicate];
for (NSString *fileName in addedFiles) {
if ([fileName isSupportedMediaFormat]) {
if ([fileName isSupportedMediaFormat] || [fileName isSupportedAudioMediaFormat]) {
[_addedFilesMapping setObject:@(0) forKey:fileName];
[self notifyFileAdded:fileName loading:YES];
}
......
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