Browse Source

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

Note that there is no suitable UI yet, so the user experience is very so-so
Felix Paul Kühne 12 years ago
parent
commit
17522da70d

+ 1 - 0
AspenProject/NSString+SupportedMedia.h

@@ -13,6 +13,7 @@
 @interface NSString (SupportedMedia)
 
 - (BOOL)isSupportedMediaFormat;
+- (BOOL)isSupportedAudioMediaFormat;
 - (BOOL)isSupportedSubtitleFormat;
 
 @end

+ 6 - 0
AspenProject/NSString+SupportedMedia.m

@@ -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;

+ 1 - 1
AspenProject/VLCAppDelegate.m

@@ -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) */

+ 1 - 1
AspenProject/VLCDropboxController.m

@@ -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;

+ 2 - 2
AspenProject/VLCMediaFileDiscoverer.m

@@ -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];
             }