Author Topic: BASSHLS beta (HTTP Live Streaming add-on)  (Read 20055 times)

melvinlee.yk

  • Posts: 6
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #50 on: 17 Oct '16 - 04:01 »
Not all HLS streams include titles in the EXTINF tags, but that one does. I'm not sure if it will solve the problem you're having, but you should probably cast the BASS_ChannelGetTags return value to a String, like this:

Code: [Select]
String extinf = (String)BASS.BASS_ChannelGetTags(audioOutStream, BASSHLS.BASS_TAG_HLS_EXTINF);

That stream does also include ID3v2 tags (title and artist). You can use the Tags add-on to process them.

Code: [Select]
String title = TAGS.TAGS_Read(audioOutStream, "%ARTI - %TITL");

Hi Ian,

Thanks for the advise. However, the casting of
Code: [Select]
String extinf = (String)BASS.BASS_ChannelGetTags(audioOutStream, BASSHLS.BASS_TAG_HLS_EXTINF); doesn't seem to work as in the returns are still null.

But using
Code: [Select]
String title = TAGS.TAGS_Read(audioOutStream, "%ARTI - %TITL"); does allows me to see the Artist and Track within the Id3v2 tag.

Thanks.


« Last Edit: 17 Oct '16 - 04:18 by melvinlee.yk »

radio42

  • Posts: 4573
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #51 on: 17 Oct '16 - 08:12 »
Try this:
Code: [Select]
Utils.IntPtrAsStringUtf8(BASS_ChannelGetTags(handle, BASSTag.BASS_TAG_HLS_EXTINF));

Ian @ un4seen

  • Administrator
  • Posts: 20396
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #52 on: 17 Oct '16 - 17:23 »
Thanks for the advise. However, the casting of
Code: [Select]
String extinf = (String)BASS.BASS_ChannelGetTags(audioOutStream, BASSHLS.BASS_TAG_HLS_EXTINF); doesn't seem to work as in the returns are still null.

Oh yes, I think I know what the problem is. The error code (from BASS_ErrorGetCode) is 501, isn't it? The JNI stuff for the BASS_TAG_HLS_EXTINF tag (to convert to Java string) hasn't been implemented yet. I will put up an update to correct that tomorrow.

Ian @ un4seen

  • Administrator
  • Posts: 20396
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #53 on: 18 Oct '16 - 15:17 »
An update is now up in the 1st post, adding the missing JNI stuff for the BASS_TAG_HLS_EXTINF tag. This update also adds support for URLs that begin with "//" in the playlists, so all platforms have been updated.

An updated NETRADIO example has also been put in the Android BASS package, with support for HLS streams and displaying of the BASS_TAG_HLS_EXTINF tag.

melvinlee.yk

  • Posts: 6
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #54 on: 19 Oct '16 - 03:50 »
Thanks for the advise. However, the casting of
Code: [Select]
String extinf = (String)BASS.BASS_ChannelGetTags(audioOutStream, BASSHLS.BASS_TAG_HLS_EXTINF); doesn't seem to work as in the returns are still null.

Oh yes, I think I know what the problem is. The error code (from BASS_ErrorGetCode) is 501, isn't it? The JNI stuff for the BASS_TAG_HLS_EXTINF tag (to convert to Java string) hasn't been implemented yet. I will put up an update to correct that tomorrow.

Thanks a lot Ian.

Code: [Select]
BASS.BASS_ChannelGetTags(audioOutStream, BASSHLS.BASS_TAG_HLS_EXTINF); is now returning values with formats like below. Appreciate that.  ;)

Code: [Select]
10,title="Fever",artist="The Black Keys"

Rob Oldaker

  • Guest
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #55 on: 13 Dec '16 - 15:19 »
Hi,

I have been using the hls plug to see if I can stream the BBC IPlayer. Live radio streams work a treat:
example below:-
http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/sbr_high/ak/bbc_6music.m3u8

