ios - Can't play audio from an online link, using Amazing Audio Engine -


i trying code achieve online streaming/buffering of amazing audio engine, throws me following error:

aeaudiofileplayer.m:148: audiofileopenurl: 'wht?' (2003334207)

here code:

 - (void)viewdidload {         [super viewdidload];          self.audiocontroller = [[aeaudiocontroller alloc] initwithaudiodescription:[aeaudiocontroller noninterleaved16bitstereoaudiodescription] inputenabled:yes];     _audiocontroller.preferredbufferduration = 0.005;     [_audiocontroller start:null];      [self initwithaudiocontroller:self.audiocontroller];      aeaudiofileplayer *oneshot = [aeaudiofileplayer audiofileplayerwithurl:[nsurl urlwithstring:self.urlofsong] error:null];      _oneshot.removeuponfinish = yes;     [_audiocontroller addchannels:[nsarray arraywithobject:oneshot]];       }      - (id)initwithaudiocontroller:(aeaudiocontroller*)audiocontroller {          self.audiocontroller = audiocontroller;         nserror *error = null;         bool result = [self.audiocontroller start:&error];         if ( !result ) {             // report error             nslog(@"the amazing audio engine didn't start!");         } else {             nslog(@"the amazing audio engine started perfectly!");         }          return self;     } 

in .h file

@property (nonatomic, strong) aeaudiofileplayer *player; @property (nonatomic, strong) aeaudiocontroller *audiocontroller; 

in .m file

-(void)playaudio {      self.audiocontroller = [[aeaudiocontroller alloc] initwithaudiodescription:[aeaudiocontroller noninterleaved16bitstereoaudiodescription] inputenabled:yes];     _audiocontroller.preferredbufferduration = 0.005;     [_audiocontroller start:null];      [self initwithaudiocontroller:self.audiocontroller];      if ( _player ) {         [_audiocontroller removechannels:@[_player]];         self.player = nil;     } else {         nsarray *documentsfolders = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes);         nsstring *path = [documentsfolders[0] stringbyappendingpathcomponent:kfilename];         if ( ![[nsfilemanager defaultmanager] fileexistsatpath:path] ) return;          nserror *error = nil;         self.player = [aeaudiofileplayer audiofileplayerwithurl:[nsurl fileurlwithpath:path] error:&error];          if ( !_player ) {             [[[uialertview alloc] initwithtitle:@"error"                                         message:[nsstring stringwithformat:@"couldn't start playback: %@", [error localizeddescription]]                                        delegate:nil                               cancelbuttontitle:nil                               otherbuttontitles:@"ok", nil] show];             return;         }          [self starttimer];         _player.removeuponfinish = yes;          _player.completionblock = ^{             _audiocontroller = nil;             [ _audiocontroller removechannels:@[_player]];             [self remvetimer];             self.player = nil;          };         [_audiocontroller addchannels:@[_player]];      }  }     - (id)initwithaudiocontroller:(aeaudiocontroller*)audiocontroller {      self.audiocontroller = audiocontroller;     nserror *error = null;     bool result = [self.audiocontroller start:&error];     if ( !result ) {         // report error         nslog(@"the amazing audio engine didn't start!");     } else {         nslog(@"the amazing audio engine started perfectly!");     }        return self; } 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -