Author Topic: BASS for iOS (iPhone/iPad)  (Read 458906 times)

piyatat

  • Posts: 1
Re: BASS for iOS (iPhone/iPad)
« Reply #1125 on: 4 Mar '16 - 04:40 »
Hi Ian,

I have a strange issue with the streaming.
On some (public) wifi network, iOS cannot play the streaming with BASS_ERROR_TIMEOUT error.
(while the Android version can play the same stream without problem)

I have to increase BASS_CONFIG_NET_TIMEOUT to about 5 mins for the streaming to work on iOS. (it took about 2 mins for the stream for connecting)


Is this related to iOS 8/9 SDK ? since the build with early version of iOS doesn't have this issue on the same wifi network.
Is there anything else I can set/config to resolve the issue ?

Thanks,
Piyatat

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for iOS (iPhone/iPad)
« Reply #1126 on: 4 Mar '16 - 14:13 »
That's strange. Where are you calling BASS_StreamCreateURL from? If you're calling it from a worker thread, does moving it to the main thread (or vice versa) make a difference? Also, is the problem happening with a particular URL or all URLs?

To confirm whether it's related to the iOS SDK version, does switching back to an older SDK stop the problem happening? If that doesn't stop the problem, then perhaps it's dependent on the iOS version that's running on the device? If so, which version(s) that you've tried are you having the problem with and which are you not?

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for iOS (iPhone/iPad)
« Reply #1127 on: 11 Mar '16 - 17:57 »
The iOS versions of the BASS 2.4.12 and BASSenc 2.4.13 releases are now up in the 1st post. Please note that BASS 2.4.12 slightly breaks back-compatibility in the BASS_CONFIG_NET_AGENT/PROXY options (BASS_SetConfigPtr now takes a copy of the provided string), so you should check how you're using those options, if you are.

Lemon

  • Guest
Re: BASS for iOS (iPhone/iPad)
« Reply #1128 on: 29 Mar '16 - 03:54 »
hello,Cocoapods:
```ruby
pod 'KSAudioPlayer'
```open my project and running issue Undefined symbols for architecture armv7:
  "_OBJC_CLASS_$_KSAudioPlayer", referenced from:
      objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for iOS (iPhone/iPad)
« Reply #1129 on: 29 Mar '16 - 16:27 »
That problem does not look like it is related to BASS. Perhaps your project is missing some other library or source file that provides "KSAudioPlayer"?

ZubyZub

  • Guest
Re: BASS for iOS (iPhone/iPad)
« Reply #1130 on: 11 Apr '16 - 01:09 »
Hi, any update with tvos bitcode enabled flag?

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for iOS (iPhone/iPad)
« Reply #1131 on: 11 Apr '16 - 17:16 »
A tvOS version with bitcode enabled is currently available to licensed iOS BASS users. If you (or anyone else) have an iOS licence and would like to have the tvOS version, please use the contact form (or send me an email/PM) to request it.

Oleg N

  • Posts: 86
Any success with latest libtags?
« Reply #1132 on: 27 Apr '16 - 18:03 »
Has anyone successfully built something on XCode using latest libtags from first post?

I am seeing _iconv linker errors despite -liconv linker flag and/or libiconv.dylib in frameworks. XCode 7. El Capitan. Both simulator and ARM.
Previous version links ok but works with problems.

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for iOS (iPhone/iPad)
« Reply #1133 on: 28 Apr '16 - 14:25 »
The iconv library is indeed required (to handle the codepage conversion stuff). With Xcode 7, you should add "libiconv.tbd" to your project in the "Link Binary With Library" section of the "Build Settings" page.

mbh

  • Posts: 5
Re: BASS for iOS (iPhone/iPad)
« Reply #1134 on: 26 Jun '16 - 22:46 »
Hi,

I'm using BASS for an iOS audio streaming app.

