⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 277203 in webkit


Ignore:
Timestamp:
May 7, 2021, 3:00:57 PM (5 years ago)
Author:
Devin Rousso
Message:

[iOS] fix inconsistency around the meaning of rate and defaultPlaybackRate between WebKit and AVKit
https://bugs.webkit.org/show_bug.cgi?id=225532
<rdar://problem/77629276>

Reviewed by Eric Carlson.

In AVKit, the defaultPlaybackRate is used when playback starts, such as resuming after
pausing. In WebKit, however, defaultPlaybackRate is only used when first loading and after
ending scanning, with the playbackRate being used in all other cases, including when
resuming after pausing. As such, WebKit should return the playbackRate instead of the
defaultPlaybackRate in these cases when communicating with AVKit.

  • platform/ios/WebAVPlayerController.mm:

(-[WebAVPlayerController setRate:]):
Also setDefaultPlaybackRate: if not paused (i.e. rate != 0) since WebKit's definition of
playbackRate does not change when paused.

  • platform/ios/PlaybackSessionInterfaceAVKit.mm:

(WebCore::PlaybackSessionInterfaceAVKit::rateChanged):
Make sure to setDefaultPlaybackRate: before setRate: as the latter can affect the former.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r277202 r277203  
     12021-05-07  Devin Rousso  <drousso@apple.com>
     2
     3        [iOS] fix inconsistency around the meaning of `rate` and `defaultPlaybackRate` between WebKit and AVKit
     4        https://bugs.webkit.org/show_bug.cgi?id=225532
     5        <rdar://problem/77629276>
     6
     7        Reviewed by Eric Carlson.
     8
     9        In AVKit, the `defaultPlaybackRate` is used when playback starts, such as resuming after
     10        pausing. In WebKit, however, `defaultPlaybackRate` is only used when first loading and after
     11        ending scanning, with the `playbackRate` being used in all other cases, including when
     12        resuming after pausing. As such, WebKit should return the `playbackRate` instead of the
     13        `defaultPlaybackRate` in these cases when communicating with AVKit.
     14
     15        * platform/ios/WebAVPlayerController.mm:
     16        (-[WebAVPlayerController setRate:]):
     17        Also `setDefaultPlaybackRate:` if not paused (i.e. `rate != 0`) since WebKit's definition of
     18        `playbackRate` does not change when paused.
     19
     20        * platform/ios/PlaybackSessionInterfaceAVKit.mm:
     21        (WebCore::PlaybackSessionInterfaceAVKit::rateChanged):
     22        Make sure to `setDefaultPlaybackRate:` before `setRate:` as the latter can affect the former.
     23
    1242021-05-07  Carlos Garcia Campos  <cgarcia@igalia.com>
    225
  • trunk/Source/WebCore/platform/ios/PlaybackSessionInterfaceAVKit.mm

    r274249 r277203  
    127127void PlaybackSessionInterfaceAVKit::rateChanged(bool isPlaying, float playbackRate, float defaultPlaybackRate)
    128128{
     129    [m_playerController setDefaultPlaybackRate:defaultPlaybackRate];
    129130    [m_playerController setRate:isPlaying ? playbackRate : 0.];
    130     [m_playerController setDefaultPlaybackRate:defaultPlaybackRate];
    131131}
    132132
  • trunk/Source/WebCore/platform/ios/WebAVPlayerController.mm

    r275956 r277203  
    197197        return;
    198198
     199    // In AVKit, the `defaultPlaybackRate` is used when playback starts, such as resuming after
     200    // pausing. In WebKit, however, `defaultPlaybackRate` is only used when first loading and after
     201    // ending scanning, with the `playbackRate` being used in all other cases, including when
     202    // resuming after pausing. As such, WebKit should return the `playbackRate` instead of the
     203    // `defaultPlaybackRate` in these cases when communicating with AVKit.
     204    [self setDefaultPlaybackRate:_rate];
     205
    199206    if (self.delegate && self.delegate->playbackRate() != _rate)
    200207        self.delegate->setPlaybackRate(_rate);
Note: See TracChangeset for help on using the changeset viewer.