requestMediaPlaybackState method
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:
- iOS WKWebView 15.0+ (Official API - WKWebView.requestMediaPlaybackState)
- macOS WKWebView 12.0+ (Official API - WKWebView.requestMediaPlaybackState)
- Linux WPE WebKit (Official API - JavaScript HTMLMediaElement.paused):
- Uses JavaScript to query media playback state
Use the PlatformInAppWebViewController.isMethodSupported method to check if this method is supported at runtime.
Implementation
Future<MediaPlaybackState?> requestMediaPlaybackState() =>
platform.requestMediaPlaybackState();