Log in or register to post comments

VideoPlayback strange behavior when turning ForwardNativeEventsToDalvik to true

August 21, 2013 - 5:48pm #1

Hello again,

 

I'm facing a really wierd issue (seems more like a bug to me). I'm replacing the video in the VideoPlaback sample with links from the cloud. I'm implementing a scrollable webview (from Gree). In order to make the webview scrollable, I've to set the value of "unityplayer.ForwardNativeEventsToDalvik" to "true" in the android manifest. When I do that, everything works fine, but there is a wierd behavior I noticed on further testing:

On touching the screen thrice (a triple-click, if you may), the video in the first target starts loading on its own and starts playing in the native video player. On turning the value back to "false", this issue doesn't arise. Is this an issue with the plugin, or is it just me facing this behavior? Also, is there a workaround for getting a scrollable webview without having to modify the manifest file?

 

Regards,

Parth Darji

VideoPlayback strange behavior when turning ForwardNativeEventsT

August 26, 2013 - 1:59pm #11

Hmm, I don´t think that is the same problem:

They say, that they have to call the webview in an own activity, because unity would swallow the keystrokes. But first there are 2 things, that don´t fit my/our problem: 

1) not all keys are swallowed (like I described below, but more than that:

2) when you implement the webview into a standart-Unity projekt (without Vuforia) it works perfectly and gets all the keystrokes.

I think at some level the problem has to arise from Vuforia...

VideoPlayback strange behavior when turning ForwardNativeEventsT

August 26, 2013 - 1:01pm #10

It appears that they've found a solution for the keyboard input issue here - https://github.com/gree/unity-webview/issues/6

VideoPlayback strange behavior when turning ForwardNativeEventsT

August 26, 2013 - 12:58pm #9

Another thought that just crossed my mind: (don´t mind me if it sounds stupid, because it is quite late over here, where I live:)
I use the webview based on kogarasi. But could the "working" keys actually be the ones that are conform with the japanese keyboard?

VideoPlayback strange behavior when turning ForwardNativeEventsT

August 26, 2013 - 12:46pm #8

Hi,

after one more day of trial and huge error, I just might have found a lead!
After some more research: I thought it might be an issue about, which window had "focus", which is why I tried to change the webview sources in something like:

mWebView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
switch (event.getAction()) {
               case MotionEvent.ACTION_DOWN:
               case MotionEvent.ACTION_UP:
                   if (!v.hasFocus()) {
                       v.requestFocus();
                   }
                   break;
           }
           return false;
}
});

But, it didn´t change anything!

But now I tried some more and I found something:
There are some keys that actually do work! 
Unforturnately I don´t know the mac keystrokes for most of them T.T 
But among them is the "€" as well as "pi" the "root" sign, the multiplier sign and the "divide-sign".
That´s why I´m thinking among the lines of: maybe the keyboard layout is screwed up!? - maybe it is on some math-layout.
That is the good news: the bad news is: I have no idea how to proceed from here.
Do you have any ideas about what I should try?

Thx

Maik

 

 

VideoPlayback strange behavior when turning ForwardNativeEventsT

August 22, 2013 - 7:34am #7

Hi Parth,

yeah I tried a non-Vuforia Project. And like I said: Everything works fine without Vuforia!
Just as soon, as I add the vuforia package, I have to add the line about: "unityplayer.ForwardNativeEventsToDalvik" to forward the touch events and the keystrokes aren´t transported anymore.

This sould give us a pretty clear picture of the problem. It seams to be the same problem as with the touches, I just don´t know, how to redirect the key-input the same way as the touches.

Thx for reply

Maik
 

VideoPlayback strange behavior when turning ForwardNativeEventsT

August 22, 2013 - 7:29am #6

I've see apps that appear to use the webview and are capable of presenting the keyboard input. Have you tested this w/ a non-Vuforia Unity project?

 

This is probably a good question for Unity Answers, or their forum as well. I've evaluated Gree, but haven't done much with it.

VideoPlayback strange behavior when turning ForwardNativeEventsT

August 22, 2013 - 5:13am #5

Hello Maik,

 

I've been able to reproduce the same problem with  the Gree plugin. I tried to load a google page and tried to input from the keyboard. The keyboard opens up fine and places inputs fine (this is know because I have "word suggestions" ON in my phone and it gives me suggestions as I type), but as you said, nothing comes up in the search box and nothing happens on clicking the "Search" button. I think this has something to do with the "OnDetachFromWindow" event from Unity, since this is called whenever an activity leaves unity window. Still, not sure.

I currently don't need this functionality, but it'd be good if someone can throw some light on this issue for further reference.

 

Regards,

Parth

VideoPlayback strange behavior when turning ForwardNativeEventsT

August 22, 2013 - 4:28am #4

Hi there,

I´m having a problem in just the same department and would like to attach it here. 
But if you want me to, I´d post it as a seperat topic, too.

I´m using the same webview (based kogarasi) and changed the "forwardNativeEventsToDalvik" as you said yourself to get the touch-input for the website.
But I just can´t seem to get any keyboard input. Unfortunately I found no documentation about any other attributes then the "forwardNative..."
When I tab into a Text-Field in the webview, the android keyboard comes up, but the keystrokes are not transported to the webview.

The webview itself works with unity great, but as soon as I insert the vuforia files...

On iOS touches and keyboard are working with no adjustment.

Does anybody have an idea, how I get the Manifest to forward keyboard events to the webview too?

 

Thx in advance

Maik

VideoPlayback strange behavior when turning ForwardNativeEventsT

August 22, 2013 - 4:13am #3

Hey David,

 

Thank you for your help. This indeed was the problem. I disabled the VideoPlaybackController component before opening the webview and it worked perfect.

 

About the touch event, yes I'm being able to click the links inside the webview.

EDIT:

I've not been able to test catching the fields as none of my html files have any forms. If you want, I can try adding some fields for testing. But from what I understand, if scrolls are working fine, even the fields should work just fine.

Regards,

Parth Darji

VideoPlayback strange behavior when turning ForwardNativeEventsT

August 21, 2013 - 6:33pm #2

It may be that the touch event is penetrating the webview and reaching the plane of the Video player. Try disabling the Video Player Controller on the ARCamera when launching the webview, and renabling when hiding the view. That script handles touches for the Video prefabs and defines their behavior.

Have you been able to catch events on the webpages you're loading - e.g. links and fields?

Log in or register to post comments