However the pre-recorded programmes they have don't work. This is an example url that fails:-
http://cp401492-vh.akamaihd.net/i/prod_af_mp4_heaacv1_48/iplayerstream/p04htkml_b085j6fh_1481406091165.mp4/index_0_a.m3u8
The error coming back is BASS_ERROR_FILEOPEN

Any ideas what might be wrong. The second stream plays ok in "https://www.hlsplayer.net/"

Thanks,

Rob.

Ian @ un4seen

  • Administrator
  • Posts: 20396
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #56 on: 13 Dec '16 - 16:15 »
However the pre-recorded programmes they have don't work. This is an example url that fails:-
http://cp401492-vh.akamaihd.net/i/prod_af_mp4_heaacv1_48/iplayerstream/p04htkml_b085j6fh_1481406091165.mp4/index_0_a.m3u8
The error coming back is BASS_ERROR_FILEOPEN

What do you see if you download that M3U8 file and open it in a text editor? Trying that here, I see "An error occurred while processing your request", which would explain why it isn't working. Do you have another URL that does contain a valid M3U8 file and isn't playable with BASSHLS?

Rob Oldaker

  • Guest
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #57 on: 14 Dec '16 - 13:59 »
Hi,

I think the error maybe due to the streams becoming unavailable after a period of time. This is another stream that has the same errors:-
http://cp401492-vh.akamaihd.net/i/prod_af_mp4_heaacv1_48/iplayerstream/p04g738d_b082vyqf_1479742915685.mp4/index_0_a.m3u8?hdnea=st=1481723378~exp=1481744978~acl=/*p04g738d_b082vyqf_1479742915685.mp4*~hmac=813f0d8b0d6a36c11ae5cbee606dc9e450ff9df68861387f71b2daf0ec8de182

These are the first few lines of the downloaded .m3u8 file (there are a few hundred of the streams listed in the file):-
#EXTM3U
#EXT-X-TARGETDURATION:10
#EXT-X-ALLOW-CACHE:YES
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:1
#EXTINF:10.000,
http://cp401492-vh.akamaihd.net/i/prod_af_mp4_heaacv1_48/iplayerstream/p04g738d_b082vyqf_1479742915685.mp4/segment1_0_a.ts
#EXTINF:10.000,
http://cp401492-vh.akamaihd.net/i/prod_af_mp4_heaacv1_48/iplayerstream/p04g738d_b082vyqf_1479742915685.mp4/segment2_0_a.ts
#EXTINF:10.000,
http://cp401492-vh.akamaihd.net/i/prod_af_mp4_heaacv1_48/iplayerstream/p04g738d_b082vyqf_1479742915685.mp4/segment3_0_a.ts
#EXTINF:10.000,
http://cp401492-vh.akamaihd.net/i/prod_af_mp4_heaacv1_48/iplayerstream/p04g738d_b082vyqf_1479742915685.mp4/segment4_0_a.ts

Thanks,

Rob.

Ian @ un4seen

  • Administrator
  • Posts: 20396
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #58 on: 14 Dec '16 - 17:23 »
Ah, I see the problem. The server is setting a cookie when sending the playlist and it requires that cookie to be included when requesting the playlist entries. Here's an update for you to try:

   www.un4seen.com/stuff/basshls.dll

Rob Oldaker

  • Guest
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #59 on: 19 Dec '16 - 19:46 »
Hi,

Thanks for the update, that worked!  :). The BBC IPlayer has multiple stream urls for each program they offer and the new plugin works fine with all the ones I have tried.

However, I am having an issue with setting the position of the stream. I use the method BASS_ChannelSetPosition, using the one with a "double" second parameter of the stream position in seconds. Its coming back with "BASS_ERROR_POSITION". Is this supported? I am using the channel in "decode" mode so am setting the flag to "BASSFlag.BASS_STREAM_DECODE|BASSFlag.BASS_SAMPLE_FLOAT".

