pauseAllMediaPlayback method
- @SupportedPlatforms.new(platforms: [IOSPlatform(apiName: 'WKWebView.pauseAllMediaPlayback', apiUrl: 'https://developer.apple.com/documentation/webkit/wkwebview/3752240-pauseallmediaplayback', available: '15.0'), MacOSPlatform(apiName: 'WKWebView.pauseAllMediaPlayback', apiUrl: 'https://developer.apple.com/documentation/webkit/wkwebview/3752240-pauseallmediaplayback', available: '12.0'), LinuxPlatform(apiName: 'JavaScript HTMLMediaElement.pause()', apiUrl: 'https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/pause', note: 'Uses JavaScript to pause all audio and video elements')])
Pauses playback of all media in the web view.
Officially Supported Platforms/Implementations:
- iOS WKWebView 15.0+ (Official API - WKWebView.pauseAllMediaPlayback)
- macOS WKWebView 12.0+ (Official API - WKWebView.pauseAllMediaPlayback)
- Linux WPE WebKit (Official API - JavaScript HTMLMediaElement.pause()):
- Uses JavaScript to pause all audio and video elements
Use the PlatformInAppWebViewController.isMethodSupported method to check if this method is supported at runtime.
Implementation
@SupportedPlatforms(
platforms: [
IOSPlatform(
apiName: 'WKWebView.pauseAllMediaPlayback',
apiUrl:
'https://developer.apple.com/documentation/webkit/wkwebview/3752240-pauseallmediaplayback',
available: '15.0',
),
MacOSPlatform(
apiName: 'WKWebView.pauseAllMediaPlayback',
apiUrl:
'https://developer.apple.com/documentation/webkit/wkwebview/3752240-pauseallmediaplayback',
available: '12.0',
),
LinuxPlatform(
apiName: 'JavaScript HTMLMediaElement.pause()',
apiUrl:
'https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/pause',
note: 'Uses JavaScript to pause all audio and video elements',
),
],
)
Future<void> pauseAllMediaPlayback() {
throw UnimplementedError(
'${PlatformInAppWebViewControllerMethod.pauseAllMediaPlayback.name} is not implemented on the current platform',
);
}