Author Topic: BASS for Android  (Read 392208 times)

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for Android
« Reply #1300 on: 28 Jul '17 - 16:15 »
I have sent it again in reply to your email. If you still don't receive it, do you have another email address that we can try? You can PM it to me.

ekstro

  • Posts: 7
Re: BASS for Android
« Reply #1301 on: 28 Jul '17 - 17:53 »
Thanks. We just made the files and send it back to you.

Golden Eagle

  • Posts: 10
Re: BASS for Android
« Reply #1302 on: 13 Aug '17 - 22:58 »
Modified: IMPORTANT!!!  This issue is actual only with mp3-free libraries, with standard version of BASS works as a charm!  :)

I found small issue with MP3-FREE only (the code is uploaded to incoming). I've started testing of the latest version with MP3-FREE on Android emulator, so let's see simple code:

new Thread(new Runnable() {
            @Override
            public void run() {
                BASS.BASS_StreamFree(chan);
                BASS.BASS_Stop();
                BASS.BASS_Free();

                String url = "http://de-hz-fal-stream02.rautemusik.fm/lounge";

                BASS.BASS_Init(-1, 44100, 0);
                BASS.BASS_SetConfig(BASS.BASS_CONFIG_NET_PLAYLIST, 1);
                chan = BASS.BASS_StreamCreateURL(url, 0, BASS.BASS_STREAM_BLOCK | BASS.BASS_STREAM_AUTOFREE, null, 0); // open URL
                BASS.BASS_ChannelPlay(chan, false);
            }

        }).start();

Well, this code working on first start, however I see reproducible issue on Android Emulator:
1. Run thread to play stream.
2. Stop network in any way: a. Emulator->...->Cellular->Network Type (GSM)) or b. with SoftPerfect  Bandwith Manager, or c. Disable Network Adapter on Host computer
3. Run thread again  (it does not play) (the issue is reproducible in one or few iterations)

In this case BASS_SYNC_DOWNLOAD and BASS_SYNC_END does not work too.

I've tested on standard emulator with Android API 16 and API26.
« Last Edit: 14 Aug '17 - 11:32 by Golden Eagle »

Golden Eagle

  • Posts: 10
Re: BASS for Android
« Reply #1303 on: 14 Aug '17 - 13:40 »
I found one more strange issue. Well, if I try to run the code above with standard mp3 libraries on clean Android 6 (API 23, x86) on Emulator, I do not have sound at all, I see the next logs in monitor:
08-14 12:33:08.383 5892-10542/com.un4seen.bass.test I/ServiceManager: Waiting for service media.audio_flinger...
08-14 12:33:14.476 5892-6543/com.un4seen.bass.test W/AudioSystem: AudioFlinger server died!
08-14 12:33:14.476 5892-5927/com.un4seen.bass.test W/AudioSystem: AudioPolicyService server died!
08-14 12:33:14.477 5892-10658/com.un4seen.bass.test W/AudioTrack: dead IAudioTrack, PCM, creating a new one from obtainBuffer()

On all others versions seems OK, I try to do more tests.





Golden Eagle

  • Posts: 10
Re: BASS for Android
« Reply #1304 on: 14 Aug '17 - 13:52 »
And the last issue I found, for API from 16 up to 23 included, on the API 26 all is OK. Full description of the issue:

When I add station (from example to BASS.NET)  http://www.sky.fm/mp3/the80s.pls and start playing it generates "HTTP/ 1.1 301 Moved Permanently" and the app stops immediately, on Android 8 (API 26) all works as a charm and shows Error Code 10 via Error method from example code, standard try/catch does not help me in this case...



Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for Android
« Reply #1305 on: 14 Aug '17 - 18:01 »
Are you only having the problem(s) with MP3 streams, not local MP3 files? If so, are OGG streams also affected? You can find some OGG streams to test with here: http://dir.xiph.org/

Golden Eagle

  • Posts: 10
Re: BASS for Android
« Reply #1306 on: 14 Aug '17 - 18:54 »
Ian, thank you very much - you made great product! I did not test with OGG, only with MP3 and AAC with mp3-free, today I tried to change to your realization of MP3 - works perfectly with MP3 and AAC without your AAC plugin (only HTTP 301 small issue). Also I tested with Android 6 (API23) on ARM image on emulator - works OK, probably some problems in the latest version of emulator, unfortunately I do not have phone with Android 6 to test now. Overall, it's the best sound library on the market  :)

