how to parse m3u url using kotlin? - android

I'm trying to parse M3U url like this:
http://stream.webradio.bz:8000/vivalaradio3.m3u
and play a radio using MediaPlayer in Android Studio.
But I don't know how to parse it and https://github.com/BjoernPetersen/m3u-parser not work correctly.
Can anyone suggest me how to achieve it?

Related

m3u file cannot download it from Xtream and implement it in IPTV application

I am working on IPTV player that's going to be implementing a m3u file from Xtream but I don't seem to be able to download the m3u file through Android's DownloadManager and I cannot use it for direct parsing.
I tried downloading the m3u file from the browser and that seems to be going completely fine. But whenever I try to get it from the app itself, it just says download unsuccessful.
The download link to the m3u file is something like this :
http://serverip/get.php?username=customeruser&password=customerpassword&type=m3u&output=mpegts
Is there anything that I can do to parse this? I cannot seem to be downloading it so maybe using libVLC or EXOPlayer I can parse the list directly.
I am relatively new to Android Studio so any help would be appreciated!
EDIT: I tried even downloading a simple .jpg file from the DownloadManager and it seems to be working fine, but downloading m3u files is yet still unsuccessful.
LibVLC can read M3U streams. Try playing your URL in VLC for Android app, if it works, then you can reproduce the same behavior (code is OSS).

How to play .pls file in android

Can anyone give me the sample code for parsing and playing .pls file in android?
[playlist]
NumberOfEntries=1
File1=http://stream.radiosai.net:8002/
You need to download the .pls file and read it to find the media file inside since pls is a playlist not a format.
I've been searching for a solution for 2 days about this issue and I've finally found a radio player which you can implement into your code: https://github.com/iammert/RadioPlayerService that plays .pls files from a radio service link (such as: http://stream.radiosai.net:8002/ ).
However, that url on your question should work on the default MediaPlayer but if anyone ever encounters this problem with urls that contain a .pls file, then they should use a radio player that supports the encoding and format.
.

Playing .pls file not working in android 2.2 [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
How to stream an .pls audio file in android 2.2
Can any body tell how to stream and play an .pls audio file using media player in android 2.2...
As far as I know .pls file contain information about songs or live radio stream. For exmaple when you use shoutcast api it returns .pls file which contain information related to list of radio stations like url of live radio stream, station name etc. Try opening it in notepad to see its format and information it contain. You have to parse url of song or station from it.
First of all read the pls specification. You'll see it's quite straightforward. Just parse the pls file and extract the songs that you want to play.

Asx stream on Android

I have a requirement of playing a Asx stream through an Android application
I have read the Android documentation, and they don't seem to support Windows Media streams
Is there any workaround possible? Has anyone did that before? If yes, is there some source code available? Or a library that implements this
Thanks
Are you worried about asx file only or any possible outcome after this?
The asx file can be readable as simple string, read the file using byte array and you can get one or many urls that can be
pls file
m3u file
mp3 url
wma url
We don't have to worry about 1,2 and 3. 1 and 2 can have different parsing logics but at the end they will give 3 [mp3 url] and an mp3 url can be easily handled by MediaPlayer api in android . but 4 is also difficult work to be done.

Download mp3 instead of playing with Webkit

I am using Android 1.5
I am trying to download mp3 via URL link, but instead of download proccess I get auto-play via the webkit.
I do want to download the mp3 file, not to play it straightly from the browser.
Any idea how could I solve this?
thanks,
ray.
Send an HTTP Content-Disposition header, like this:
Content-Disposition: attachment;filename="file.mp3"
You can also set the MIME type to application/force-download, but that shouldn't really be necessary.

Categories

Resources