-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added fullscreen-video support #892
base: master
Are you sure you want to change the base?
Added fullscreen-video support #892
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi there,
First I'd like to thank you for your time in preparing this PR. I was able to give this a glance over and there's a few main things that I want to point out.
-
There are new classes added that needs to be licensed under the Apache license for Apache to accept the code. If you have permission from the original author to re-license the code under the Apache License, then the Apache license headers needs to be added. Otherwise we cannot accept the Pr unfortunately.
-
This PR adds maintenance support for code going back as Android 3.0 (API 11). Cordova only supports API >= 22 and adding conditional logic to support anything less adds unnecessary complexity. I would like to see this simplified by removing any extra code required to support APIs < 22.
Kind regards,
Norman
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The deletion of these lines will probably cause problems with our release process where it checks for proper license headers. Please revert these deletions
attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN; | ||
attrs.flags |= WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; | ||
window.setAttributes(attrs); | ||
if (android.os.Build.VERSION.SDK_INT >= 14) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As of cordova-android@9, our supported min SDK is 22.
We don't need to have defensive checks here, and can assume that the SDK will be at least 22.
{ | ||
//noinspection all | ||
int flags = View.SYSTEM_UI_FLAG_LOW_PROFILE; | ||
if (android.os.Build.VERSION.SDK_INT >= 16) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same situation above.
attrs.flags &= ~WindowManager.LayoutParams.FLAG_FULLSCREEN; | ||
attrs.flags &= ~WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; | ||
window.setAttributes(attrs); | ||
if (android.os.Build.VERSION.SDK_INT >= 14) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment above
} | ||
|
||
// For Android 3.0+ | ||
public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to support android 3.x
return true; | ||
} | ||
|
||
// For Android 4.1+ | ||
public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to support android 4.x
* - The invoking activity must call VideoEnabledWebChromeClient's onBackPressed() inside of its own onBackPressed(). | ||
* - Tested in Android API levels 8-19. Only tested on http://m.youtube.com. | ||
* | ||
* @author Cristian Perez (http://cpr.name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you Christian Perez? If not, do you have permission to submit this code under the Apache license?
If yes, then the Apache license needs to be added to this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems copy/pasted from https://github.com/cprcrack/VideoEnabledWebView
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems copy/pasted from https://github.com/cprcrack/VideoEnabledWebView
It actually is. I needed those changes in my current project so I forked the latest repo and modified it so, if anyone else wants to use it. They can.
* - Javascript is enabled by default and must not be disabled with getSettings().setJavaScriptEnabled(false). | ||
* - setWebChromeClient() must be called before any loadData(), loadDataWithBaseURL() or loadUrl() method. | ||
* | ||
* @author Cristian Perez (http://cpr.name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same concern above regarding licensing.
@@ -132,8 +133,10 @@ Licensed to the Apache Software Foundation (ASF) under one | |||
private boolean mediaPlaybackRequiresUserGesture = false; | |||
private boolean shouldPauseInAppBrowser = false; | |||
private boolean useWideViewPort = true; | |||
private ValueCallback<Uri[]> mUploadCallback; | |||
private ValueCallback<Uri> mUploadCallback; | |||
private ValueCallback<Uri[]> mUploadCallbackLollipop; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing code that handles API < 21 should also eliminate the need to have two different class members to handle different API levels.
private final static int FILECHOOSER_REQUESTCODE = 1; | ||
private final static int FILECHOOSER_REQUESTCODE_LOLLIPOP = 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing here; see comment above.
Hey Norman, |
To hopefully save you some time, I think it would be best to analyse and see if you can fulfil the original requirements to solve #320 without using the code by Cristian Perez. The original code appears to be licensed under MIT, and while that may allow you to copy the code for your own use, all code submitted to Apache needs to be licensed under the Apache license. So either the code By Christian needs to be removed, or we need obtain written permission to be able to license that code under Apache. If this cannot be done, then we should close this PR. |
Platforms affected
Android
Motivation and Context
Adds full-screen video view support
Issue 320
Description
Updated InAppBrowser.java and InAppChromeClient.java
Added VideoEnabledWebChromeClient.java and VideoEnabledWebView.java
Code used to implement came from here which was originally derived from this.
Testing
Tested on Andoird 10 & Andoird 11
Checklist
(platform)
if this change only applies to one platform (e.g.(android)
)