Author Topic: BASS for Android  (Read 422019 times)

Ian @ un4seen

  • Administrator
  • Posts: 21016
Re: BASS for Android
« Reply #1400 on: 17 May '18 - 15:17 »
arm64-v8a architecture libraries have now been added to the BASS and add-on packages in the 1st post. The BASS_SSL add-on has also been updated to OpenSSL 1.0.2o.

gicci

  • Posts: 48
Re: BASS for Android
« Reply #1401 on: 3 Jun '18 - 00:29 »
Hi Ian,
I have added to my app they work perfectly. Will you provide also x86_64?
Thank you!

Ian @ un4seen

  • Administrator
  • Posts: 21016
Re: BASS for Android
« Reply #1402 on: 4 Jun '18 - 13:40 »
There are no immediate plans for that. Are you interested in it for running under the emulator? If so, can you not use the existing x86 architecture for that instead?

otherside

  • Posts: 34
Re: BASS for Android
« Reply #1403 on: 5 Jun '18 - 03:30 »
arm64-v8a architecture libraries have now been added to the BASS and add-on packages in the 1st post. The BASS_SSL add-on has also been updated to OpenSSL 1.0.2o.

Hello. I added arm64-v8a libraries + updated existing. And BASS stopped to open https links.
Then I removed arm64-v8a libs and it started to work again.

Ian @ un4seen

  • Administrator
  • Posts: 21016
Re: BASS for Android
« Reply #1404 on: 5 Jun '18 - 14:52 »
Are you using the BASS_SSL add-on? If not, does adding it fix the problem, or vice versa? Please also confirm the Android version.

otherside

  • Posts: 34
Re: BASS for Android
« Reply #1405 on: 5 Jun '18 - 21:19 »
Are you using the BASS_SSL add-on? If not, does adding it fix the problem, or vice versa? Please also confirm the Android version.
Android 8.0, device samsung s9+

If I use BASS_SSL - error code is 2
If I don't use it - error code is 10
« Last Edit: 5 Jun '18 - 21:45 by otherside »

Ian @ un4seen

  • Administrator
  • Posts: 21016
Re: BASS for Android
« Reply #1406 on: 6 Jun '18 - 13:27 »
I think I see what the problem could be. Here's an arm64-v8a BASS_SSL update for you to try:

   www.un4seen.com/stuff/libbass_ssl.so

otherside

  • Posts: 34
Re: BASS for Android
« Reply #1407 on: 8 Jun '18 - 05:07 »
Thank you. It works now.

Ian @ un4seen

  • Administrator
  • Posts: 21016
Re: BASS for Android
« Reply #1408 on: 8 Jun '18 - 13:13 »
Great. The update is now up in the BASS_SSL package in the 1st post.

gicci

  • Posts: 48
Re: BASS for Android
« Reply #1409 on: 9 Jun '18 - 17:01 »
There are no immediate plans for that. Are you interested in it for running under the emulator? If so, can you not use the existing x86 architecture for that instead?
I am not sure if Google will prevent at all releasing apps with only 32 bit code, and I am currently packaging the x86 libraries as well in the release. Users with x86 devices will be only a small % of the total and I could remove the x86 libraries from the release, but I will try go get better statistics to let you know. 

EDIT: I got 1000 samples which seems enough to get some statistics. 2.3% of my users have native x86 devices, all of them with arm emulation.
« Last Edit: 17 Jun '18 - 00:47 by gicci »

Alex7wrt

  • Posts: 3
Re: BASS for Android
« Reply #1410 on: 5 Jul '18 - 21:23 »
Hello, Ian
First of all, great thanks to You for Your Bass library.  I've made the local network radio project with Bass and it works ))

I have some issues with online stream encoding and I hope for Your help. I want to use Opus encoding to decrease the bitrate of streaming audio.
There is the following code of recording voice and streaming it via UDP protocol in local network:

