androidiptv

Run iptv & ts urls in android


I am working on a project which requires a player to play iptv which comes in .ts links I used vitamio player but it loads the link as entities and close after only 23 second So my approach is to playvthe link again in onCompleteListener, it works fine but after complete it takes a long time to load the next entity of the link and play it and so on. The question is what is best free player sdk to run ts and iptv links for android?


Solution

  • Usually, the TS segments for a stream will be indexed in a manifest file as part of HLS or MPEG-DASH steaming protocols, although DASH typically uses fragmented mp4 rather than TS.

    You can see examples of this with the example HLS manifests that apple provides in the HLS documentation online (https://developer.apple.com/library/content/technotes/tn2288/_index.html):

    #EXTM3U
    #EXT-X-PLAYLIST-TYPE:VOD
    #EXT-X-TARGETDURATION:10
    #EXT-X-VERSION:3
    #EXT-X-MEDIA-SEQUENCE:0
    #EXTINF:10.0,
    http://example.com/movie1/fileSequenceA.ts 
    #EXTINF:10.0,
    http://example.com/movie1/fileSequenceB.ts
    #EXTINF:10.0,
    http://example.com/movie1/fileSequenceC.ts
    #EXTINF:9.0,
    http://example.com/movie1/fileSequenceD.ts
    #EXT-X-ENDLIST
    

    ExoPlayer (https://github.com/google/ExoPlayer) will play this type of stream - you provide it the manifest file (e.g. myStream.m3u8) file as the source, rather than the individual TS segments.

    If you look in the demo app 'media.exolist.json' in the assets folder you will see it includes a HLS example.

    You can see how it parses the HLS manifest in the 'HlsPlaylistParser' class.