Title: [218114] trunk/Source/WebCore
Revision
218114
Author
commit-qu...@webkit.org
Date
2017-06-12 11:45:38 -0700 (Mon, 12 Jun 2017)

Log Message

WebAVPlayerController minTime and maxTime should be calculated properties to provide correct values when streaming.
https://bugs.webkit.org/show_bug.cgi?id=173193
rdar://problem/32684807

Patch by Jeremy Jones <jere...@apple.com> on 2017-06-12
Reviewed by Jer Noble.

No new tests because no affect on the DOM. This only affects properties consumed to AVKit.

-minTime and -maxTime should be calculated properties so they supply the exptected values to AVKit while streaming.

* platform/ios/WebAVPlayerController.h:
* platform/ios/WebAVPlayerController.mm:
(-[WebAVPlayerController maxTime]):
(+[WebAVPlayerController keyPathsForValuesAffectingMaxTime]):
(-[WebAVPlayerController minTime]):
(+[WebAVPlayerController keyPathsForValuesAffectingMinTime]):
(-[WebAVPlayerController resetMediaState]):
* platform/ios/WebPlaybackSessionInterfaceAVKit.mm:
(WebCore::WebPlaybackSessionInterfaceAVKit::durationChanged):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (218113 => 218114)


--- trunk/Source/WebCore/ChangeLog	2017-06-12 18:42:47 UTC (rev 218113)
+++ trunk/Source/WebCore/ChangeLog	2017-06-12 18:45:38 UTC (rev 218114)
@@ -1,3 +1,25 @@
+2017-06-12  Jeremy Jones  <jere...@apple.com>
+
+        WebAVPlayerController minTime and maxTime should be calculated properties to provide correct values when streaming.
+        https://bugs.webkit.org/show_bug.cgi?id=173193
+        rdar://problem/32684807
+
+        Reviewed by Jer Noble.
+
+        No new tests because no affect on the DOM. This only affects properties consumed to AVKit.
+
+        -minTime and -maxTime should be calculated properties so they supply the exptected values to AVKit while streaming.
+
+        * platform/ios/WebAVPlayerController.h:
+        * platform/ios/WebAVPlayerController.mm:
+        (-[WebAVPlayerController maxTime]):
+        (+[WebAVPlayerController keyPathsForValuesAffectingMaxTime]):
+        (-[WebAVPlayerController minTime]):
+        (+[WebAVPlayerController keyPathsForValuesAffectingMinTime]):
+        (-[WebAVPlayerController resetMediaState]):
+        * platform/ios/WebPlaybackSessionInterfaceAVKit.mm:
+        (WebCore::WebPlaybackSessionInterfaceAVKit::durationChanged):
+
 2017-06-12  Chris Dumez  <cdu...@apple.com>
 
         Call _sqlite3_purgeEligiblePagerCacheMemory() on memory pressure only if sqlite is initialized

Modified: trunk/Source/WebCore/platform/ios/WebAVPlayerController.h (218113 => 218114)


--- trunk/Source/WebCore/platform/ios/WebAVPlayerController.h	2017-06-12 18:42:47 UTC (rev 218113)
+++ trunk/Source/WebCore/platform/ios/WebAVPlayerController.h	2017-06-12 18:45:38 UTC (rev 218114)
@@ -62,8 +62,8 @@
 @property BOOL hasEnabledAudio;
 @property BOOL hasEnabledVideo;
 @property BOOL hasVideo;
-@property NSTimeInterval minTime;
-@property NSTimeInterval maxTime;
+@property (readonly) NSTimeInterval minTime;
+@property (readonly) NSTimeInterval maxTime;
 @property NSTimeInterval contentDurationWithinEndTimes;
 @property (retain) NSArray *loadedTimeRanges;
 @property AVPlayerControllerStatus status;
@@ -95,7 +95,6 @@
 @property (NS_NONATOMIC_IOSONLY, retain, readwrite) AVValueTiming *maxTiming;
 
 - (void)resetMediaState;