chanMic:=BASS_RecordStart(freq, 1, 0, nil, nil);
volfx:=BASS_ChannelSetFX(chanMic, BASS_FX_BFX_VOLUME, 0);
param.lChannel:=0;
param.fVolume:=VolLoad;
BASS_FXSetParameters(volfx, @param);
.....
avail:=BASS_ChannelGetData(chanMic, nil, BASS_DATA_AVAILABLE);
 if avail>=bufs then begin
     BASS_ChannelGetData(chanMic, buffer, bufs);
     UDP_Rec.Broadcast(buffer,UDP_RecPort);
 end;

But this code broadcasts uncompressed PCM audio, witch has great bitrate.
So I'm wondering how to add Opus encoding to this code to send a definite number of encoded bytes through UDP?
Thank You for Your answer

Best regards,
Alexander

Ian @ un4seen

  • Administrator
  • Posts: 21016
Re: BASS for Android
« Reply #1411 on: 6 Jul '18 - 13:27 »
You could try the BASSenc_OPUS add-on's BASS_Encode_OPUS_Start function, which allows you to receive Opus encoded data via a callback function. In that case, you would probably want to remove the BASS_ChannelGetData call and instead provide a RECORDPROC callback function (that just returns TRUE) in the BASS_RecordStart call.

Alex7wrt

  • Posts: 3
Re: BASS for Android
« Reply #1412 on: 6 Jul '18 - 19:11 »
Thanks a lot!
I will try it.

mcooper

  • Posts: 42
Re: BASS for Android
« Reply #1413 on: 11 Jul '18 - 14:57 »
Hello,

I'm trying to debug an issue with some mp3 streams that return BASS_ERROR_FILEOPEN error when calling BASS_StreamCreateURL on Android.  The same streams work fine on iOS.  The urls are time limited so I can't post a sample one here. I've copied one of the mp3 files to a different server and it works fine from there, so seems to be something related to the uri itself or the http response. The uris are very long (> 500 chars).

To debug further, I wanted to use a proxy server to examine the http request and response to compare the working and failing ones, but when using ssl, the proxy server seems to be ignored (on both ios and android). I can see http requests, but not https.  I can see other https requests, just not ones made from bass. Is this a known issue?

I've made the requests directly (without using bass) and can see the following response headers in the failure case:

Accept-Ranges: bytes
Connection: keep-alive
Content-Length: 8955080
Content-Type: audio/mpeg
Date: Wed, 11 Jul 2018 13:45:25 GMT
ETag: "6e9ddd5e0f27e38f081a33b0c1b47ca9"
Last-Modified: Tue, 24 Nov 2015 17:51:33 GMT

and in the successful response:

Content-Disposition: iinline;filename="beast-of-burden-320.mp3";filename*=UTF-8''beast-of-burden-320.mp3
Content-Type: audio/mp3

Could any of those different headers cause an issue? Any other suggestions for investigating further?

Thank you,

Matt

Ian @ un4seen

  • Administrator
  • Posts: 21016
Re: BASS for Android
« Reply #1414 on: 11 Jul '18 - 17:35 »
Are the troublesome URLs all HTTPS? If so, are you using the BASS_SSL add-on? If you aren't, please try that (it's in the 1st post) and see if the problem still happens then.

You can also use the BASS_STREAM_STATUS flag in your BASS_StreamCreateURL call (along with a DOWNLOADPROC callback function) to receive the HTTP response headers even if the stream creation fails. The NETRADIO example included in the BASS package has a demonstration of doing this (it displays the HTTP status code).

mcooper

  • Posts: 42
Re: BASS for Android
« Reply #1415 on: 12 Jul '18 - 12:28 »
Are the troublesome URLs all HTTPS? If so, are you using the BASS_SSL add-on? If you aren't, please try that (it's in the 1st post) and see if the problem still happens then.

You can also use the BASS_STREAM_STATUS flag in your BASS_StreamCreateURL call (along with a DOWNLOADPROC callback function) to receive the HTTP response headers even if the stream creation fails. The NETRADIO example included in the BASS package has a demonstration of doing this (it displays the HTTP status code).

