Changeset 167044 in webkit
- Timestamp:
- Apr 9, 2014 3:33:23 PM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r167041 r167044 1 2014-04-09 Jeremy Jones <jeremyj@apple.com> 2 3 Enable fullscreen captions selection 4 https://bugs.webkit.org/show_bug.cgi?id=131069 5 6 Reviewed by Eric Carlson. 7 8 Enable media selection options from fullscreen. i.e. captions. 9 10 * WebCore.exp.in: 11 Add exports for 12 setAudioMediaSelectionOptions 13 setLegibleMediaSelectionOptions 14 selectAudioMediaOption 15 selectLegibleMediaOption 16 17 * platform/ios/WebVideoFullscreenInterface.h: 18 Add setAudioMediaSelectionOptions/setLegibleMediaSelectionOptions 19 20 * platform/ios/WebVideoFullscreenInterfaceAVKit.h: 21 Add setAudioMediaSelectionOptions/setLegibleMediaSelectionOptions 22 23 * platform/ios/WebVideoFullscreenInterfaceAVKit.mm: 24 Add setAudioMediaSelectionOptions/setLegibleMediaSelectionOptions 25 26 (-[WebAVPlayerController dealloc]): 27 (-[WebAVPlayerController hasMediaSelectionOptions]): 28 (+[WebAVPlayerController keyPathsForValuesAffectingHasMediaSelectionOptions]): 29 (-[WebAVPlayerController hasAudioMediaSelectionOptions]): 30 (+[WebAVPlayerController keyPathsForValuesAffectingHasAudioMediaSelectionOptions]): 31 (-[WebAVPlayerController hasLegibleMediaSelectionOptions]): 32 (+[WebAVPlayerController keyPathsForValuesAffectingHasLegibleMediaSelectionOptions]): 33 (-[WebAVPlayerController currentAudioMediaSelectionOption]): 34 (-[WebAVPlayerController setCurrentAudioMediaSelectionOption:]): 35 (-[WebAVPlayerController currentLegibleMediaSelectionOption]): 36 (-[WebAVPlayerController setCurrentLegibleMediaSelectionOption:]): 37 (WebVideoFullscreenInterfaceAVKit::setAudioMediaSelectionOptions): 38 (WebVideoFullscreenInterfaceAVKit::setLegibleMediaSelectionOptions): 39 * platform/ios/WebVideoFullscreenModel.h: 40 Add selectAudioMediaOption/selectLegibleMediaOption 41 42 * platform/ios/WebVideoFullscreenModelMediaElement.h: 43 Add selectAudioMediaOption/selectLegibleMediaOption 44 45 * platform/ios/WebVideoFullscreenModelMediaElement.mm: 46 Add selectAudioMediaOption/selectLegibleMediaOption 47 48 (WebVideoFullscreenModelMediaElement::setMediaElement): 49 Send initial media selection options. 50 51 (WebVideoFullscreenModelMediaElement::selectAudioMediaOption): 52 Will be implemented when audio track slection is implemented. 53 54 (WebVideoFullscreenModelMediaElement::selectLegibleMediaOption): 55 Select corresponding text track on HTMLMediaElement. 56 1 57 2014-04-09 Antti Koivisto <antti@apple.com> 2 58 -
trunk/Source/WebCore/WebCore.exp.in
r167040 r167044 3284 3284 __ZN7WebCore35WebVideoFullscreenModelMediaElement20setVideoLayerGravityENS_23WebVideoFullscreenModel12VideoGravityE 3285 3285 __ZN7WebCore35WebVideoFullscreenModelMediaElement21requestExitFullscreenEv 3286 __ZN7WebCore35WebVideoFullscreenModelMediaElement22selectAudioMediaOptionEy 3286 3287 __ZN7WebCore35WebVideoFullscreenModelMediaElement23setVideoFullscreenLayerEP7CALayer 3288 __ZN7WebCore35WebVideoFullscreenModelMediaElement24selectLegibleMediaOptionEy 3287 3289 __ZN7WebCore35WebVideoFullscreenModelMediaElement4playEv 3288 3290 __ZN7WebCore35WebVideoFullscreenModelMediaElement5pauseEv … … 3303 3305 __ZN7WebCore32WebVideoFullscreenInterfaceAVKit18setVideoDimensionsEbff 3304 3306 __ZN7WebCore32WebVideoFullscreenInterfaceAVKit26setWebVideoFullscreenModelEPNS_23WebVideoFullscreenModelE 3307 __ZN7WebCore32WebVideoFullscreenInterfaceAVKit29setAudioMediaSelectionOptionsERKN3WTF6VectorINS1_6StringELm0ENS1_15CrashOnOverflowEEEy 3308 __ZN7WebCore32WebVideoFullscreenInterfaceAVKit31setLegibleMediaSelectionOptionsERKN3WTF6VectorINS1_6StringELm0ENS1_15CrashOnOverflowEEEy 3305 3309 __ZN7WebCore32WebVideoFullscreenInterfaceAVKit35setWebVideoFullscreenChangeObserverEPNS_32WebVideoFullscreenChangeObserverE 3306 3310 __ZN7WebCore32WebVideoFullscreenInterfaceAVKit7setRateEbf -
trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterface.h
r166312 r167044 30 30 #if PLATFORM(IOS) 31 31 32 #include <wtf/Vector.h> 33 34 namespace WTF { 35 class String; 36 } 37 32 38 namespace WebCore { 33 39 … … 42 48 virtual void setVideoDimensions(bool hasVideo, float width, float height) = 0; 43 49 virtual void setSeekableRanges(const TimeRanges&) = 0; 50 virtual void setAudioMediaSelectionOptions(const Vector<String>& options, uint64_t selectedIndex) = 0; 51 virtual void setLegibleMediaSelectionOptions(const Vector<String>& options, uint64_t selectedIndex) = 0; 44 52 }; 45 53 -
trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h
r166312 r167044 82 82 virtual void setVideoDimensions(bool hasVideo, float width, float height) override; 83 83 virtual void setSeekableRanges(const TimeRanges&) override; 84 84 virtual void setAudioMediaSelectionOptions(const Vector<String>& options, uint64_t selectedIndex) override; 85 virtual void setLegibleMediaSelectionOptions(const Vector<String>& options, uint64_t selectedIndex) override; 86 85 87 virtual void enterFullscreen(PlatformLayer&); 86 88 virtual void exitFullscreen(); -
trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm
r167019 r167044 73 73 SOFT_LINK(CoreMedia, CMTimeSubtract, CMTime, (CMTime minuend, CMTime subtrahend), (minuend, subtrahend)) 74 74 75 @class WebAVMediaSelectionOption; 76 75 77 @interface WebAVPlayerController : NSObject <AVPlayerViewControllerDelegate> 78 { 79 WebAVMediaSelectionOption *_currentAudioMediaSelectionOption; 80 WebAVMediaSelectionOption *_currentLegibleMediaSelectionOption; 81 } 76 82 77 83 @property(retain) AVPlayerController* playerControllerProxy; … … 96 102 @property(retain) NSArray *seekableTimeRanges; 97 103 104 @property (readonly) BOOL hasMediaSelectionOptions; 105 @property (readonly) BOOL hasAudioMediaSelectionOptions; 106 @property (retain) NSArray *audioMediaSelectionOptions; 107 @property (retain) WebAVMediaSelectionOption *currentAudioMediaSelectionOption; 108 @property (readonly) BOOL hasLegibleMediaSelectionOptions; 109 @property (retain) NSArray *legibleMediaSelectionOptions; 110 @property (retain) WebAVMediaSelectionOption *currentLegibleMediaSelectionOption; 111 98 112 - (BOOL)playerViewController:(AVPlayerViewController *)playerViewController shouldDismissWithReason:(AVPlayerViewControllerExitFullScreenReason)reason; 99 113 @end … … 117 131 [_seekableTimeRanges release]; 118 132 [_timing release]; 133 [_audioMediaSelectionOptions release]; 134 [_legibleMediaSelectionOptions release]; 135 [_currentAudioMediaSelectionOption release]; 136 [_currentLegibleMediaSelectionOption release]; 119 137 [super dealloc]; 120 138 } … … 228 246 } 229 247 248 - (BOOL)hasMediaSelectionOptions 249 { 250 return [self hasAudioMediaSelectionOptions] || [self hasLegibleMediaSelectionOptions]; 251 } 252 253 + (NSSet *)keyPathsForValuesAffectingHasMediaSelectionOptions 254 { 255 return [NSSet setWithObjects:@"hasAudioMediaSelectionOptions", @"hasLegibleMediaSelectionOptions", nil]; 256 } 257 258 - (BOOL)hasAudioMediaSelectionOptions 259 { 260 return [[self audioMediaSelectionOptions] count] > 0; 261 } 262 263 + (NSSet *)keyPathsForValuesAffectingHasAudioMediaSelectionOptions 264 { 265 return [NSSet setWithObject:@"audioMediaSelectionOptions"]; 266 } 267 268 - (BOOL)hasLegibleMediaSelectionOptions 269 { 270 return [[self legibleMediaSelectionOptions] count] > 0; 271 } 272 273 + (NSSet *)keyPathsForValuesAffectingHasLegibleMediaSelectionOptions 274 { 275 return [NSSet setWithObject:@"legibleMediaSelectionOptions"]; 276 } 277 278 - (WebAVMediaSelectionOption *)currentAudioMediaSelectionOption 279 { 280 return _currentAudioMediaSelectionOption; 281 } 282 283 - (void)setCurrentAudioMediaSelectionOption:(WebAVMediaSelectionOption *)option 284 { 285 if (option == _currentAudioMediaSelectionOption) 286 return; 287 288 [_currentAudioMediaSelectionOption release]; 289 _currentAudioMediaSelectionOption = [option retain]; 290 291 ASSERT(self.delegate); 292 293 NSInteger index = NSNotFound; 294 295 if (option && self.audioMediaSelectionOptions) 296 index = [self.audioMediaSelectionOptions indexOfObject:option]; 297 298 self.delegate->selectAudioMediaOption(index != NSNotFound ? index : UINT64_MAX); 299 } 300 301 - (WebAVMediaSelectionOption *)currentLegibleMediaSelectionOption 302 { 303 return _currentLegibleMediaSelectionOption; 304 } 305 306 - (void)setCurrentLegibleMediaSelectionOption:(WebAVMediaSelectionOption *)option 307 { 308 if (option == _currentLegibleMediaSelectionOption) 309 return; 310 311 [_currentLegibleMediaSelectionOption release]; 312 _currentLegibleMediaSelectionOption = [option retain]; 313 314 ASSERT(self.delegate); 315 316 NSInteger index = NSNotFound; 317 318 if (option && self.legibleMediaSelectionOptions) 319 index = [self.legibleMediaSelectionOptions indexOfObject:option]; 320 321 self.delegate->selectLegibleMediaOption(index != NSNotFound ? index : UINT64_MAX); 322 } 323 324 @end 325 326 @interface WebAVMediaSelectionOption : NSObject 327 @property (retain) NSString *localizedDisplayName; 328 @end 329 330 @implementation WebAVMediaSelectionOption 230 331 @end 231 332 … … 379 480 380 481 playerController().seekableTimeRanges = seekableRanges; 482 } 483 484 static NSMutableArray *mediaSelectionOptions(const Vector<String>& options) 485 { 486 NSMutableArray *webOptions = [NSMutableArray arrayWithCapacity:options.size()]; 487 for (auto& name : options) { 488 RetainPtr<WebAVMediaSelectionOption> webOption = adoptNS([[WebAVMediaSelectionOption alloc] init]); 489 RetainPtr<NSString> nameString = adoptNS([[NSString alloc] initWithUTF8String:name.utf8().data()]); 490 [webOption setLocalizedDisplayName:nameString.get()]; 491 [webOptions addObject:webOption.get()]; 492 } 493 return webOptions; 494 } 495 496 void WebVideoFullscreenInterfaceAVKit::setAudioMediaSelectionOptions(const Vector<String>& options, uint64_t selectedIndex) 497 { 498 NSMutableArray *webOptions = mediaSelectionOptions(options); 499 playerController().audioMediaSelectionOptions = webOptions; 500 if (selectedIndex < webOptions.count) 501 playerController().currentAudioMediaSelectionOption = webOptions[(size_t)selectedIndex]; 502 } 503 504 void WebVideoFullscreenInterfaceAVKit::setLegibleMediaSelectionOptions(const Vector<String>& options, uint64_t selectedIndex) 505 { 506 NSMutableArray *webOptions = mediaSelectionOptions(options); 507 playerController().legibleMediaSelectionOptions = webOptions; 508 if (selectedIndex < webOptions.count) 509 playerController().currentLegibleMediaSelectionOption = webOptions[(size_t)selectedIndex]; 381 510 } 382 511 -
trunk/Source/WebCore/platform/ios/WebVideoFullscreenModel.h
r165344 r167044 45 45 enum VideoGravity { VideoGravityResize, VideoGravityResizeAspect, VideoGravityResizeAspectFill }; 46 46 virtual void setVideoLayerGravity(VideoGravity) = 0; 47 virtual void selectAudioMediaOption(uint64_t index) = 0; 48 virtual void selectLegibleMediaOption(uint64_t index) = 0; 47 49 }; 48 50 -
trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.h
r165344 r167044 66 66 virtual void setVideoLayerFrame(FloatRect) override; 67 67 virtual void setVideoLayerGravity(WebVideoFullscreenModel::VideoGravity) override; 68 68 virtual void selectAudioMediaOption(uint64_t index) override; 69 virtual void selectLegibleMediaOption(uint64_t index) override; 69 70 }; 70 71 -
trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.mm
r167014 r167044 88 88 m_videoFullscreenInterface->setRate(!m_mediaElement->paused(), m_mediaElement->playbackRate()); 89 89 90 Vector<String> legibleOptions; 91 92 for (auto& textTrack : m_mediaElement->platformTextTracks()) 93 legibleOptions.append(textTrack->label()); 94 95 m_videoFullscreenInterface->setLegibleMediaSelectionOptions(legibleOptions, 0); 96 90 97 m_videoFullscreenInterface->setCurrentTime(m_mediaElement->currentTime(), [[NSProcessInfo processInfo] systemUptime]); 91 98 … … 197 204 } 198 205 206 void WebVideoFullscreenModelMediaElement::selectAudioMediaOption(uint64_t) 207 { 208 // FIXME: 131236 Implement audio track selection. 209 } 210 211 void WebVideoFullscreenModelMediaElement::selectLegibleMediaOption(uint64_t index) 212 { 213 RefPtr<PlatformTextTrack> platformTrack; 214 215 if (index < m_mediaElement->platformTextTracks().size()) 216 platformTrack = m_mediaElement->platformTextTracks()[static_cast<size_t>(index)]; 217 218 m_mediaElement->setSelectedTextTrack(platformTrack); 219 } 220 199 221 #endif -
trunk/Source/WebKit2/ChangeLog
r167040 r167044 1 2014-04-09 Jeremy Jones <jeremyj@apple.com> 2 3 Enable fullscreen captions selection 4 https://bugs.webkit.org/show_bug.cgi?id=131069 5 6 Reviewed by Eric Carlson. 7 8 Enable media selection in fullscreen. 9 setLegibleMediaSelectionOptions/setAudioMediaSelectionOptions provide a list of options. 10 selectAudioMediaOption/selectLegibleMediaOption change the selected option. 11 12 * UIProcess/ios/WebVideoFullscreenManagerProxy.h: 13 Add selectAudioMediaOption/selectLegibleMediaOption 14 15 * UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in: 16 Add selectAudioMediaOption/selectLegibleMediaOption 17 18 * UIProcess/ios/WebVideoFullscreenManagerProxy.mm: 19 (WebKit::WebVideoFullscreenManagerProxy::selectAudioMediaOption): 20 Add selectAudioMediaOption 21 22 (WebKit::WebVideoFullscreenManagerProxy::selectLegibleMediaOption): 23 Add selectLegibleMediaOption 24 25 * WebProcess/ios/WebVideoFullscreenManager.h: 26 Add setAudioMediaSelectionOptions/setLegibleMediaSelectionOptions 27 28 * WebProcess/ios/WebVideoFullscreenManager.messages.in: 29 Add setAudioMediaSelectionOptions/setLegibleMediaSelectionOptions 30 31 * WebProcess/ios/WebVideoFullscreenManager.mm: 32 (WebKit::WebVideoFullscreenManager::setAudioMediaSelectionOptions): 33 Add setAudioMediaSelectionOptions 34 35 (WebKit::WebVideoFullscreenManager::setLegibleMediaSelectionOptions): 36 Add setLegibleMediaSelectionOptions 37 1 38 2014-04-09 Alexey Proskuryakov <ap@apple.com> 2 39 -
trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.h
r166312 r167044 68 68 virtual void setVideoLayerFrame(WebCore::FloatRect) override; 69 69 virtual void setVideoLayerGravity(WebCore::WebVideoFullscreenModel::VideoGravity) override; 70 virtual void selectAudioMediaOption(uint64_t) override; 71 virtual void selectLegibleMediaOption(uint64_t) override; 70 72 71 73 WebPageProxy* m_page; -
trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in
r166312 r167044 26 26 SetVideoDimensions(bool hasVideo, unsigned width, unsigned height) 27 27 SetSeekableRangesVector(Vector<std::pair<double, double>> ranges); 28 SetAudioMediaSelectionOptions(Vector<String> options, uint64_t selectedIndex); 29 SetLegibleMediaSelectionOptions(Vector<String> options, uint64_t selectedIndex); 28 30 SetDuration(double duration) 29 31 SetRate(bool isPlaying, double rate) -
trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm
r166312 r167044 126 126 m_page->send(Messages::WebVideoFullscreenManager::SetVideoLayerGravityEnum((unsigned)gravity), m_page->pageID()); 127 127 } 128 129 void WebVideoFullscreenManagerProxy::selectAudioMediaOption(uint64_t index) 130 { 131 m_page->send(Messages::WebVideoFullscreenManager::SelectAudioMediaOption(index), m_page->pageID()); 132 } 133 134 void WebVideoFullscreenManagerProxy::selectLegibleMediaOption(uint64_t index) 135 { 136 m_page->send(Messages::WebVideoFullscreenManager::SelectLegibleMediaOption(index), m_page->pageID()); 137 } 128 138 129 139 } // namespace WebKit -
trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.h
r166312 r167044 72 72 virtual void setVideoDimensions(bool hasVideo, float width, float height) override; 73 73 virtual void setSeekableRanges(const WebCore::TimeRanges&) override; 74 virtual void setAudioMediaSelectionOptions(const Vector<String>& options, uint64_t selectedIndex) override; 75 virtual void setLegibleMediaSelectionOptions(const Vector<String>& options, uint64_t selectedIndex) override; 74 76 75 77 // additional incoming -
trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.messages.in
r165344 r167044 32 32 SetVideoLayerFrame(WebCore::FloatRect bounds) 33 33 SetVideoLayerGravityEnum(unsigned gravity) 34 SelectAudioMediaOption(uint64_t index) 35 SelectLegibleMediaOption(uint64_t index) 34 36 } 35 37 #endif -
trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm
r166312 r167044 136 136 } 137 137 138 void WebVideoFullscreenManager::setAudioMediaSelectionOptions(const Vector<String>& options, uint64_t selectedIndex) 139 { 140 m_page->send(Messages::WebVideoFullscreenManagerProxy::SetAudioMediaSelectionOptions(options, selectedIndex), m_page->pageID()); 141 } 142 143 void WebVideoFullscreenManager::setLegibleMediaSelectionOptions(const Vector<String>& options, uint64_t selectedIndex) 144 { 145 m_page->send(Messages::WebVideoFullscreenManagerProxy::SetLegibleMediaSelectionOptions(options, selectedIndex), m_page->pageID()); 146 } 147 138 148 void WebVideoFullscreenManager::didEnterFullscreen() 139 149 {
Note: See TracChangeset
for help on using the changeset viewer.