Golden Eagle

  • Posts: 10
Re: BASS for Android
« Reply #1307 on: 14 Aug '17 - 22:09 »
New Update to my previous post:
Quote
  found one more strange issue. Well, if I try to run the code above with standard mp3 libraries on clean Android 6 (API 23, x86) on Emulator, I do not have sound at all, I see the next logs in monitor:
08-14 12:33:08.383 5892-10542/com.un4seen.bass.test I/ServiceManager: Waiting for service media.audio_flinger...
08-14 12:33:14.476 5892-6543/com.un4seen.bass.test W/AudioSystem: AudioFlinger server died!
08-14 12:33:14.476 5892-5927/com.un4seen.bass.test W/AudioSystem: AudioPolicyService server died!
08-14 12:33:14.477 5892-10658/com.un4seen.bass.test W/AudioTrack: dead IAudioTrack, PCM, creating a new one from obtainBuffer()

I run latest emulator with Android 6.0 API 23 x86 and run previous code
Code: [Select]
new Thread(new Runnable() {
            @Override
            public void run() {
                BASS.BASS_StreamFree(chan);
                BASS.BASS_Stop();
                BASS.BASS_Free();

                String url = "http://de-hz-fal-stream02.rautemusik.fm/lounge";

                BASS.BASS_Init(-1, 44100, 0);
                BASS.BASS_SetConfig(BASS.BASS_CONFIG_NET_PLAYLIST, 1);
                chan = BASS.BASS_StreamCreateURL(url, 0, BASS.BASS_STREAM_BLOCK | BASS.BASS_STREAM_AUTOFREE, null, 0); // open URL
                BASS.BASS_ChannelPlay(chan, false);
            }

        }).start();

result - no sound, error log - above...

Then I made simple code with MediaPlayer and run on the same emulator with Android 6.0 (API 23 x86):

Code: [Select]
        mMediaPlayer = new MediaPlayer();
        mMediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
            @Override
            public void onPrepared(MediaPlayer mediaPlayer) {
                mMediaPlayer.start();
            }
        });
        try {
            String url = "http://de-hz-fal-stream02.rautemusik.fm/lounge";
            mMediaPlayer.setDataSource(url);
            mMediaPlayer.prepareAsync();
        } catch (Exception e) {
            Log.e(TAG, e.toString());
        }

result - All is OK

So that, situation is reproducible on Emulator... but I have not enough experience to understand - can potential users listen to the radio on devices under Android 6.0? I'm newbie in audio programing yet.

I also tested BASS library on API (16, 19, 24, 25, 26 x86, 23-arm) all is OK! (API 17-18, 20-22 skipped, I will test them later), (API 23 x86 no sound)
« Last Edit: 14 Aug '17 - 22:26 by Golden Eagle »

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for Android
« Reply #1308 on: 15 Aug '17 - 17:16 »
And the last issue I found, for API from 16 up to 23 included, on the API 26 all is OK. Full description of the issue:

When I add station (from example to BASS.NET)  http://www.sky.fm/mp3/the80s.pls and start playing it generates "HTTP/ 1.1 301 Moved Permanently" and the app stops immediately, on Android 8 (API 26) all works as a charm and shows Error Code 10 via Error method from example code, standard try/catch does not help me in this case...

This problem appears to be happening in Android's playlist processing. Here's an update that should prevent Android processing playlists (BASS can do that itself when BASS_CONFIG_NET_PLAYLIST is enabled).

   www.un4seen.com/stuff/bass-android-test.zip

Let me know if you still get the problem. Note that stream is currently dead, so you still won't hear anything (BASS_StreamCreateURL will fail), but it shouldn't cause a crash now!

New Update to my previous post:
Quote
  found one more strange issue. Well, if I try to run the code above with standard mp3 libraries on clean Android 6 (API 23, x86) on Emulator, I do not have sound at all, I see the next logs in monitor:
08-14 12:33:08.383 5892-10542/com.un4seen.bass.test I/ServiceManager: Waiting for service media.audio_flinger...
08-14 12:33:14.476 5892-6543/com.un4seen.bass.test W/AudioSystem: AudioFlinger server died!
08-14 12:33:14.476 5892-5927/com.un4seen.bass.test W/AudioSystem: AudioPolicyService server died!
08-14 12:33:14.477 5892-10658/com.un4seen.bass.test W/AudioTrack: dead IAudioTrack, PCM, creating a new one from obtainBuffer()

