Explorar o código

movie view: correctly update brightness slider when screen brightness is changed by the user through a OS provided way

(cherry picked from commit dfd21ae93df27b01c52cf7b55d27ab8c6c0dc77f)
Felix Paul Kühne %!s(int64=10) %!d(string=hai) anos
pai
achega
f40ad2e4aa
Modificáronse 1 ficheiros con 7 adicións e 0 borrados
  1. 7 0
      Sources/VLCMovieViewController.m

+ 7 - 0
Sources/VLCMovieViewController.m

@@ -219,6 +219,8 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
                    name:UIScreenDidConnectNotification object:nil];
     [center addObserver:self selector:@selector(handleExternalScreenDidDisconnect:)
                    name:UIScreenDidDisconnectNotification object:nil];
+    [center addObserver:self selector:@selector(screenBrightnessChanged:)
+                   name:UIScreenBrightnessDidChangeNotification object:nil];
 
     _playingExternallyTitle.text = NSLocalizedString(@"PLAYING_EXTERNALLY_TITLE", nil);
     _playingExternallyDescription.text = NSLocalizedString(@"PLAYING_EXTERNALLY_DESC", nil);
@@ -1474,6 +1476,11 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
     [self _resetIdleTimer];
 }
 
+- (void)screenBrightnessChanged:(NSNotification *)notification
+{
+    self.brightnessSlider.value = [(UIScreen *)notification.object brightness] * 2.;
+}
+
 #pragma mark - playback view
 - (IBAction)playbackSliderAction:(UISlider *)sender
 {