Android Question How to Play video Loaded by Webview with flash player

Makumbi

Well-Known Member
Licensed User
Please help how can i play a this video please help i have attached a small project

B4X:
#Region  Project Attributes
    #ApplicationLabel: B4A ExampleLessons
    #VersionCode: 38
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    Private cc As ContentChooser
End Sub

Sub Globals
    Private WebView1 As WebView
    Dim rr As Reflector
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("1")
    Dim client As JavaObject
    client.InitializeNewInstance(Application.PackageName & ".main$MyChromeClient", Null)
    Dim jo As JavaObject = WebView1
    jo.RunMethod("setWebChromeClient", Array(client))
    'WebView1.LoadUrl("http://www.kccug.com/KabojjaApp/LessonsDispalys.aspx")
    CreateWV
    'WebView1.LoadUrl("http://www.kccug.com/KabojjaApp/Accessionregister.aspx")
    'WebView1.LoadUrl("https://b4x.com:51041/websocket_with_fileupload/index.html")
   
End Sub
Sub CreateWV
    'WebView1.Initialize("myw")
    'Activity.AddView(WebView1,0,0,1024,560)
    rr.Target = WebView1
    rr.Target = rr.RunMethod("getSettings")
    rr.RunMethod2("setPluginsEnabled", True, "java.lang.boolean")
    WebView1.JavaScriptEnabled = True
    WebView1.ZoomEnabled = True
    WebView1.Visible = True
    WebView1.LoadURL("http://www.kccug.com/KabojjaApp/LessonsDispalys.aspx")
End Sub
Sub ShowFile_Chooser (FilePathCallback As Object, FileChooserParams As Object)
    cc.Initialize("CC")
    cc.Show("*/*", "Choose File")
    Wait For CC_Result (Success As Boolean, Dir As String, FileName As String)
    Dim jo As JavaObject = Me
    If Success Then
        Log(FileName)
        File.Copy(Dir, FileName, Starter.Provider.SharedFolder, "TempFile")
        jo.RunMethod("SendResult", Array(Starter.Provider.GetFileUri("TempFile"), FilePathCallback))
    Else
        jo.RunMethod("SendResult", Array(Null, FilePathCallback))
    End If
End Sub

#if Java
import android.webkit.*;
import android.webkit.WebChromeClient.*;
import android.net.*;
public static void SendResult(Uri uri, ValueCallback<Uri[]> filePathCallback) {
    if (uri != null)
        filePathCallback.onReceiveValue(new Uri[] {uri});
    else
        filePathCallback.onReceiveValue(null);
       
}
public static class MyChromeClient extends WebChromeClient {
@Override
public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback,
            FileChooserParams fileChooserParams) {
        processBA.raiseEventFromUI(this, "showfile_chooser", filePathCallback, fileChooserParams);
        return true;
    }
    }
#End If
 

Attachments

  • Screenshot_1589537755.png
    Screenshot_1589537755.png
    45.7 KB · Views: 233
  • Backup 1 2020-05-15 13.41.zip
    10.6 KB · Views: 251
Last edited:
Top