فهرست منبع

VLCPlaybackInfoControllers+ VLCPlaybackController: remove knowledge of Mediaplayer

Carola Nitz 7 سال پیش
والد
کامیت
ee60ec4d48

+ 2 - 2
Apple-TV/Playback/Playback Info/VLCPlaybackInfoPlaybackTVViewController.m

@@ -33,7 +33,7 @@
 
 + (BOOL)shouldBeVisibleForPlaybackController:(VLCPlaybackController *)vpc
 {
-    return vpc.mediaPlayer.isSeekable;
+    return [vpc isSeekable];
 }
 
 
@@ -94,7 +94,7 @@
     }];
     UISegmentedControl *rateControl = self.rateControl;
     rateControl.selectedSegmentIndex = currentIndex;
-    rateControl.enabled = vpc.mediaPlayer.isSeekable;
+    rateControl.enabled = [vpc isSeekable];
 }
 
 - (IBAction)rateControlChanged:(UISegmentedControl *)sender

+ 1 - 1
Apple-TV/Playback/Playback Info/VLCPlaybackInfoSubtitlesFetcherViewController.m

@@ -117,7 +117,7 @@
 {
     [self stopActivity];
     VLCPlaybackController *vpc = [VLCPlaybackController sharedInstance];
-    [vpc.mediaPlayer openVideoSubTitlesFromFile:pathToFile];
+    [vpc openVideoSubTitlesFromFile:pathToFile];
     [self dismissViewControllerAnimated:YES completion:nil];
     [[NSNotificationCenter defaultCenter] postNotificationName:VLCPlaybackControllerPlaybackMetadataDidChange object:nil];
 }

+ 2 - 0
Sources/VLCPlaybackController.h

@@ -77,6 +77,7 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
 @property (readonly) NSInteger numberOfChaptersForCurrentTitle;
 @property (nonatomic, readonly) BOOL currentMediaHasTrackToChooseFrom;
 @property (nonatomic, readwrite) BOOL fullscreenSessionRequested;
+@property (nonatomic, readonly) BOOL isSeekable;
 @property (readonly) NSNumber *playbackTime;
 @property (nonatomic, readonly) NSDictionary *mediaOptionsDictionary;
 @property (nonatomic, readonly) NSTimer* sleepTimer;
@@ -109,5 +110,6 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
 - (void)scheduleSleepTimerWithInterval:(NSTimeInterval)timeInterval;
 
 - (void)playMediaList:(VLCMediaList *)mediaList firstIndex:(NSInteger)index subtitlesFilePath:(NSString *)subsFilePath;
+- (void)openVideoSubTitlesFromFile:(NSString *)pathToFile;
 
 @end

+ 10 - 0
Sources/VLCPlaybackController.m

@@ -137,6 +137,11 @@ VLCMediaDelegate, VLCRemoteControlServiceDelegate>
 }
 #pragma mark - playback management
 
+- (void)openVideoSubTitlesFromFile:(NSString *)pathToFile
+{
+    [_mediaPlayer openVideoSubTitlesFromFile:pathToFile];
+}
+
 - (void)playMediaList:(VLCMediaList *)mediaList firstIndex:(NSInteger)index subtitlesFilePath:(NSString *)subsFilePath
 {
     self.mediaList = mediaList;
@@ -449,6 +454,11 @@ VLCMediaDelegate, VLCRemoteControlServiceDelegate>
     return [[_mediaPlayer audioTrackIndexes] count] > 2 || [[_mediaPlayer videoSubTitlesIndexes] count] > 1;
 }
 
+- (BOOL) isSeekable
+{
+    return _mediaPlayer.isSeekable;
+}
+
 - (NSNumber *)playbackTime
 {
     return _mediaPlayer.time.value;