Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 4.10.6

* Changes default image shown when a video is not playing.

## 4.10.5

* Resolves Gradle 9 deprecations.
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 @Nullable 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 @@ -4,6 +4,7 @@

package io.flutter.plugins.webviewflutter;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
Expand All @@ -13,6 +14,7 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Message;
import android.view.View;
Expand Down Expand Up @@ -214,4 +216,17 @@ public void onJsPrompt() {
verify(mockApi)
.onJsPrompt(eq(instance), eq(webView), eq(url), eq(message), eq(defaultValue), any());
}

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

final WebChromeClientImpl instance = new WebChromeClientImpl(mockApi);
final Bitmap poster = instance.getDefaultVideoPoster();

assertNotNull(instance.getDefaultVideoPoster());
assertEquals(1, poster.getWidth());
assertEquals(1, poster.getHeight());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: webview_flutter_android
description: A Flutter plugin that provides a WebView widget on Android.
repository: https://github.com/flutter/packages/tree/main/packages/webview_flutter/webview_flutter_android
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22
version: 4.10.5
version: 4.10.6

environment:
sdk: ^3.9.0
Expand Down