Android Question [B4A][AddoMedia3] url not playable?

oligo92

Member
Hello,

Any idea why the following url is not working (goes to IDLE) with the player whilst it works using any web browser?
http://tsfjazz.ice.infomaniak.ch/tsfjazz-high.mp3

Code used:
Summary:
Player.ClearMediaItems
    
If url.EndsWith("m3u8") Then
    Player.Add_media_Source(Player.CreateHLSSource(url))
Else
    Player.Add_media_Source(Player.CreateUriSource(url))
End If

Player.Prepare
Player.Play

other ".mp3" radios are working fine

Thanks

Olivier
 

Scantech

Well-Known Member
Licensed User
Longtime User
B4X:
    addoPlayer.ClearMediaItems
  
    Dim sources As List
    sources.Initialize
    sources.Add(addoPlayer.CreateUriSource("http://tsfjazz.ice.infomaniak.ch/tsfjazz-high.mp3"))
  
    addoPlayer.CreateListSource(sources)
    Media3PlayerView1.Player = addoPlayer
  
    ' Important to call this method Before Playing
    addoPlayer.Prepare
    addoPlayer.Play

CreateUriSource works. Are you missing this code?
B4X:
addoPlayer.CreateListSource(sources)

Check my example. It works
 
Last edited:
Upvote 0

oligo92

Member
I'm using the CreateUriSource as per your example for this webradio but it is going to IDLE. I'll be glad you send me your complete B4X project to check it's working at home (configuration issue?)
Thanks
 
Upvote 0

oligo92

Member
Actually, it seems this issue is because my code was on a B4XPages project, not in the Main module of a Default project (I tried with this configuration - maybe the same than for your code). No idea why....
I have to rewrite my code:rolleyes:.

Cheers!
 
Upvote 0

Scantech

Well-Known Member
Licensed User
Longtime User
So, did you get it to work as per last message?

Dont forget this in manifest.
B4X:
CreateResourceFromFile(Macro, Core.NetworkClearText)
 

Attachments

  • exoplayer.zip
    9.7 KB · Views: 86
Upvote 0

oligo92

Member
Yes, changing the app from a B4XPage project to a Default one make the thing work. That's the (right) way your app was done.
I don't get the reason (would be curious to know why) but after all, the important is to make the things work ;)

One last issue is to fix is the problem of the "connection lost" (player does not sound anymore) after some minutes when the phone is not used (and the screen black). Any idea on this?

Anyway thanks for your help

Olivier
 
Upvote 0

oligo92

Member
I expect it never stops playing when the phone is not "live" (it is locked after 5 minutes of inactivity, then, about 4 minutes after, player stops)
 
Upvote 0
Top