Skip to content
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/webview_flutter/webview_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

* Updates minimum supported SDK version to Flutter 3.29/Dart 3.7.
* Updates README to reflect that only Android API 24+ is supported.
* Disables legacy Android video poster.

## 4.13.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

package io.flutter.plugins.webviewflutter;

import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.net.Uri;
import android.os.Message;
import android.view.View;
Expand Down Expand Up @@ -239,6 +241,16 @@ public boolean onJsPrompt(
public static class SecureWebChromeClient extends WebChromeClient {
@Nullable WebViewClient webViewClient;

/**
* Removes the gray Android player icon.
*
* <p>See https://issues.chromium.org/issues/40755557.
*/
@Override
public Bitmap getDefaultVideoPoster() {
return Bitmap.createBitmap(1, 1, Config.ALPHA_8);
}

@Override
public boolean onCreateWindow(
@NonNull final WebView view,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,4 +214,14 @@ public void onJsPrompt() {
verify(mockApi)
.onJsPrompt(eq(instance), eq(webView), eq(url), eq(message), eq(defaultValue), any());
}

@Test
public void getDefaultVideoPoster() {
final WebChromeClientProxyApi mockApi = mock(WebChromeClientProxyApi.class);
when(mockApi.getPigeonRegistrar()).thenReturn(new TestProxyApiRegistrar());

final WebChromeClientImpl instance = new WebChromeClientImpl(mockApi);

assertNotNull(instance.getDefaultVideoPoster());
}
}