I have a little trouble with resuming audio after it has been interrupted by other apps.
Steps to reproduce:
- start audio in my app.
- launch another app and start audio playback (I use Safari with a Youtube video),
- My app receives an AVAudioSessionInterruptionNotification with type AVAudioSessionInterruptionTypeBegan, and audio is paused as it should be.
- Stop audio in the other app - for Safari I force quit it (Safari seems to hold on to it's audio session forever).
- My app receives an AVAudioSessionInterruptionNotification with type AVAudioSessionInterruptionTypeEnded, and audio is supposed to be restarted.
  If I bring my app to the foreground when force-quitting Safari, things work perfectly.
  If I let my app stay in the background, it still gets the AVAudioSessionInterruptionTypeEnded, but in the log I can observe this line:
  "ERROR:    [Main thread] 1233: AUIOClient_StartIO failed (560557684)"

The "AUIOClient_StartIO failed (560557684)" seems to come when I am calling BASS_Start() as a result of the interruption when the app is in the background.
560557684 corresponds to AVAudioSessionErrorCodeCannotInterruptOthers.

Supposedly there is no other audio sessions, since I killed the test playback in Safari, and my app was the only one playing before that.

Other info about my setup:
- I'm using BASS_SetConfig( BASS_CONFIG_IOS_NOCATEGORY, 1 );
- I'm handling AVAudioSessionInterruptionNotification's in my code.
- My audio session is initialized like this:
Code: [Select]
    AVAudioSession* audioSession = [AVAudioSession sharedInstance];
    [[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
   
    NSError* error;
    if ( [audioSession setCategory:AVAudioSessionCategoryPlayback error:&error] == NO )
    {
        LOGE( @"AVAudioSession::setCategory: failed with error %@", error );
    }
    else if ( [audioSession setActive:YES error:&error] == NO )
    {
        LOGE( @"AVAudioSession::setActive: failed with error %@", error );
    }

So to sum up: resuming when the app is in the background results in an error from AUIOClient_StartIO, whereas resuming when in the foreground works flawlessly.

Hints and input welcome !

Thanks,
Michael.

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for iOS (iPhone/iPad)
« Reply #1135 on: 27 Jun '16 - 16:09 »
Please also show what your interruption handler looks like.

Also, if you let BASS handle the audio session stuff itself (don't enable BASS_CONFIG_IOS_NOCATEGORY), do you still get the same problem then?

mbh

  • Posts: 5
Re: BASS for iOS (iPhone/iPad)
« Reply #1136 on: 27 Jun '16 - 17:14 »
Hi,

Thanks for the reply.

Here's my interruption handler, which pretty much boils down to calling BASS_Start() and BASS_pause():
Code: [Select]
- (void) onAudioSessionInterruptionNotification:(NSNotification*)notification
{
    AVAudioSessionInterruptionType      interruptionType = [(NSNumber *)notification.userInfo[AVAudioSessionInterruptionTypeKey] intValue];

    switch ( interruptionType )
    {
        case AVAudioSessionInterruptionTypeBegan:
            self.shouldResumeAfterInterruption = self.isPlaying;
            [self pause];
            break;
        case AVAudioSessionInterruptionTypeEnded:
            if ( self.shouldResumeAfterInterruption )
            {
                [self resume];
            }
            break;
    }
}

the play and pause functions are pretty simple:
Code: [Select]
- (void) pause
{
    BASS_Pause();
    [self updateAudioEngineStateFromMixerChannelState];
}

Code: [Select]
- (void) resume
{
    if ( BASS_Start() )
    {
        [self updateAudioEngineStateFromMixerChannelState];
    }
    else
    {
        NSLog( @"resume: %@", [self errorStringFromErrorCode:BASS_ErrorGetCode()] );
    }
}

I'll try letting BASS manage the audio session later tonight and report back here.

Thanks,
Michael

mbh

  • Posts: 5
Re: BASS for iOS (iPhone/iPad)
« Reply #1137 on: 28 Jun '16 - 21:56 »
Hi again,

Sorry for the delay...

In the meantime I have been trying out some stuff:
1) Keeping my hands off the AVAudioSession management and letting BASS do the internally.
This exhibits the same behavior, and completely disables my interruption handling as I don't seem to get any AVAudioSessionInterruptionNotification's unless I set the AVAudioSession active.

2) Tried the same procedure in an old test project I had lying around based on APAudioPlayer from github.
Even though this code has 0 shared implementation with my main app, the same steps provoke the same error: "AUIOClient_StartIO failed (560557684)".
As with the code in my app, it doesn't really matter if I let BASS manage the audio session or not.

Some random observations/conclusions:
- managing the audio session outside of BASS seems to not make a difference.
- two completely different implementations can yield the same error "AUIOClient_StartIO failed (560557684)".
- the test app uses a version of the BASS libs from the start of the year, my main app use the latest BASS libs.

I can share the code of the test-project if needed - it is pretty minimal, and I have removed as much as possible to focus in on the issue.

Thanks,
Michael.

SotirisPapad

  • Posts: 15
Re: BASS for iOS (iPhone/iPad)
« Reply #1138 on: 29 Jun '16 - 01:48 »
There is somthing like Tags_write ?

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for iOS (iPhone/iPad)
« Reply #1139 on: 29 Jun '16 - 16:07 »
I can share the code of the test-project if needed - it is pretty minimal, and I have removed as much as possible to focus in on the issue.

What happens if you try enabling the AVAudioSessionCategoryOptionMixWithOthers option?

Code: [Select]
    if ( [audioSession setCategory:AVAudioSessionCategoryPlayback withOptions:AVAudioSessionCategoryOptionMixWithOthers error:&error] == NO )

If that doesn't help, please do upload your minimal test project to play with here:

   ftp.un4seen.com/incoming/

There is somthing like Tags_write ?

No, I'm afraid not. You would need to use a 3rd-party library for tag writing.

mbh

  • Posts: 5
Re: BASS for iOS (iPhone/iPad)
« Reply #1140 on: 29 Jun '16 - 18:18 »
Hi,

If I'm using "MixWithOthers", the issue does not appear.
But this is because when mixing with others, audio playback is not interrupted, and need not be paused and resumed.

Also MixWithOthers isn't appropriate for the kind of app I'm doing (Streaming music player).

I'll try uploading the sample project to ftp later tonight... currently the ftp server is not happy letting me connect:
Code: [Select]
$ ftp ftp://ftp.un4seen.com
Connected to ftp.un4seen.com.
421 Service not available, remote server has closed connection.

Edit: ... and demo project + accompanying video is up on the FTP.

Thanks,
Michael.
« Last Edit: 29 Jun '16 - 20:27 by mbh »

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for iOS (iPhone/iPad)
« Reply #1141 on: 30 Jun '16 - 17:09 »
Got it, thanks. I'll check it out and then get back to you.

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for iOS (iPhone/iPad)
« Reply #1142 on: 5 Aug '16 - 16:20 »
The iOS version of the BASSOPUS 2.4.1.8 release is now up in the 1st post.

Oleg N

  • Posts: 86
Re: BASS for iOS (iPhone/iPad)
« Reply #1143 on: 5 Aug '16 - 18:19 »
@mbh, The tip here is to resume playback with delay (0.5~1s) when You are back from interruption. It's the only way I was able to get the proper behaviour.

mbh

  • Posts: 5
Re: BASS for iOS (iPhone/iPad)
« Reply #1144 on: 5 Aug '16 - 22:32 »
Thanks for the tip @oleg N.

Unfortunately the delay won't do it, I have already tried it with up to 5 seconds delay.

Status of this is that I am using one of my tech support tickets with Apple to have them dig into the issue.
I was able to reproduce the issue with one of Apple sample projects for AVAudioEngine, and have sent them that project and steps to reproduce.
No word has come back from them yet.
I'll post the results here when/if there is any.

/Michael.

Oleg N

  • Posts: 86

Ryota

  • Posts: 17
Re: BASS for iOS (iPhone/iPad)
« Reply #1146 on: 10 Aug '16 - 18:42 »
Hi,

Iím using BASS library with the "enc" add-on and BASS_FX library for developing iOS app.

When using BASS_Encode_StartCAFile with speed-down, the "mdat" atom comes before the "moov" atom.

Is there the way of encoding m4a files with the "moov" atom comes before the "mdat" atom.

Code: [Select]
HENCODE hEncode = BASS_Encode_StartCAFile(hStream, kAudioFileM4AType, kAudioFormatMPEG4AAC, BASS_ENCODE_AUTOFREE | BASS_ENCODE_FP_16BIT, 128000, [strSaveFilepath cStringUsingEncoding:NSUTF8StringEncoding]);
while(BASS_ChannelIsActive(hStream) && BASS_Encode_IsActive(hEncode)) {
float buf[10000];
BASS_ChannelGetData(hStream, buf, sizeof(buf) | BASS_DATA_FLOAT);
}
BASS_Encode_Stop(hEncode);

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for iOS (iPhone/iPad)
« Reply #1147 on: 11 Aug '16 - 15:23 »
That's strange. When I try that here, the "moov" atom does come before the "mdat" atom in the written file. Are you having the problem when converting a particular file, or perhaps a particular length of file? Can you also reproduce the problem on OSX? You could also try kAudioFileMPEG4Type (instead of kAudioFileM4AType) and see if that makes any difference.

Ryota

  • Posts: 17
Re: BASS for iOS (iPhone/iPad)
« Reply #1148 on: 11 Aug '16 - 17:56 »
Hi Ian,

I don't have the experience that develop OSX app, so i can tell you about only iOS behaviour.

First, It seems to have occured when converting any files, or any length files.

But it occurs with setting low-speed ( 50% etc. ).

Also it occurs when setting kAudioFileMPEG4Type (instead of kAudioFileM4AType).

If other information is necessary, please tell me.

And I hope that the "moov" atom comes before the "mdat" atom when converting files with any settings.

Regards,
Ryota.

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for iOS (iPhone/iPad)
« Reply #1149 on: 12 Aug '16 - 16:14 »
I don't have the experience that develop OSX app, so i can tell you about only iOS behaviour.

To test on OSX, you could use the CONTEST example that's included in the BASSenc package (build it and run "./contest <filename> 5" in a Terminal window).

But it occurs with setting low-speed ( 50% etc. ).

Is that the only time it happens? The tempo processing shouldn't have any effect on the encoding except to change the length, so that's what makes me think the issue may be length dependent. Do you get the problem even with short files? Do you never get the problem without the tempo processing? Also, what iOS version(s) are you testing on?