I run latest emulator with Android 6.0 API 23 x86 and run previous code
Code: [Select]
new Thread(new Runnable() {
            @Override
            public void run() {
                BASS.BASS_StreamFree(chan);
                BASS.BASS_Stop();
                BASS.BASS_Free();

                String url = "http://de-hz-fal-stream02.rautemusik.fm/lounge";

                BASS.BASS_Init(-1, 44100, 0);
                BASS.BASS_SetConfig(BASS.BASS_CONFIG_NET_PLAYLIST, 1);
                chan = BASS.BASS_StreamCreateURL(url, 0, BASS.BASS_STREAM_BLOCK | BASS.BASS_STREAM_AUTOFREE, null, 0); // open URL
                BASS.BASS_ChannelPlay(chan, false);
            }

        }).start();

result - no sound, error log - above...

Is the BASS_StreamCreateURL call successful, ie. is "chan" not 0? And are you only having the problem with that specific URL or all MP3 stream URLs? Please also confirm that the problem is only happening with the "mp3-free" BASS version?

I tried playing your test URL on an Android 6.0 (API 23) device with the "mp3-free" BASS version and the NETRADIO example (included in the BASS package), and it worked fine. I haven't tried it on an emulator yet.

Golden Eagle

  • Posts: 10
Re: BASS for Android
« Reply #1309 on: 15 Aug '17 - 19:35 »
Hello, Ian! Thank you very much for the help! I started learning of BASS library a few weeks ago and I'm on first stage of creation of prototype - BASS is really nice!!!  With BASS_StreamCreateURL all is OK chan = -2147483647... the error happens on play, with your realization of mp3, buffering and meta are OK, with mp3-free error log is bigger (I've added it as attachment). This happens only on Android 6 (API 23) on standard emulator with all latest updates from stable branch. When I found the issues, I say you about...  but nuance is the next: on ARM image of Android 6 it works (a bit slowly without HAXM), but on x86 and x64 it does not, with mp3-free, app stops working at all... with your mp3 it looks like playing but without sound, interesting detail, that only on 23 API... ???

Now playlist processing works fine, as a charm, it's Excellent! With previous version library BASS_CONFIG_NET_PLAYLIST =1 and 0 had the same effect.  :)

Thank you ever so much!
« Last Edit: 15 Aug '17 - 19:58 by Golden Eagle »

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for Android
« Reply #1310 on: 16 Aug '17 - 15:49 »
Thanks for the log. It looks like the OS's MP3 codec is failing and BASS isn't catching the exception. Here's an update ("mp3-free" version) that will hopefully catch it:

   www.un4seen.com/stuff/bass-android-test.zip

Let me know if you still get the crash with that, and if you do, please post the new log. Also confirm whether it is only happening with the URL that you posted, or if it happens with all MP3 streams and files?

Golden Eagle

  • Posts: 10
Re: BASS for Android
« Reply #1311 on: 16 Aug '17 - 18:48 »
Well, made new tests. On emulator API 23 stable, plays without sound, same as your mp3 realization (log_1 inside archive) with all MP3 streams (I did not test files)... then I tested on API 26 - sound OK, but when I stop network on Host PC via SoftPerfect BandwithManager while playing, then it does not play again after manual button press (previous example from my posts) (log_2), your own MP3 realization does not have the issue.

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for Android
« Reply #1312 on: 17 Aug '17 - 15:52 »
If I understand correctly, you are not hearing any sound when playing any MP3 stream on that Android 6.0 emulator with the standard BASS version and the "mp3-free" version? What do you see if you monitor (eg. in a timer) what BASS_ChannelIsActive and BASS_ChannelGetPosition say about it, ie. do they indicate the stream is playing? You could also try playing some OGG streams from the link I posted above, to confirm that it isn't just an MP3 issue.

Are you getting sound from other apps on the same emulator? You could try VLC, which includes the option of using "OpenSL ES" or "AudioTrack" audio output (try both options).

Golden Eagle

  • Posts: 10
Re: BASS for Android
« Reply #1313 on: 19 Aug '17 - 15:54 »
Well, I will do more tests, it's possible to play mp3 stream from browser. OGG plays without sound too (http://ai-radio.org/320.ogg.m3u), for that channel BASS_ChannelIsActive and BASS_ChannelGetPosition are OK (logs below):
Quote
08-19 19:13:21.489 6466-6466/BASS_CHAN_IS_ACTIVE: 1
08-19 19:15:10.878 6788-6788/BASS_CHAN_GET_POS: 3584
08-19 19:15:11.879 6788-6788/BASS_CHAN_GET_POS: 14336
08-19 19:15:12.880 6788-6788/BASS_CHAN_GET_POS: 21504

