Android Question How can I reset the exoplayer while playing encountered an error

teddybear

Well-Known Member
Licensed User
When I play with the Exoplayer, if there is a problem with a URL source, it will throw out a error Error: com.google.android.exoplayer2.upstream.exoplayer HttpDataSource$HttpDataSourceException: Unable to connect to https...
and I can catch the error in play_error event.
I have set the player is paused and call native.RunMethod("next", Null) method, then replay but it still does not work. I have to cancel the activity and reload it.
How can I let it run again?
 
Last edited:

musaso

Active Member
Licensed User
What I do is run and stop Exoplayer with a service (yourservice).

B4X:
Sub Service_Create
    Exoplayer.Initialize("exo1")
    .....
    .....
End Sub

Sub Service_Destroy
        Exo1.Release
    .....
    .....
End Sub

Sub exo1_Error (Message As String)
    StopService(Me)
    .....
    .....
End Sub
 
Upvote 0

teddybear

Well-Known Member
Licensed User
What I do is run and stop Exoplayer with a service (yourservice).

B4X:
Sub Service_Create
    Exoplayer.Initialize("exo1")
    .....
    .....
End Sub

Sub Service_Destroy
        Exo1.Release
    .....
    .....
End Sub

Sub exo1_Error (Message As String)
    StopService(Me)
    .....
    .....
End Sub
Thanks for your reply, It's a solution for me.
 
Upvote 0
Top