Android Question [SOLVED] - ExoPlayer - Not connecting when used in a "Default" B4A app.

rleiman

Well-Known Member
Licensed User
Greetings,

I have been using the original sample project that came with the ExoPlayer and modified it so I could stream a radio source from the web. That works perfectly. Since I was satisfied that I could stream the radio station, I created a new "default" app from scratch. I copy and pasted the code from the original ExoPlayer app to the new app. When I ran the new app, this error was posted in the Logs.

B4X:
Error: com.google.android.exoplayer2.upstream.HttpDataSource$HttpDataSourceException: Unable to connect to http://128.199.109.254:8000/320
Since the original ExoPlayer sample project was created with an older version of B4A, I think some difference between that version and the current version of B4A could be causing the connection issue.

Can you check this coding and let me know what I need to change so it will work with new "default" projects because the same coding works in the original project?

Thanks.

B4X:
#Region  Project Attributes
    #ApplicationLabel: VIFM Radio Streaming
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

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

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Private xui As XUI
    Private player1 As SimpleExoPlayer
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Layout")

    If FirstTime Then
        player1.Initialize("player")
        Dim sources As List
        sources.Initialize
        sources.Add(player1.CreateuriSource("http://128.199.109.254:8000/320"))
        player1.Prepare(player1.CreateListSource(sources))       
    End If
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub Player_Ready
    Log("Ready")
End Sub

Sub Player_Error (Message As String)
    Log("Error: " & Message)
End Sub

Sub Player_Complete
    Log("complete")
End Sub

Sub Button1_Click
    player1.Pause
End Sub
 

JohnC

Well-Known Member
Licensed User
You probably need to add this to the manifest to allow non-ssl connections (http):
 

rleiman

Well-Known Member
Licensed User
You probably need to add this to the manifest to allow non-ssl connections (http):
John,

Thanks so much for the fast reply! It connects now.
 
Top