Unfortunately I can not test VLC and other apps on emulator, because I can not see Play Store app in the emulator, maybe somebody find the simple way to test OpenSL ES on Emulator with Android 6.0.
« Last Edit: 19 Aug '17 - 20:21 by Golden Eagle »

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for Android
« Reply #1314 on: 21 Aug '17 - 17:05 »
That seems to confirm that it is a general output issue with the emulator, rather than an MP3 issue. Your log shows that the playback position is advancing, so it looks like data is being sent to the output and it's just not being heard for some reason.

You can get the VLC APK package directly from here instead of the Play Store:

   https://get.videolan.org/vlc-android/2.0.6/

You can then copy the APK file to the emulator and install it.

Golden Eagle

  • Posts: 10
Re: BASS for Android
« Reply #1315 on: 22 Aug '17 - 09:10 »
Hello Ian! I've installed the latest VLC by your link, it's playing stream - sound is OK, but our example does not! Buffering is alive, stream too, so it's probably output issue... but I am not sure is the issue actual for real devices...
« Last Edit: 23 Aug '17 - 09:03 by Golden Eagle »

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for Android
« Reply #1316 on: 23 Aug '17 - 17:16 »
Is VLC playback still working when its "Audio output" option is set to "OpenSL ES"? The default is "AudioTrack".

Just to make sure the problem isn't caused by something that you're doing, here's a compiled version of the NETRADIO example (modified to show the playback time) for you to try:

   www.un4seen.com/stuff/netradio.apk

Can you hear anything with that, and if not, is the playback time advancing as normal?

Golden Eagle

  • Posts: 10
Re: BASS for Android
« Reply #1317 on: 23 Aug '17 - 21:38 »
Ian, thanks for advise how to test OpenVLC! ;) I found this option in Advanced menu, so VLС plays in default AudioTrack and does not play in OpenSL ES mode, so does netradio.apk because it's in OpenSL ES mode too! So the issue is with audio output. As I understand OpenSL ES is device independent low level api, so it's the best choice for playing... Near work, but interesting, especially learning handlers an loopers under Android! :) I can say, I really like BASS and your talent in intuitive organization of library structure! Of course, license fee from me, if I will have enough time to release my idea to get experience! ;)

« Last Edit: 26 Aug '17 - 16:55 by Golden Eagle »

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for Android
« Reply #1318 on: 28 Aug '17 - 17:42 »
The Android version of the new BASSFLAC 2.4.4 release is up in the 1st post. The BASS update posted above (16 Aug) is also up in the main package now.

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for Android
« Reply #1319 on: 30 Aug '17 - 17:56 »
The Android version of the new BASSmix 2.4.9 release is up in the 1st post.

bracken

  • Posts: 9
Re: BASS for Android
« Reply #1320 on: 17 Sep '17 - 06:31 »
Any plans to support mqa audio?

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for Android
« Reply #1321 on: 18 Sep '17 - 18:09 »
Not currently.

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for Android
« Reply #1322 on: 3 Oct '17 - 17:59 »
The Android version of the BASSHLS add-on is now included in the 1st post.

otherside

  • Posts: 24
Re: BASS for Android
« Reply #1323 on: 18 Oct '17 - 09:36 »
It would be great to provide arm64-v8a versions of libs (it seems easy to do). Since new phones like samsung galaxy s6 use it.

Here's text found on facebook's fresco page:

Quote
armeabiv-v7a: Version 7 or higher of the ARM processor. Most Android phones released from 2011-15 are using this.
arm64-v8a: 64-bit ARM processors. Found on new devices, like the Samsung Galaxy S6.
armeabi: Older phones using v5 or v6 of the ARM processor.
x86: Mostly used by tablets, and by emulators.
x86_64: Used by 64-bit tablets.

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for Android
« Reply #1324 on: 18 Oct '17 - 18:10 »
armeabi-v7a libraries should work fine on arm64-v8a devices, but if you would like to try arm64-v8a, the BASS and BASSmix libraries are currently available for that:

   www.un4seen.com/stuff/bass24-android-arm64.zip

Other add-ons will probably follow if the demand arises.