Thanks,

Rob.

Ian @ un4seen

  • Administrator
  • Posts: 20396
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #60 on: 20 Dec '16 - 15:37 »
Seeking in HLS streams isn't currently supported, but I guess that ability could be added for playlists that contain the entire stream (ie. include "EXT-X-PLAYLIST-TYPE"). I'll put that on the "look into it" list :)

In the meantime, one way you could implement seeking is to download the playlist and remove the media segments that you want to skip before passing it to BASSHLS (using mem=TRUE with BASS_HLS_StreamCreateFile). Note that the media segment URLs must be absolute (not relative) then so that BASSHLS knows where to find them. If you want to start at a mid-segment position, you can use the BASS_POS_DECODETO flag with BASS_ChannelSetPosition to achieve that.

Rob Oldaker

  • Guest
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #61 on: 20 Dec '16 - 20:24 »
OK, thanks for the response - I will give it a go.

rob.

Rob Oldaker

  • Guest
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #62 on: 22 Dec '16 - 09:28 »
Your suggestion worked great :). I didn't try setting the position within each segment but just set the position to the segment boundaries by manipulating the .m3u8 file downloaded.

Its very fast to start playing and seeking within the stream.

I don't think the fix you did for the cookies works with this method, however. The cookies get set when you download the .m3u8 and there is no way of telling the "StreamCreateFile" method what cookies are required for the stream segments. This is no big deal as there are three "types" of streams available and only one has the requirement for cookies.

Rob.

pzs7602

  • Posts: 54
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #63 on: 5 Feb '17 - 12:58 »
Is there a Windows Store version of BASSHLS available?

Ian @ un4seen

  • Administrator
  • Posts: 20396
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #64 on: 6 Feb '17 - 17:40 »
A Windows Store version has now been added to the package in the 1st post.

pzs7602

  • Posts: 54
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #65 on: 7 Feb '17 - 13:21 »
@Ian Thanks!

BS

  • Posts: 1
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #66 on: 22 Sep '17 - 20:36 »
Hi,

My code works fine for (AAC+, MP3, WMA), but don't work for HLS when I use this URL http://ebcnacionalam-live.hls.adaptive.level3.net/hls-live/ebcremuxlive-ebcnacionalam/_definst_/live.m3u8. Sometimes (interval 10 minutes) the stream is break and I need restart...

In the VLC https://www.videolan.org/, the audio is interrupted for 1 second approximately and resumed.
In the TheOPlayer http://demo.theoplayer.com/test-hls-mpeg-dash-stream works perfect without interrupt.

Ian, the netradio-hls.exe work as VLC, but the stream not resumed.
Could you please test my URL?

DLLs Version:
Bass: 2.4.12.1
Bass_ACC: 2.4.5.1
BassWMA: 2.4.5.1
BassHLS: 0.0.0.6

ak545

  • Posts: 8
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #67 on: 23 Sep '17 - 21:52 »
Hi,

My code works fine for (AAC+, MP3, WMA), but don't work for HLS when I use this URL http://ebcnacionalam-live.hls.adaptive.level3.net/hls-live/ebcremuxlive-ebcnacionalam/_definst_/live.m3u8. Sometimes (interval 10 minutes) the stream is break and I need restart...

In the VLC https://www.videolan.org/, the audio is interrupted for 1 second approximately and resumed.
In the TheOPlayer http://demo.theoplayer.com/test-hls-mpeg-dash-stream works perfect without interrupt.

Ian, the netradio-hls.exe work as VLC, but the stream not resumed.
Could you please test my URL?

DLLs Version:
Bass: 2.4.12.1
Bass_ACC: 2.4.5.1
BassWMA: 2.4.5.1
BassHLS: 0.0.0.6

Working
https://youtu.be/I2q2iKOCV4U

In your code, maybe there is not enough of some plug-in.
I'm writing my player on Lazarus 1.6.4 and I have your station played perfectly. I use the following plugins:

Code: [Select]
    {$IFDEF MSWINDOWS}
    BASS_PluginLoad(PChar(ExtractFilePath(Application.ExeName)+'bass_aac.dll'), 0);
    BASS_PluginLoad(PChar(ExtractFilePath(Application.ExeName)+'basshls.dll'), 0);
    BASS_PluginLoad(PChar(ExtractFilePath(Application.ExeName)+'bassflac.dll'), 0);
    BASS_PluginLoad(PChar(ExtractFilePath(Application.ExeName)+'bass_ape.dll'), 0);
    BASS_PluginLoad(PChar(ExtractFilePath(Application.ExeName)+'basswv.dll'), 0);
    BASS_PluginLoad(PChar(ExtractFilePath(Application.ExeName)+'bass_ac3.dll'), 0);
    BASS_PluginLoad(PChar(ExtractFilePath(Application.ExeName)+'bass_mpc.dll'), 0);
    BASS_PluginLoad(PChar(ExtractFilePath(Application.ExeName)+'bassalac.dll'), 0);
    BASS_PluginLoad(PChar(ExtractFilePath(Application.ExeName)+'bassdsd.dll'), 0);
    BASS_PluginLoad(PChar(ExtractFilePath(Application.ExeName)+'bassopus.dll'), 0);
    {$ENDIF}
    {$IFDEF LINUX}
    BASS_PluginLoad(PChar(ExtractFilePath(Application.ExeName)+'libbass_aac.so'), 0);
    BASS_PluginLoad(PChar(ExtractFilePath(Application.ExeName)+'libbasshls.so'), 0);
    BASS_PluginLoad(PChar(ExtractFilePath(Application.ExeName)+'libbassflac.so'), 0);
    BASS_PluginLoad(PChar(ExtractFilePath(Application.ExeName)+'libbass_ape.so'), 0);
    BASS_PluginLoad(PChar(ExtractFilePath(Application.ExeName)+'libbasswv.so'), 0);
    BASS_PluginLoad(PChar(ExtractFilePath(Application.ExeName)+'libbass_ac3.so'), 0);
    BASS_PluginLoad(PChar(ExtractFilePath(Application.ExeName)+'libbass_mpc.so'), 0);
    BASS_PluginLoad(PChar(ExtractFilePath(Application.ExeName)+'libbassalac.so'), 0);
    BASS_PluginLoad(PChar(ExtractFilePath(Application.ExeName)+'libbassdsd.so'), 0);
    BASS_PluginLoad(PChar(ExtractFilePath(Application.ExeName)+'libbassopus.so'), 0);
    {$ENDIF}
    {$IFDEF DARWIN}
    BASS_PluginLoad(PChar(ExtractFilePath(Application.ExeName)+'libbasshls.dylib'), 0);
    BASS_PluginLoad(PChar(ExtractFilePath(Application.ExeName)+'libbassflac.dylib'), 0);
    BASS_PluginLoad(PChar(ExtractFilePath(Application.ExeName)+'libbass_ape.dylib'), 0);
    BASS_PluginLoad(PChar(ExtractFilePath(Application.ExeName)+'libbasswv.dylib'), 0);
    BASS_PluginLoad(PChar(ExtractFilePath(Application.ExeName)+'libbass_ac3.dylib'), 0);
    BASS_PluginLoad(PChar(ExtractFilePath(Application.ExeName)+'libbass_mpc.dylib'), 0);
    BASS_PluginLoad(PChar(ExtractFilePath(Application.ExeName)+'libbassdsd.dylib'), 0);
    BASS_PluginLoad(PChar(ExtractFilePath(Application.ExeName)+'libbassopus.dylib'), 0);
    {$ENDIF}