Hello Ian,

Yes, the troublesome urls are all https (but some https urls do work).  I added the bass_sll add-on to the netradio example and it was able to play them.  The http headers in the downloadproc is also helpful for debugging.

I can't get them to work in my Xamarin app though. Some https urls work, and I can log all the http headers with the downloadproc, but these time-limited urls just seem to immediately return BASS_ERROR_FILEOPEN and donwloadproc isn't called.

I'm also seeing a related message when the Xamarin app loads:
[linker] library "libssl.so" ("/system/lib/libssl.so") needed or dlopened by "/data/app/com.audiogum.PlayerTest_Droid-1/lib/arm/libbass.so" is not accessible for the namespace "classloader-namespace" - the access is temporarily granted as a workaround for http://b/26394120, note that the access will be removed in future releases of Android.

This doesn't prevent all https urls though, but it look like its something I'll need to fix anyway, so I'll investigate that.

Ian @ un4seen

  • Administrator
  • Posts: 21016
Re: BASS for Android
« Reply #1416 on: 12 Jul '18 - 15:17 »
I'm also seeing a related message when the Xamarin app loads:
[linker] library "libssl.so" ("/system/lib/libssl.so") needed or dlopened by "/data/app/com.audiogum.PlayerTest_Droid-1/lib/arm/libbass.so" is not accessible for the namespace "classloader-namespace" - the access is temporarily granted as a workaround for http://b/26394120, note that the access will be removed in future releases of Android.

That looks like the BASS_SSL add-on wasn't included in the app, as BASS will try to load that first before falling back to LIBSSL. If you open the app's APK file in ZIP software, do you see the LIBBASS_SSL.SO files alongside the LIBBASS.SO files in there?

mcooper

  • Posts: 42
Re: BASS for Android
« Reply #1417 on: 13 Jul '18 - 11:18 »
I'm also seeing a related message when the Xamarin app loads:
[linker] library "libssl.so" ("/system/lib/libssl.so") needed or dlopened by "/data/app/com.audiogum.PlayerTest_Droid-1/lib/arm/libbass.so" is not accessible for the namespace "classloader-namespace" - the access is temporarily granted as a workaround for http://b/26394120, note that the access will be removed in future releases of Android.

That looks like the BASS_SSL add-on wasn't included in the app, as BASS will try to load that first before falling back to LIBSSL. If you open the app's APK file in ZIP software, do you see the LIBBASS_SSL.SO files alongside the LIBBASS.SO files in there?

Helli Ian,

You're right - the libbass_ssl.so was missing from the apk.  I cleaned and rebuilt a few times and then it showed up.  That got rid of the linker message about libssl.so, but it hasn't fixed my issue. The track still doesn't play and the downloadproc isn't called.

I've tried to modify my xamarin app to match your netradio sample but still can't see why it works there but not in my app.

teq

  • Posts: 6
Re: BASS for Android
« Reply #1418 on: 13 Jul '18 - 14:22 »
Hi!
I call
Code: [Select]
netStream = Bass.BASS_StreamCreateURL(filename, 0,
                                                      BASSFlag.BASS_STREAM_DECODE, null, IntPtr.Zero);
and then
Code: [Select]
streamTempoFX = BassFx.BASS_FX_TempoCreate(netStream, BASSFlag.BASS_FX_FREESOURCE);
Bass.BASS_ChannelPlay(streamTempoFX, false);
On Windows it works fine, but on Android i got bass error fileopen. With BASS_StreamCreateFile and BASS_FX_TempoCreate it's ok on Android.

Ian @ un4seen

  • Administrator
  • Posts: 21016
Re: BASS for Android
« Reply #1419 on: 13 Jul '18 - 15:49 »
I've tried to modify my xamarin app to match your netradio sample but still can't see why it works there but not in my app.

It seems strange that it would work in the NETRADIO example but not your app. Are you definitely using the same BASS library version in both?

