Creates a sample stream from an HLS playlist on the internet, optionally receiving the downloaded data in a callback.
HSTREAM BASS_HLS_StreamCreateURL( char *url, DWORD flags, DOWNLOADPROC *proc, void *user );
|url||URL of the file to stream. Should begin with "http://" or "https://" or "ftp://".|
|flags||A combination of these flags.
|proc||Callback function to receive the data as it is downloaded... NULL = no callback.|
|user||User instance data to pass to the callback function.|
|BASS_ERROR_INIT||BASS_Init has not been successfully called.|
|BASS_ERROR_NOTAVAIL||Only decoding channels (BASS_STREAM_DECODE) are allowed when using the "no sound" device. The BASS_STREAM_AUTOFREE flag is also unavailable to decoding channels.|
|BASS_ERROR_NONET||No internet connection could be opened.|
|BASS_ERROR_ILLPARAM||url is not a valid URL.|
|BASS_ERROR_SSL||SSL/HTTPS support is not available.|
|BASS_ERROR_TIMEOUT||The server did not respond to the request within the timeout period, as set with the BASS_CONFIG_NET_TIMEOUT config option.|
|BASS_ERROR_FILEOPEN||The file could not be opened.|
|BASS_ERROR_FILEFORM||The file's format is not recognised/supported.|
|BASS_ERROR_FORMAT||The sample format is not supported by the device/drivers. If the stream is more than stereo or the BASS_SAMPLE_FLOAT flag is used, it could be that they are not supported (ie. no WDM drivers).|
|BASS_ERROR_SPEAKER||The specified SPEAKER flags are invalid. The device/drivers do not support them, they are attempting to assign a stereo stream to a mono speaker or 3D functionality is enabled.|
|BASS_ERROR_MEM||There is insufficent memory.|
|BASS_ERROR_NO3D||Could not initialize 3D support.|
|BASS_ERROR_UNKNOWN||Some other mystery problem!|
The main parts of the HLS spec are supported. The supported playlist tags are: EXTINF, EXT-X-BYTERANGE, EXT-X-ENDLIST, EXT-X-KEY, EXT-X-MEDIA-SEQUENCE, EXT-X-PROGRAM-DATE-TIME, EXT-X-STREAM-INF, EXT-X-TARGETDURATION. Details can be found in the HLS spec: https://tools.ietf.org/html/draft-pantos-http-live-streaming
As well as possibly ID3v2 tags, additional HLS specific tags may be available from BASS_ChannelGetTags. A sync can be set to be informed of when a new segment starts downloading, which could be used to refresh the per-segment tags. The current segment's sequence number is available from BASS_StreamGetFilePosition with BASS_FILEPOS_HLS_SEGMENT.
A DOWNLOADPROC callback function can be used to receive the downloaded data from all of the segments. When the data is in an MPEG-TS container, the audio data will be extracted from the container before being passed to the callback function.
Master playlists are supported, but BASSHLS will simply play the first entry from them. If you would like to play a different entry (eg. perhaps for a different bitrate), you could download the master playlist separately and then extract the wanted entry's URL from it and pass that to BASSHLS.
If the media playlist contains an EXT-X-ENDLIST tag to indicate a complete sequence, the length of the sequence (according to the sum of the EXTINF tags) will be available from BASS_ChannelGetLength and seeking will be possible via BASS_ChannelSetPosition. 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. If the requested position is not on a segment boundary then additional processing is required to reach it, and if that takes a long time then the seeking may stop short even if the BASS_POS_INEXACT flag is not used. BASS_ChannelGetPosition can be used to confirm what the position actually is after seeking, and if required, the BASS_POS_DECODETO flag can be used in additional BASS_ChannelSetPosition calls to reach the wanted position.
BASS_ChannelGetInfo, BASS_ChannelGetTags, BASS_ChannelPlay, BASS_ChannelSetAttribute, BASS_ChannelSetDSP, BASS_ChannelSetFX, BASS_StreamFree, DOWNLOADPROC callback, BASS_CONFIG_NET_AGENT, BASS_CONFIG_NET_BUFFER, BASS_CONFIG_NET_PREBUF, BASS_CONFIG_NET_PROXY, BASS_CONFIG_NET_TIMEOUT