Author Topic: Using BASS with Firemonkey on Windows and Android  (Read 56 times)

MPage

  • Posts: 1
Hello all,

I have used the sample 'FMX.Radio' to write an application which suits my needs.  ;)
I use Delphi 10.2.2 (but also tested 10.3).

I want to use this player on Windows and on Android.
On Windows I can play (stream) a single file form a server like this:
http://server.com/Audio/myfile.mp3
as also "usual" internet radio streams like:
http://streams.ffh.de/ffhchannels/aac/hq80er.m3u

The call to create the stream is:
  FActiveChannel := BASS_StreamCreateURL(PChar(FStreamURL), 0, 0, nil, nil);

On Windows everything works fine. I always get the stream (FActiveChannel), no matter if I call the routine like above or with all or one of the options (BASS_STREAM_BLOCK, BASS_STREAM_STATUS, BASS_STREAM_AUTOFREE, BASS_UNICODE).

On Android I ONLY get a stream for internet radio stations.
If I want to play a file from a remote server like this:
http://server.com/Audio/myfile.mp3
I don't get a stream, no matter how I call the routine to create the channel. I tried this:
  FActiveChannel := BASS_StreamCreateURL(PChar(FStreamURL), 0, 0, nil, nil);

, but also with all of the available options. On Android the result  of BASS_ErrorGetCode is almost always 2, except for the case when I use BASS_STREAM_BLOCK as a parameter. In this case the result  of BASS_ErrorGetCode is 20:'(
The strangest thing is, that I also sometimes get a result of BASS_ErrorGetCode of 0, but the FActiveChannel is also 0. ???


Of course, the value for FStreamURL is a valid URL (like the examples above), and as I wrote above, it works fine on Windows, but not at all on Android. If I place the value of FStreamURL in a the URL field of my browser, the file is also played.

Unfortunately I actually just have the need to play "single" files from a remote server (my own webserver) instead of "regular internet radio stations".


Does anybody know how to fix this?

Thanks in advance!

Attached you can find the test application.  :)
IMPORTANT: The folder "Library" in the application's directory doesn't contain the Android lib files, because with them the file would have been too large for the upload! You have to copy the Android lib files into the according directories, otherwise you will get errors and the application won't run on Android anyway.