requestMediaPlaybackState method

  1. @SupportedPlatforms.new(platforms: [IOSPlatform(apiName: 'WKWebView.requestMediaPlaybackState', apiUrl: 'https://developer.apple.com/documentation/webkit/wkwebview/3752241-requestmediaplaybackstate', available: '15.0'), MacOSPlatform(apiName: 'WKWebView.requestMediaPlaybackState', apiUrl: 'https://developer.apple.com/documentation/webkit/wkwebview/3752241-requestmediaplaybackstate', available: '12.0'), LinuxPlatform(apiName: 'JavaScript HTMLMediaElement.paused', apiUrl: 'https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/paused', note: 'Uses JavaScript to query media playback state')])
Future<MediaPlaybackState?> requestMediaPlaybackState()

Requests the playback status of media in the web view. Returns a MediaPlaybackState that indicates whether the media in the web view is playing, paused, or suspended. If there’s no media in the web view to play, this method provides MediaPlaybackState.NONE.

Officially Supported Platforms/Implementations:

Use the PlatformInAppWebViewController.isMethodSupported method to check if this method is supported at runtime.

Implementation

@SupportedPlatforms(
  platforms: [
    IOSPlatform(
      apiName: 'WKWebView.requestMediaPlaybackState',
      apiUrl:
          'https://developer.apple.com/documentation/webkit/wkwebview/3752241-requestmediaplaybackstate',
      available: '15.0',
    ),
    MacOSPlatform(
      apiName: 'WKWebView.requestMediaPlaybackState',
      apiUrl:
          'https://developer.apple.com/documentation/webkit/wkwebview/3752241-requestmediaplaybackstate',
      available: '12.0',
    ),
    LinuxPlatform(
      apiName: 'JavaScript HTMLMediaElement.paused',
      apiUrl:
          'https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/paused',
      note: 'Uses JavaScript to query media playback state',
    ),
  ],
)
Future<MediaPlaybackState?> requestMediaPlaybackState() {
  throw UnimplementedError(
    '${PlatformInAppWebViewControllerMethod.requestMediaPlaybackState.name} is not implemented on the current platform',
  );
}