Commit 742e5e65 authored by Felix Paul Kühne's avatar Felix Paul Kühne

movie player: watch keypath instead of notification to update the time fields,...

movie player: watch keypath instead of notification to update the time fields, since this is the correct event

Resolves some re-drawing issues and slightly reduces the load
parent 1d3a8d28
......@@ -419,6 +419,9 @@
[_mediaPlayer.media addOptions:@{@"start-time": playbackPositionInTime}];
APLog(@"set starttime to %i", playbackPositionInTime.intValue);
[_mediaPlayer addObserver:self forKeyPath:@"time" options:0 context:nil];
[_mediaPlayer addObserver:self forKeyPath:@"remainingTime" options:0 context:nil];
[_mediaPlayer play];
if (self.mediaItem) {
......@@ -465,6 +468,8 @@
- (void)_stopPlayback
{
if (_mediaPlayer) {
[_mediaPlayer removeObserver:self forKeyPath:@"time"];
[_mediaPlayer removeObserver:self forKeyPath:@"remainingTime"];
[_mediaPlayer pause];
[self _saveCurrentState];
[_mediaPlayer stop];
......@@ -697,7 +702,8 @@
[self _resetIdleTimer];
}
- (void)mediaPlayerTimeChanged:(NSNotification *)aNotification {
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
if (!_isScrubbing) {
self.positionSlider.value = [_mediaPlayer position];
}
......
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