Hi, I'm using SendInput Library in order to click on the middle of the webview. I start saying that I'm not and i don't want to click on an html element, but on a play streaming which is not compatible with octopus player.
The libreary is doing a great job so far, but it seems is not really able to click on the webview. The code I'm using is
Is there anything wrong? I'm using an example from SoftOrientation Library which allows me to change orientation without killing the activity.
I want to clarify and be specific to whoever will complain about this method....
This streaming MUST be tapped couple of times, sometimes twice, because otherwise pop up and ads will appear on the stream itself ( so override url will not work too ). So just setting the orientation to fullscreen won't solve anything, it must be tapped twice or trice in order to be really fullscreen. It really doesn't matter where the library has to tap, any part of the webview will do its job. Thanks
The libreary is doing a great job so far, but it seems is not really able to click on the webview. The code I'm using is
B4X:
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim t As Timer
t.Enabled=False
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim click As Int
Dim si As SendInput
Private UltimateWebView1 As UltimateWebView
Private SoftOrientation As SoftOrientationForActivities 'Download SoftOrientationLibrary from: https://www.b4x.com/android/forum/threads/softorientation-library-for-activitiy-and-b4xpages-based-projects.143896/#post-912287
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'This line is added to Manifest: SetActivityAttribute(Main, android:configChanges, "orientation|keyboardHidden|screenSize|screenLayout"). It prevents the Activity from being redrawn on screen orientation changes.
Activity.LoadLayout("Main")
SoftOrientation.Initialize(Me,"SoftOrientation",Activity,"Main")
SoftOrientation.Orientation=SoftOrientation.SCREEN_ORIENTATION_SENSOR
UltimateWebView1.AllowFullScreenVideo(True,True)
UltimateWebView1.SwipeToReload=True
Dim Headerrs As Map
Headerrs.Initialize
Headerrs.Put("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36")
UltimateWebView1.LoadUrl2("https://starlive.xyz/embed.php?id=liveSport_Calcio",Headerrs)
t.Initialize("t",100)
End Sub
Sub Activity_Resume
End Sub
'This event will be activated when the orientation change procedure is completed.
Private Sub SoftOrientation_ActivityConfigurationChanged (NewConfiguration As AndroidContentResConfiguration)
If NewConfiguration.Orientation=NewConfiguration.Constants.ORIENTATION_PORTRAIT Then
Log("portrait")
Else if NewConfiguration.Orientation=NewConfiguration.Constants.ORIENTATION_LANDSCAPE Then
t.Enabled=True
Log("landscape")
End If
End Sub
'Do not forget to add line in Manifest for your future projects: SetActivityAttribute(Main, android:configChanges, "orientation|keyboardHidden|screenSize|screenLayout")
'Do not forget to create single Layout file for portrait and landscape mode in Designer in your future projects. Recommended to use variants, designer script and anchors.
'********************Copy this part of codes to your future project Main activity, including Java code*********************************
Public Sub onConfigurationChanged (NewConfig As Object)
SoftOrientation.OnConfigurationChanged(NewConfig)
End Sub
#If Java
import android.content.res.Configuration;
@Override
public void onConfigurationChanged (Configuration newConfig) {
super.onConfigurationChanged(newConfig);
processBA.raiseEvent(null, "onconfigurationchanged", newConfig);
}
#End If
'************************************End of code*********************************************************************************************
Sub Activity_Pause (UserClosed As Boolean)
If UserClosed Then
ExitApplication
End If
End Sub
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event
If KeyCode=KeyCodes.KEYCODE_BACK Then
If UltimateWebView1.CanGoBack=True Then
UltimateWebView1.GoBack
Return True
Else
Return False
End If
Else
Return False
End If
End Sub
Sub btnGo_Click
End Sub
Sub t_tick
Log(click)
si.SendTap(UltimateWebView1.Height/2, UltimateWebView1.Width/2)
click=click+1
If click=3 Then
t.Enabled=False
click=0
End If
End Sub
Is there anything wrong? I'm using an example from SoftOrientation Library which allows me to change orientation without killing the activity.
I want to clarify and be specific to whoever will complain about this method....
This streaming MUST be tapped couple of times, sometimes twice, because otherwise pop up and ads will appear on the stream itself ( so override url will not work too ). So just setting the orientation to fullscreen won't solve anything, it must be tapped twice or trice in order to be really fullscreen. It really doesn't matter where the library has to tap, any part of the webview will do its job. Thanks