Android Question after update B4A v 10.0 exoplayer v1.42 not playing audio

omarruben

Active Member
Licensed User
Longtime User
Hello, I am updating my apps , I have a audio streaming player working without any problem, so I wanted to start using the new features of B4A 10, I load the app and recompile, and there is no audio at all
anybody can help ?
basic code:
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.
    Private playBtn As Button
    
    Dim sources As List
    
    Private SimpleExoPlayerView1 As SimpleExoPlayerView
End Sub

Sub Activity_Create(FirstTime As Boolean)
    If FirstTime Then
        player1.Initialize("player1")
        sources.Initialize
        sources.Add(player1.CreateUriSource("http://ny2.radiocast.us:8033/;"))
        player1.Prepare(player1.CreateListSource(sources))
    End If
    
    Activity.LoadLayout("Layout")
    SimpleExoPlayerView1.Player = player1
    player1.Volume=1
    player1.Play
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub Button1_Click
    
    
End Sub

Sub playBtn_Click
    player1.Play
    xui.MsgboxAsync("Hello world!", "B4X")
End Sub
 

DonManfred

Expert
Licensed User
Longtime User
Why do you have ";" after url ?
This is probably not the Issue.

Using http instead of https can be an issue. It is´nt permitted in newer Versions of Android.
Maybe this affects audio in this case too? I do not use Exoplayer.
 
Last edited:
Upvote 0

MarcoRome

Expert
Licensed User
Longtime User
Right dear Don now i tried with Android 10 with and without ";" work anyway.
The issue is permission

@omarruben add in your manifest this line:

B4X:
CreateResourceFromFile(Macro, Core.NetworkClearText)
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
fyi: i have no issue here with exoplayer on b4a 10: audio, video, http, https, sdk 28. also tried your radio stream. i do not specifically allow cleartext, but i have no problem with http. i believe this is due to exoplayer's not being part of android's framework. anyway, adding it (as per previous post) won't hurt. something else is going on on your end.
 
Upvote 0

MarcoRome

Expert
Licensed User
Longtime User
fyi: i have no issue here with exoplayer on b4a 10: audio, video, http, https, sdk 28. also tried your radio stream. i do not specifically allow cleartext, but i have no problem with http. i believe this is due to exoplayer's not being part of android's framework. anyway, adding it (as per previous post) won't hurt. something else is going on on your end.
If you have Android 10 is necessary cleartext. If you have android 8 no. What your android version in your test ?
 
Upvote 0

omarruben

Active Member
Licensed User
Longtime User
first, thank you everybody for the help... still the problem.... after insert the cleartext on the manifesto (thank you @MarcoRome ) I have an error in the function Activity.LoadLayout
 

Attachments

  • errorb4x.JPG
    errorb4x.JPG
    202.1 KB · Views: 129
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
If you have Android 10 is necessary cleartext. If you have android 8 no. What your android version in your test ?
pixel3a running 10, to answer your question.

the issue is op's implication that b4a10 is the reason he has a problem with exoplayer. my point was that b4a10 is not the reason since i'm running an exoplayer app compiled with b4a10 that runs on android 8 and android 10.
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
first, thank you everybody for the help... still the problem.... after insert the cleartext on the manifesto (thank you @MarcoRome ) I have an error in the function Activity.LoadLayout


the line # refers to main.java and your b4a file. you have to look in the objects folder and the source.
 
Upvote 0

omarruben

Active Member
Licensed User
Longtime User
@drgottjr what do you mean ? what to look?? I tough b4x handle all these files , or do I have to recreate all?

I have the audio working, I erased the SimpleExoPlayerView (looks like there some kind of cache after compiling) after a few re-compile hits the problem is gone, tryied again inserting the customeview and the problem is back
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
line numbers listed in the log refer to java files that make up your project. you tell your editor to go to that line number. that line will show you the error AND it will reference the b4a line number so you can correct the error.

go to the objects folder in your project, then to src. keep going deeper (2, maybe 3 levels). in there you'll see at least 1 .java file. the main one is main.java. b4a is converted to java during the compilation process. then to byte code. you can see the java files easily. every time you compile your project, the .java files are created. just go to your objects folder now and follow the trail. the .java files should be there waiting. line 39 in main.java.

i use the simpleexoplayerview, so if you use a custom view, you'll have to track down the error in the main.java file
 
Upvote 0
Top