Author Topic: Error playing remote url  (Read 345 times)

carrygun

  • Posts: 3
Error playing remote url
« on: 8 Sep '18 - 13:34 »
Hello everyone!

I'm trying to play some url (which I cannot post here, but it is 100% valid, it can be played via browser as direct link and saved to disk without any problem), but I'm getting error "BASS_ERROR_FILEFORM" after "BASS_StreamCreateURL". If I download this file to disk I can play it via BASS without any problem (windows default player plays it too).
The link proto is "https" if it matters. File format m4a, audio codec is "mp4a.40.2" (but I'm not sure, info provided by remote server).

Simple example (C++):
Code: [Select]
    mBassChannel = BASS_StreamCreateURL(url.toLatin1().data(), 0, 0, nullptr, nullptr);
    int ec = BASS_ErrorGetCode(); // 41

Any ideas what I'm doing wrong?

_____________
Edit added example link: https://puu.sh/BrFjd.m4a
« Last Edit: 8 Sep '18 - 14:43 by carrygun »

Ian @ un4seen

  • Administrator
  • Posts: 21379
Re: Error playing remote url
« Reply #1 on: 10 Sep '18 - 14:20 »
I guess you are using Windows 10? The Media Foundation AAC/MP4 decoder is trying to seek to the end of that particular file, which BASS is rejecting to avoid pre-downloading the entire file. By default, BASS_StreamCreateURL will only allow seeks up to 1MB ahead of the current download position. If you don't mind longer seeks (and so potentially longer BASS_StreamCreateURL calls), that can be raised via the BASS_CONFIG_NET_SEEK option. For example, this will allow seeking from start to end of that file (which is 9.5MB):

Code: [Select]
BASS_SetConfig(BASS_CONFIG_NET_SEEK, 10000000);

carrygun

  • Posts: 3
Re: Error playing remote url
« Reply #2 on: 10 Sep '18 - 22:36 »
Thanks, this really helps me! Also missing this option in docs.
Another question, in case of such files and big seek offset "DOWNLOADPROC *proc" work a bit weird. Is it intended? I got only 3 callbacks of this func, and only 2nd was more than zero bytes, but bytes count was "9531304".

Ian @ un4seen

  • Administrator
  • Posts: 21379
Re: Error playing remote url
« Reply #3 on: 11 Sep '18 - 13:46 »
Yes, that is normal when the entire file has been pre-downloaded during stream creation, as in the case of the MP4 file that you posted. The 1st DOWNLOADPROC call (with length=0) has the HTTP response headers, the 2nd call has the file contents, and the 3rd call (with length=0 and buffer=0) signals the end of file.

carrygun

  • Posts: 3
Re: Error playing remote url
« Reply #4 on: 12 Sep '18 - 19:10 »
Got it, thanks for reply!