I call
Code: [Select]
netStream = Bass.BASS_StreamCreateURL(filename, 0,
                                                      BASSFlag.BASS_STREAM_DECODE, null, IntPtr.Zero);
and then
Code: [Select]
streamTempoFX = BassFx.BASS_FX_TempoCreate(netStream, BASSFlag.BASS_FX_FREESOURCE);
Bass.BASS_ChannelPlay(streamTempoFX, false);
On Windows it works fine, but on Android i got bass error fileopen. With BASS_StreamCreateFile and BASS_FX_TempoCreate it's ok on Android.

Are you having the problem with HTTP URLs or only HTTPS? If only HTTPS, you could try adding the BASS_SSL add-on (available in the 1st post) to your app.

teq

  • Posts: 6
Re: BASS for Android
« Reply #1420 on: 13 Jul '18 - 20:33 »
I've tried to modify my xamarin app to match your netradio sample but still can't see why it works there but not in my app.

It seems strange that it would work in the NETRADIO example but not your app. Are you definitely using the same BASS library version in both?

I call
Code: [Select]
netStream = Bass.BASS_StreamCreateURL(filename, 0,
                                                      BASSFlag.BASS_STREAM_DECODE, null, IntPtr.Zero);
and then
Code: [Select]
streamTempoFX = BassFx.BASS_FX_TempoCreate(netStream, BASSFlag.BASS_FX_FREESOURCE);
Bass.BASS_ChannelPlay(streamTempoFX, false);
On Windows it works fine, but on Android i got bass error fileopen. With BASS_StreamCreateFile and BASS_FX_TempoCreate it's ok on Android.

Are you having the problem with HTTP URLs or only HTTPS? If only HTTPS, you could try adding the BASS_SSL add-on (available in the 1st post) to your app.
I use only HTTP. I found solution, it'needs to call Uri.EscapeUriString instead just new Uri
« Last Edit: 13 Jul '18 - 21:35 by teq »

Alex7wrt

  • Posts: 3
Re: BASS for Android
« Reply #1421 on: 14 Jul '18 - 20:16 »
Hello
I have some issues with playback of live stream audio.
Most of the time the playback is just fine, but there is some non-zero possibility of crashing the program about once - twice per hour of playback

I'm creating the stream in some place of the program:

        chanPlay:= BASS_StreamCreate(16000, 1, 0, STREAMPROC_PUSH, nil);
        BASS_ChannelPlay(chanPlay, true);

Then, I start to recieve the data through the UDP protocol and pushing it to the channel:

procedure UDPRead(AData: TIdBytes);
begin
        BASS_StreamPutData(chanPlay, AData,length(AData));
end;

As I said above, all is fine the most of time,  but the program can crash periodically. If there a way to avoid the crash? Maybe some flag in BASS_StreamPutData or BASS_ChanellPlay to miss the data that cann't be played. Some thing like try catch block to process exceptions?

The buffer size of UDP streaming is constant and usually equals 1024 bytes, but I tried also 512, 2048 and 1600 . No difference.

Thank You!


Ian @ un4seen

  • Administrator
  • Posts: 21016
Re: BASS for Android
« Reply #1422 on: 16 Jul '18 - 14:01 »
Please post the crash info from Logcat.

mcooper

  • Posts: 42
Re: BASS for Android
« Reply #1423 on: 17 Jul '18 - 09:36 »
I've tried to modify my xamarin app to match your netradio sample but still can't see why it works there but not in my app.

It seems strange that it would work in the NETRADIO example but not your app. Are you definitely using the same BASS library version in both?

No, I wasn't.  Not sure how that happened, but thank you for suggesting that.  It seems to be working fine in my app now.  All that was needed was libbass_ssl

Ian @ un4seen

  • Administrator
  • Posts: 21016
Re: BASS for Android
« Reply #1424 on: 17 Jul '18 - 14:15 »
The Android version of the new BASSenc, BASSenc_FLAC and BASSenc_MP3 releases are up now in the 1st post.