Changeset 278850 in webkit
- Timestamp:
- Jun 14, 2021, 3:04:59 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
platform/mac/WebPlaybackControlsManager.mm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r278849 r278850 1 2021-06-14 Devin Rousso <drousso@apple.com> 2 3 [macOS] TouchBar playback speed controls don't work 4 https://bugs.webkit.org/show_bug.cgi?id=226987 5 <rdar://problem/79216098> 6 7 Reviewed by Eric Carlson. 8 9 Override `setRate:` and `setDefaultPlaybackRate:` instead of just having an ivar so that 10 TouchBar playback speed controls actually affect the corresponding `<video>`. 11 12 * platform/mac/WebPlaybackControlsManager.mm: 13 (-[WebPlaybackControlsManager defaultPlaybackRate]): Added. 14 (-[WebPlaybackControlsManager setDefaultPlaybackRate:]): Added. 15 (-[WebPlaybackControlsManager rate]): Added. 16 (-[WebPlaybackControlsManager setRate:]): Added. 17 1 18 2021-06-14 Alex Christensen <achristensen@webkit.org> 2 19 -
trunk/Source/WebCore/platform/mac/WebPlaybackControlsManager.mm
r275176 r278850 49 49 @synthesize hasEnabledAudio = _hasEnabledAudio; 50 50 @synthesize hasEnabledVideo = _hasEnabledVideo; 51 @synthesize defaultPlaybackRate = _defaultPlaybackRate;52 @synthesize rate = _rate;53 51 @synthesize canTogglePlayback = _canTogglePlayback; 54 52 @synthesize allowsPictureInPicturePlayback; … … 332 330 } 333 331 332 - (double)defaultPlaybackRate 333 { 334 return _defaultPlaybackRate; 335 } 336 337 - (void)setDefaultPlaybackRate:(double)defaultPlaybackRate 338 { 339 if (defaultPlaybackRate == _defaultPlaybackRate) 340 return; 341 342 _defaultPlaybackRate = defaultPlaybackRate; 343 344 if (_playbackSessionInterfaceMac) { 345 if (auto* model = _playbackSessionInterfaceMac->playbackSessionModel(); model && model->defaultPlaybackRate() != _defaultPlaybackRate) 346 model->setDefaultPlaybackRate(_defaultPlaybackRate); 347 } 348 349 if ([self isPlaying]) 350 [self setRate:_defaultPlaybackRate]; 351 } 352 353 - (float)rate 354 { 355 return _rate; 356 } 357 358 - (void)setRate:(float)rate 359 { 360 if (rate == _rate) 361 return; 362 363 _rate = rate; 364 365 // AVKit doesn't have a separate variable for "paused", instead representing it by a `rate` of 366 // `0`. Unfortunately, `HTMLMediaElement::play` doesn't call `HTMLMediaElement::setPlaybackRate` 367 // so if we propagate a `rate` of `0` along to the `HTMLMediaElement` then any attempt to 368 // `HTMLMediaElement::play` will effectively be a no-op since the `playbackRate` will be `0`. 369 if (!_rate) 370 return; 371 372 // In AVKit, the `defaultPlaybackRate` is used when playback starts, such as resuming after 373 // pausing. In WebKit, however, `defaultPlaybackRate` is only used when first loading and after 374 // ending scanning, with the `playbackRate` being used in all other cases, including when 375 // resuming after pausing. As such, WebKit should return the `playbackRate` instead of the 376 // `defaultPlaybackRate` in these cases when communicating with AVKit. 377 [self setDefaultPlaybackRate:_rate]; 378 379 if (_playbackSessionInterfaceMac) { 380 if (auto* model = _playbackSessionInterfaceMac->playbackSessionModel(); model && model->playbackRate() != _rate) 381 model->setPlaybackRate(_rate); 382 } 383 } 384 334 385 - (void)togglePictureInPicture 335 386 {
Note:
See TracChangeset
for help on using the changeset viewer.