Android Question play m3u8 using exoplayer

zedapp

Member
Upvote 0

Scantech

Well-Known Member
Licensed User
Longtime User
and now, i am trying to find a sample project named i think "issac IPTV" to learn how to play this url
Issac iptv

It works on my latest version. Did not test it with the attached version. Try it

May need to use Exoplay allowCrossProtocolRedirects(true). Not sure if the attach has that example. I'm away from pc
 
Last edited:
Upvote 0

zedapp

Member
Hi issac, nice to talk with you, all this day i am searchin for your sample, i haven't found it, help me to finish with success my project bro,,
 
Upvote 0

Scantech

Well-Known Member
Licensed User
Longtime User
Hi issac, nice to talk with you, all this day i am searchin for your sample, i haven't found it, help me to finish with success my project bro,,
Did you click Issac iptv above your last message? It will direct you to a thread that have the zip file.

Click here
 
Upvote 0

Scantech

Well-Known Member
Licensed User
Longtime User
I think that the problem here is related with the DRM (Digital Rights Management) wich is necessary for playing like this urls and to get this drm should pay for that.
Im not sure about that. It did play on my latest version. The version i provided in that link is outdated and you need to implement the uri as provided below.

B4X:
player1.Prepare(CreateUriSource("Add the link"))

B4X:
Private Sub CreateUriSource(Uri 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(Uri))))
End Sub

replace the player1.Prepare with the above code and it should work.
 
Upvote 0

zedapp

Member
hello again, thx friend, it does not works, i think that when the links format is .mpd then the player shoold prepared by "CreateDashSource" : mp. Player.Prepare(mp.Player.CreateDashSource("http.my_link.mpd"))
 
Upvote 0

Scantech

Well-Known Member
Licensed User
Longtime User
hello again, thx friend, it does not works, i think that when the links format is .mpd then the player shoold prepared by "CreateDashSource" : mp. Player.Prepare(mp.Player.CreateDashSource("http.my_link.mpd"))
This link you provided works https://list.iptvcat.com/my_list/s/cd2d894163943026cf508431042366e6.m3u8 it has 1 link in the file.

https://kwtspta.cdn.mangomolo.com/sp/smil:sp.stream.smil/chunklist.m3u8 i have no clue what this is. Did you use HLS for this?

I'm not sure about .Mpd
 
Last edited:
Upvote 0

Scantech

Well-Known Member
Licensed User
Longtime User
It appears you probably using your project example correct?

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

And in Build Configurations i use these 2 (HU2_PUBLIC, HU2_ACCEPTALL) in Conditional symbols. Add them seperately
 
Upvote 0

zedapp

Member
hello, Great job it works, thanx for your help, my problem was with the manifest and build config as you have said !!
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…