Ian @ un4seen

  • Administrator
  • Posts: 20396
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #68 on: 25 Sep '17 - 17:25 »
My code works fine for (AAC+, MP3, WMA), but don't work for HLS when I use this URL http://ebcnacionalam-live.hls.adaptive.level3.net/hls-live/ebcremuxlive-ebcnacionalam/_definst_/live.m3u8. Sometimes (interval 10 minutes) the stream is break and I need restart...

This appears to be a CDN/server bug. It is occasionally sending the media playlist gzip encoded even though gzip encoding is not requested via an "Accept-Encoding" header. I suspect the level3.net CDN is simply caching the first version it serves and then it serves that to everyone else even if it doesn't match the requested encoding. It looks like the origin is including a "Vary: Accept-Encoding" header in its response, which means a different response should be sent based on the requested encoding, but the CDN appears to be ignoring that.

What you could try is to set a BASS_SYNC_DOWNLOAD sync to detect when the connection closes, and then keep retrying BASS_StreamCreateURL to reconnect (it may take a while until a fresh non-gzip media playlist is available). You can then also set a BASS_SYNC_END sync to detect when playback reaches the end, to trigger playback of the new stream (if you happen to be able to reconnect before playback ends).

Ian @ un4seen

  • Administrator
  • Posts: 20396
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #69 on: 3 Oct '17 - 17:57 »
The "final" version of the BASSHLS add-on is up now on the BASS page. Several new features were added since the last beta:
  • Local files are supported, ie. the playlist entries can be local files, as can EXT-X-KEY tag URIs.
  • The approximate length of complete media playlists (containing an EXT-X-ENDLIST tag) is available (from BASS_ChannelGetLegth), and seeking (via BASS_ChannelSetPosition) is also supported. Except for short forward seeks, seeking will involve reconnecting to the server to fetch the media segment containing the requested position, so it may take some time and may also stop short of the requested position to save some time.
  • Standalone MPEG-TS files/streams (outside of an HLS playlist) are supported via the plugin system, ie. when BASSHLS is loaded via BASS_PluginLoad.
  • When a master playlist is used, the EXT-X-STREAM-INF tag for the active media playlist is available via a new BASS_TAG_HLS_STREAMINF tag.
  • If provided in the media playlist, the initial EXT-X-PROGRAM-DATE-TIME tag value is available via a new BASS_TAG_HLS_DATE tag, to give the start date/time.

roberto

  • Posts: 1
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #70 on: 9 Nov '17 - 17:04 »
I am having problems using the HLS library to stream BBC radio. An example link is below:-
http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/sbr_high/ak/bbc_radio_three.m3u8

The stream starts OK but just stops between 1 - 10mins. The return from BASS_ChannelGetData is BASS_ERROR_ENDED.

I have tried the stream in VLC and works fine (it streamed OK for a number of hours).

I have done most of the testing on Windows but also behaves like this on Linux.

The HLS library works fine with pre-recorded programmes and will play right through to the end of the programme.

Any thoughts?

Thanks for your time,

Rob.

ak545

  • Posts: 8
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #71 on: 9 Nov '17 - 17:20 »
I am having problems using the HLS library to stream BBC radio. An example link is below:-
http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/sbr_high/ak/bbc_radio_three.m3u8


Access Denied

You don't have permission to access "http://as-hls-uk-live.akamaized.net/pool_7/live/bbc_radio_three/bbc_radio_three.isml/bbc_radio_three-audio=320000.norewind.m3u8" on this server.
Reference #18.ad4ad7a4.1510247960.df04217

Ian @ un4seen

  • Administrator
  • Posts: 20396
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #72 on: 10 Nov '17 - 15:34 »
I am having problems using the HLS library to stream BBC radio. An example link is below:-
http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/sbr_high/ak/bbc_radio_three.m3u8

The stream starts OK but just stops between 1 - 10mins. The return from BASS_ChannelGetData is BASS_ERROR_ENDED.

I don't seem to be able to reproduce that here (it hadn't stopped yet after an hour), so I will send you a debug version to get more info.