Author Topic: seeking in stream from BASS_StreamCreateURL  (Read 241 times)

MHSS

  • Guest
seeking in stream from BASS_StreamCreateURL
« on: 23 Jan '18 - 11:24 »
hello,
i need a valid way to know if i can seek to a byte position in a stream that's made by BASS_StreamCreateURL to a byte position , and not after calling BASS_ChannelSetPosition then checking it it return true or false, since some streams return false and STOP, Reset and change BASS_ChannelIsActive to BASS_ACTIVE_STOPPED in case if the seeking point has not been downloaded yet or the stream is not seekable at all.

so i don't want that to happen, i want to know if i can seek to that point before i call BASS_ChannelSetPosition.
and if there's a way to know the size of the downloaded an seekable bytes size.

flags used in BASS_StreamCreateURL are BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_PRESCAN
BASS_SAMPLE_FLOAT to get floating samples for a visualization, BASS_STREAM_PRESCAN to be able to get the length with BASS_ChannelGetLength, please correct me if im wrong.

thanks for this great library :)

Ian @ un4seen

  • Administrator
  • Posts: 21017
Re: seeking in stream from BASS_StreamCreateURL
« Reply #1 on: 23 Jan '18 - 16:50 »
Unfortunately, there isn't currently any way to just check if it would be possible to seek to a particular position, but BASS_ChannelSetPosition should generally leave playback uninterrupted when it isn't possible to seek to the requested position. Let me know what file format(s) you've seen playback stop with, and I'll look into that.

MHSS

  • Guest
Re: seeking in stream from BASS_StreamCreateURL
« Reply #2 on: 25 Jan '18 - 07:11 »
how about "if there's a way to know the size of the downloaded", as if i want to implement a small gray area inside my seeker, that shows how much data has been downloaded, like in youtube slider for example.

and i don't know about about formats but it's audio portion of youtube video direct links from "youtube-dl", here's all the info i got about it:
||||||||||||||||||||||||||||||||||||||||
Audio
ID                          : 2
Format                      : AAC
Format/Info                 : Advanced Audio Codec
Format profile              : LC
Codec ID                    : mp4a-40-2
Duration                    : 36 min 20 s
Bit rate mode               : Variable
Bit rate                    : 96.0 kb/s
Maximum bit rate            : 104 kb/s
Channel(s)                  : 2 channels
Channel positions           : Front: L R
Sampling rate               : 44.1 kHz
Frame rate                  : 43.066 FPS (1024 SPF)
Compression mode            : Lossy
||||||||||||||||||||||||||||||||||||||||
and im using Bass.net and bass at the latest versions.

MHSS

  • Guest
Re: seeking in stream from BASS_StreamCreateURL
« Reply #3 on: 25 Jan '18 - 07:40 »
update: i separately downloaded the file and it's an mp4 video/audio, but i tested the same URL on xmplay and it handles perfectly and is seekable, even to points where haven't been downloaded yet.
i tried using both AAC and ALAC plugins, but im returned 0 value and an error BASS_ERROR_HANDLE

Ian @ un4seen

  • Administrator
  • Posts: 21017
Re: seeking in stream from BASS_StreamCreateURL
« Reply #4 on: 25 Jan '18 - 17:45 »
how about "if there's a way to know the size of the downloaded", as if i want to implement a small gray area inside my seeker, that shows how much data has been downloaded, like in youtube slider for example.

Yes, that is available from BASS_StreamGetFilePosition with BASS_FILEPOS_DOWNLOAD. The BASS_FILEPOS_START position should be added to it.

and i don't know about about formats but it's audio portion of youtube video direct links from "youtube-dl", here's all the info i got about it:

If it's from Youtube, then it's probably AAC in an MPEG-DASH file. MPEG-DASH isn't supported by the BASS_AAC add-on but is supported via Media Foundation on Windows 8.1 and above. Seeking in an internet stream may well be a bit less well behaved (eg. playback stopping for an unavailable position) when Media Foundation is used. I'll look into that.

update: i separately downloaded the file and it's an mp4 video/audio, but i tested the same URL on xmplay and it handles perfectly and is seekable, even to points where haven't been downloaded yet.

The latest (3.8.3) XMPlay release added support for seeking to positions that have not been downloaded yet (it reconnects to the server), but that feature isn't in BASS yet. If all is well, it should be added in the next BASS version.

MHSS

  • Guest
Re: seeking in stream from BASS_StreamCreateURL
« Reply #5 on: 26 Jan '18 - 07:16 »
your help is very much appreciated Ian, I implemented BASS_StreamGetFilePosition to not allow the user to seek a position where it hasn't been downloaded yet and it seems to work good so far, this is the best quick workaround.