-
Notifications
You must be signed in to change notification settings - Fork 695
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
Permission Camera & androidStudio Build Error #473
Comments
Building the plugin for Android requires Unity's classes.jar so some special steps are required (cf. https://github.com/gree/unity-webview/tree/d380b1bb2564d73b55f169accb5135e3ee218a8d#how-to-build-webviewpluginjar ). |
Thank you for your reply my comment. so i update from your plugin(just execute /dist in unity-webview.unitypackage) and build and run my project. not modify script. test address is #359 's address WebViewObject webViewObject = if i join from Computer browser(Chrome) above address, show popup message( are you allow camera permission? ). |
Okay, i finally success using webview - Video Chat. (tested from https://appr.tc/ , and add audio.) |
The last code doesn't work if the target api is 23 or later, so I've fixed further in #477 and updated binaries. I'm not sure how you solved the issue for Video Chat, but a whole webview should be destroyed if you destroy the GameObject (cf. unity-webview/sample/Assets/Scripts/SampleWebView.cs Lines 169 to 171 in 4b720b5
|
i read your reply, and Update from "unitypackage". |
I tested for the sample app with the following setting. and at least the app showed the page. Camera permission/feature is added to AndroidManifest.xml by defining Could you please tell me your environment? My environment is:
|
My environment is :
i tested not need Camera page(like https://www.google.com/ ) |
Okay... I Think My Project is wrong.. |
The sample app has a button to destroy/create the webview: unity-webview/sample/Assets/Scripts/SampleWebView.cs Lines 172 to 179 in 681fa44
By pressing this If you want to stop/start the camera without destroying the webview, you might need to directly control the web content through Also, it might be better to request the permission at start and/or just before creating the webview, as requesting the permission when the webview requests it may be too late (the webview continues to run while the permission dialog is displayed). The following is an example modification for the sample app. diff --git a/sample/Assets/Scripts/SampleWebView.cs b/sample/Assets/Scripts/SampleWebView.cs
index a62c1ca..a5efe9f 100644
--- a/sample/Assets/Scripts/SampleWebView.cs
+++ b/sample/Assets/Scripts/SampleWebView.cs
@@ -24,6 +24,9 @@ using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Networking;
#endif
+#if !UNITY_EDITOR && UNITY_ANDROID
+using UnityEngine.Android;
+#endif
public class SampleWebView : MonoBehaviour
{
@@ -31,8 +34,29 @@ public class SampleWebView : MonoBehaviour
public GUIText status;
WebViewObject webViewObject;
+#if !UNITY_EDITOR && UNITY_ANDROID
+ bool inRequestingCameraPermission;
+
+ void OnApplicationFocus(bool hasFocus)
+ {
+ if (inRequestingCameraPermission && hasFocus) {
+ inRequestingCameraPermission = false;
+ }
+ }
+#endif
+
IEnumerator Start()
{
+#if !UNITY_EDITOR && UNITY_ANDROID
+ if (!Permission.HasUserAuthorizedPermission(Permission.Camera))
+ {
+ inRequestingCameraPermission = true;
+ Permission.RequestUserPermission(Permission.Camera);
+ }
+ while (inRequestingCameraPermission) {
+ yield return new WaitForSeconds(0.5f);
+ }
+#endif
webViewObject = (new GameObject("WebViewObject")).AddComponent<WebViewObject>();
webViewObject.Init(
cb: (msg) => If it is okay, I would like to revert 662142d as the above approach is more straightforward and doesn't require to include extra aar files. |
also consider my situation - i'm using Vuforia AR Camera, so Camera rendering is already use. so i asked 'how do i restart rendering Unity Camera?' |
I have no experience about Vuforia, but it seems to have CameraDevice API: and there are some discussions about CameraDevice and VuforiaBehavior: https://stackoverflow.com/questions/49925576/how-to-switch-change-front-and-back-vuforia-ar-camera-using-a-button/49975991#49975991 These could be utilized to stop Vuforia and/or its camera before opening the webview and to restart Vuforia and/or its camera after closing the webview. |
Finally successed VideoChat!. (I hope my project will be no errors next time.) Thank you for your helpful mind and your spent time. P.S. i think next update will added permission microphone. it just my idea. |
Thanks! I'll later add the permission. |
Hi, I'm trying to using your webview plugin.
it can be show webpage, but Can't show popup message(allow camera and microphone) and access permission camera.
so i read #360 , and download zip file, open android studio. (open file path is /plugins/Android )
but i see this error -
Gradle Sync Issues - ERROR: Cannot read packageName from C:\Users\Q\Desktop\unity-webview-master\plugins\Android\gradle_build\src\main\AndroidManifest.xml
can i get update plugin ? ( please update for access permission camera. current project can't access camera via webpage.)
The text was updated successfully, but these errors were encountered: