Author Topic: iOS native *.pls and *.m3u playing  (Read 342 times)

ivanpetrov16130

  • Posts: 8
iOS native *.pls and *.m3u playing
« on: 13 Jun '17 - 09:18 »
Hello!

I'm maintaining iOS native app, which allows to play internet radio stations. I use the BASS, last version.
The problem is some radio stations aren't played. Their URLs have M3U and PLS extensions(http://www.radiostationXXX.com/live.pls, http://meta.radiostationYYY.ru/r/r2.m3u).
In case of "radiostationXXX" I get BASS error code 2(can't open the file), and "radiostationYYY" turns into BASS error code 41(unsupported file format).
I don't get why this is happening, because Android version of app(which uses BASS too) plays those radio stations pretty well.
I tried to google, but it seems iOS BASS should support both *.m3u and *.pls.
I have no idea where to start research, any suggestions would be appreciated.

Thank you!

P.S.
I use BASS_STREAM_BLOCK, BASS_STREAM_STATUS, BASS_STREAM_AUTOFREE flags in BASS_StreamCreateURL(...).
Oh, and most of stations are playing successfully.

Ian @ un4seen

  • Administrator
  • Posts: 20336
Re: iOS native *.pls and *.m3u playing
« Reply #1 on: 13 Jun '17 - 16:23 »
BASS_StreamCreateURL does support M3U and PLS files when the BASS_CONFIG_NET_PLAYLIST option is enabled (via BASS_SetConfig). If you are enabling that and still having a problem, please give the affected URLs to investigate what's happening with them.

ivanpetrov16130

  • Posts: 8
Re: iOS native *.pls and *.m3u playing
« Reply #2 on: 14 Jun '17 - 15:53 »
BASS_StreamCreateURL does support M3U and PLS files when the BASS_CONFIG_NET_PLAYLIST option is enabled (via BASS_SetConfig).

Yes, it's enabled.

Those links:
http://www.radioeins.de/live.pls error code 2
http://metafiles.gl-systemhaus.de/hr/hr2_2.m3u error code 41
http://metafiles.gl-systemhaus.de/hr/hr1_2.m3u error code 41

I've checked them out via AIMP and iTunes - they are OK.
I could show my code, if needed.

Ian @ un4seen

  • Administrator
  • Posts: 20336
Re: iOS native *.pls and *.m3u playing
« Reply #3 on: 14 Jun '17 - 17:03 »
All 3 of those URLs are working fine when I try them on iOS here, so that's strange. Do you have the problem with them all the time or does it only happen sometimes? Please try checking the response headers by using the BASS_STREAM_STATUS flag and providing a DOWNLOADPROC in your BASS_StreamCreateURL call, something like this:

Code: [Select]
stream=BASS_StreamCreateURL(url, 0, BASS_STREAM_STATUS, DownloadProc, NULL);

...

void DownloadProc(const void *buffer, DWORD length, void *user)
{
if (buffer && !length) {
// log the HTTP/ICY headers in "buffer"
}
}

ivanpetrov16130

  • Posts: 8
Re: iOS native *.pls and *.m3u playing
« Reply #4 on: 14 Jul '17 - 15:06 »
Buffer says that "HTTP 200 OK" both for working and "cracked" stations.

Ian @ un4seen

  • Administrator
  • Posts: 20336
Re: iOS native *.pls and *.m3u playing
« Reply #5 on: 14 Jul '17 - 15:36 »
Is that only for the PLS/M3U file or for the stream too? The DownloadProc callback function should receive the headers for both. Also try logging all of the headers (not only the HTTP status), like this:

Code: [Select]
void DownloadProc(const void *buffer, DWORD length, void *user)
{
if (buffer && !length) {
while (*buffer) {
// log the HTTP/ICY header in "buffer"
buffer+=strlen(buffer)+1;
}
}
}

ivanpetrov16130

  • Posts: 8
Re: iOS native *.pls and *.m3u playing
« Reply #6 on: 21 Jul '17 - 14:19 »
Only for PLS/M3U. Here is the link of printed headers for pls, m3u and stream stations.

https://pastebin.com/UuKRq7n3

I've learned some info about android version: they open m3u url with content type audio/x-mpegurl as usual, but then stream-link from m3u-file opens automatically and has content type of audio/mpeg . In iOS BASS_StreamCreateURL returns 0. Am I supposed to download and parse m3u/pls files for myself?

Ian @ un4seen

  • Administrator
  • Posts: 20336
Re: iOS native *.pls and *.m3u playing
« Reply #7 on: 21 Jul '17 - 15:16 »
No, you don't need to download/parse the playlist yourself if BASS_CONFIG_NET_PLAYLIST is enabled (non-0).

Is your DOWNLOADPROC function receiving the stream headers after the playlist headers within the same BASS_StreamCreateURL call? If not, are you sure that BASS_CONFIG_NET_PLAYLIST is enabled, ie. does BASS_GetConfig confirm that?

ivanpetrov16130

  • Posts: 8
Re: iOS native *.pls and *.m3u playing
« Reply #8 on: 24 Jul '17 - 11:46 »
BASS_CONFIG_NET_PLAYLIST was non-0. It was 3000. Seems like previous developer had made typo in constants-file. My bad, I had to find this out before.
Anyway, thank you for your help and lost time.
« Last Edit: 24 Jul '17 - 12:10 by ivanpetrov16130 »