-
 @end
 
 #endif

Modified: trunk/Source/WebCore/platform/ios/WebAVPlayerController.mm (218113 => 218114)


--- trunk/Source/WebCore/platform/ios/WebAVPlayerController.mm	2017-06-12 18:42:47 UTC (rev 218113)
+++ trunk/Source/WebCore/platform/ios/WebAVPlayerController.mm	2017-06-12 18:45:38 UTC (rev 218114)
@@ -197,6 +197,39 @@
     return [NSSet setWithObjects:@"contentDuration", @"status", nil];
 }
 
+- (NSTimeInterval)maxTime
+{
+    NSTimeInterval maxTime = NAN;
+
+    NSTimeInterval duration = [self contentDuration];
+    if (!isnan(duration) && !isinf(duration))
+        maxTime = duration;
+    else if ([self hasSeekableLiveStreamingContent] && [self maxTiming])
+        maxTime = [[self maxTiming] currentValue];
+
+    return maxTime;
+}
+
++ (NSSet *)keyPathsForValuesAffectingMaxTime
+{
+    return [NSSet setWithObjects:@"contentDuration", @"hasSeekableLiveStreamingContent", @"maxTiming", nil];
+}
+
+- (NSTimeInterval)minTime
+{
+    NSTimeInterval minTime = 0.0;
+
+    if ([self hasSeekableLiveStreamingContent] && [self minTiming])
+        minTime = [[self minTiming] currentValue];
+
+    return minTime;
+}
+
++ (NSSet *)keyPathsForValuesAffectingMinTime
+{
+    return [NSSet setWithObjects:@"hasSeekableLiveStreamingContent", @"minTiming", nil];
+}
+
 - (void)skipBackwardThirtySeconds:(id)sender
 {
     UNUSED_PARAM(sender);
@@ -504,7 +537,6 @@
     [self setMaxTiming:newMaxTiming];
 }
 
-
 - (BOOL)hasSeekableLiveStreamingContent
 {
     BOOL hasSeekableLiveStreamingContent = NO;
@@ -527,7 +559,6 @@
 - (void)resetMediaState
 {
     self.contentDuration = 0;
-    self.maxTime = 0;
     self.contentDurationWithinEndTimes = 0;
     self.loadedTimeRanges = @[];
 
@@ -536,9 +567,10 @@
     self.canTogglePlayback = NO;
     self.hasEnabledAudio = NO;
     self.canSeek = NO;
-    self.minTime = 0;
     self.status = AVPlayerControllerStatusUnknown;
 
+    self.minTiming = nil;
+    self.maxTiming = nil;
     self.timing = nil;
     self.rate = 0;
 

Modified: trunk/Source/WebCore/platform/ios/WebPlaybackSessionInterfaceAVKit.mm (218113 => 218114)


--- trunk/Source/WebCore/platform/ios/WebPlaybackSessionInterfaceAVKit.mm	2017-06-12 18:42:47 UTC (rev 218113)
+++ trunk/Source/WebCore/platform/ios/WebPlaybackSessionInterfaceAVKit.mm	2017-06-12 18:45:38 UTC (rev 218114)
@@ -85,9 +85,7 @@
 {
     WebAVPlayerController* playerController = m_playerController.get();
 
-    // FIXME: https://bugs.webkit.org/show_bug.cgi?id=127017 use correct values instead of duration for all these
     playerController.contentDuration = duration;
-    playerController.maxTime = duration;
     playerController.contentDurationWithinEndTimes = duration;
 
     // FIXME: we take this as an indication that playback is ready.
@@ -96,7 +94,6 @@
     playerController.canTogglePlayback = YES;
     playerController.hasEnabledAudio = YES;
     playerController.canSeek = YES;
-    playerController.minTime = 0;
     playerController.status = AVPlayerControllerStatusReadyToPlay;
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to