B4X:
Log("(Try CreateUriSource)")
Player.Prepare(CreateUriSource(VideoUrl))
Player.Play
Wait for Player_Error(Message As String)
Log("Error: " & Message)
'Try Second
Log("(Try CreateHLSSource)")
Player.Prepare(Player.CreateHLSSource(VideoUrl))
Player.Play
Wait for Player_Error(Message As String)
Log("Error: " & Message)
'Reset here
ProgressAvailableandPBar(True)
End Sub
Sub CreateUriSource(VideoUrl As String) As Object
Dim ctxt As JavaObject
ctxt.InitializeContext
Dim HttpDataSourceFactory As JavaObject
HttpDataSourceFactory.InitializeNewInstance("androidx.media3.datasource.DefaultHttpDataSource$Factory", Null)
HttpDataSourceFactory.RunMethod("setAllowCrossProtocolRedirects", Array(True))
Dim DataSource As JavaObject = HttpDataSourceFactory.RunMethod("createDataSource", Null)
Dim DataSourceFactory As JavaObject = ctxt.CreateEvent("androidx.media3.datasource.DataSource.Factory", "", DataSource)
Dim ProgressiveMediaSourceFactory As JavaObject
ProgressiveMediaSourceFactory.InitializeNewInstance("androidx.media3.exoplayer.source.ProgressiveMediaSource.Factory", Array(DataSourceFactory))
Dim MediaItem As JavaObject
MediaItem.InitializeStatic("androidx.media3.common.MediaItem")
Return ProgressiveMediaSourceFactory.RunMethod("createMediaSource", Array(MediaItem.RunMethod("fromUri", Array(VideoUrl))))
End Sub
The above Player.Prepare(Player.CreateHLSSource(VideoUrl)) is broken in latest version. v1.4 was ok. so i do this below
B4X:
Log("(Try CreateUriSource)")
CreateUriSource(VideoUrl)
Player.Prepare
Player.Play
Wait for Player_Error(Message As String)
Log("Error: " & Message)
'Try Second
Log("(Try CreateHLSSource)")
Player.CreateHLSSource(VideoUrl)
Player.Prepare
Player.Play
Wait for Player_Error(Message As String)
Log("Error: " & Message)
That did not work. I even tried setting player.prepare before player.createHLSSource(VideoUrl) and that did not work. I even tried only one of them at time by disabling other, no luck.
Can't play anything and the error is not triggering when its suppose to.
Last edited: