-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[webview_flutter_android] Added the functionality to fullscreen html5…
… video (#3879) At this moment on android the fullscreen html5 video does not work. This PR solves that issues, adding the functionality that the video is played fullscreen when you click on the fullscreen-button in the video player. Fixes flutter/flutter#27101 - [ x I read and followed the [relevant style guides] and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use `dart format`.)
- Loading branch information
Showing
33 changed files
with
1,911 additions
and
88 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
packages/webview_flutter/webview_flutter_android/CHANGELOG.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
...oid/src/main/java/io/flutter/plugins/webviewflutter/CustomViewCallbackFlutterApiImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
package io.flutter.plugins.webviewflutter; | ||
|
||
import android.webkit.WebChromeClient.CustomViewCallback; | ||
import androidx.annotation.NonNull; | ||
import androidx.annotation.VisibleForTesting; | ||
import io.flutter.plugin.common.BinaryMessenger; | ||
import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.CustomViewCallbackFlutterApi; | ||
|
||
/** | ||
* Flutter API implementation for `CustomViewCallback`. | ||
* | ||
* <p>This class may handle adding native instances that are attached to a Dart instance or passing | ||
* arguments of callbacks methods to a Dart instance. | ||
*/ | ||
public class CustomViewCallbackFlutterApiImpl { | ||
// To ease adding additional methods, this value is added prematurely. | ||
@SuppressWarnings({"unused", "FieldCanBeLocal"}) | ||
private final BinaryMessenger binaryMessenger; | ||
|
||
private final InstanceManager instanceManager; | ||
private CustomViewCallbackFlutterApi api; | ||
|
||
/** | ||
* Constructs a {@link CustomViewCallbackFlutterApiImpl}. | ||
* | ||
* @param binaryMessenger used to communicate with Dart over asynchronous messages | ||
* @param instanceManager maintains instances stored to communicate with attached Dart objects | ||
*/ | ||
public CustomViewCallbackFlutterApiImpl( | ||
@NonNull BinaryMessenger binaryMessenger, @NonNull InstanceManager instanceManager) { | ||
this.binaryMessenger = binaryMessenger; | ||
this.instanceManager = instanceManager; | ||
api = new CustomViewCallbackFlutterApi(binaryMessenger); | ||
} | ||
|
||
/** | ||
* Stores the `CustomViewCallback` instance and notifies Dart to create and store a new | ||
* `CustomViewCallback` instance that is attached to this one. If `instance` has already been | ||
* added, this method does nothing. | ||
*/ | ||
public void create( | ||
@NonNull CustomViewCallback instance, | ||
@NonNull CustomViewCallbackFlutterApi.Reply<Void> callback) { | ||
if (!instanceManager.containsInstance(instance)) { | ||
api.create(instanceManager.addHostCreatedInstance(instance), callback); | ||
} | ||
} | ||
|
||
/** | ||
* Sets the Flutter API used to send messages to Dart. | ||
* | ||
* <p>This is only visible for testing. | ||
*/ | ||
@VisibleForTesting | ||
void setApi(@NonNull CustomViewCallbackFlutterApi api) { | ||
this.api = api; | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
...ndroid/src/main/java/io/flutter/plugins/webviewflutter/CustomViewCallbackHostApiImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
package io.flutter.plugins.webviewflutter; | ||
|
||
import android.webkit.WebChromeClient.CustomViewCallback; | ||
import androidx.annotation.NonNull; | ||
import io.flutter.plugin.common.BinaryMessenger; | ||
import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.CustomViewCallbackHostApi; | ||
import java.util.Objects; | ||
|
||
/** | ||
* Host API implementation for `CustomViewCallback`. | ||
* | ||
* <p>This class may handle instantiating and adding native object instances that are attached to a | ||
* Dart instance or handle method calls on the associated native class or an instance of the class. | ||
*/ | ||
public class CustomViewCallbackHostApiImpl implements CustomViewCallbackHostApi { | ||
// To ease adding additional methods, this value is added prematurely. | ||
@SuppressWarnings({"unused", "FieldCanBeLocal"}) | ||
private final BinaryMessenger binaryMessenger; | ||
|
||
private final InstanceManager instanceManager; | ||
|
||
/** | ||
* Constructs a {@link CustomViewCallbackHostApiImpl}. | ||
* | ||
* @param binaryMessenger used to communicate with Dart over asynchronous messages | ||
* @param instanceManager maintains instances stored to communicate with attached Dart objects | ||
*/ | ||
public CustomViewCallbackHostApiImpl( | ||
@NonNull BinaryMessenger binaryMessenger, @NonNull InstanceManager instanceManager) { | ||
this.binaryMessenger = binaryMessenger; | ||
this.instanceManager = instanceManager; | ||
} | ||
|
||
@Override | ||
public void onCustomViewHidden(@NonNull Long identifier) { | ||
getCustomViewCallbackInstance(identifier).onCustomViewHidden(); | ||
} | ||
|
||
private CustomViewCallback getCustomViewCallbackInstance(@NonNull Long identifier) { | ||
return Objects.requireNonNull(instanceManager.getInstance(identifier)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.