While using next and previous functionality in AudioStreamer, two or more songs starts together


Here is the code for next and previous button

- (IBAction)nextPressed:(id)sender { Previousbutton.enabled=YES; Nextbutton.enabled = NO; NSLog(@"TOTAL TRACK:%d",TotalTrackCount); // TrackCount = TotalTrackCount+1; if(selectedIndex+1 < TotalTrackCount) { [streamer stop]; [self performSelector:@selector(destroyStreamer) ] ; //player flag player=@"stop"; int new_index; new_index=selectedIndex+1; selectedIndex=new_index; str_AudioUrl=[array_audioUrl objectAtIndex:selectedIndex]; userPrefs = [NSUserDefaults standardUserDefaults]; [userPrefs setInteger:new_index forKey:@"Index"]; str_AudioUrl=[array_audioUrl objectAtIndex:new_index]; [self performSelector:@selector(createStreamer) ] ; //[self setButtonImage:[UIImage imageNamed:@"loadingbutton.png"]]; [streamer start]; NSString *newtitle=[array_AudioName objectAtIndex:new_index]; self.title=newtitle; NSLog(@"selected index next==%d",selectedIndex); [self performSelector:@selector(enableNext) withObject:nil afterDelay:2.0]; } else { Nextbutton.enabled=NO; } } - (void) enableNext { Nextbutton.enabled = YES; } //it will play next sone from table (next index) - (IBAction)previousPressed:(id)sender { Nextbutton.enabled = YES; Previousbutton.enabled = NO; NSLog(@"selected index previous==%d",selectedIndex); if(selectedIndex >0) { [streamer stop]; //player flag player=@"stop"; [self performSelector:@selector(destroyStreamer) ] ; int new_index; new_index=selectedIndex-1; selectedIndex=new_index; str_AudioUrl=[array_audioUrl objectAtIndex:selectedIndex]; userPrefs = [NSUserDefaults standardUserDefaults]; [userPrefs setInteger:new_index forKey:@"Index"]; str_AudioUrl=[array_audioUrl objectAtIndex:new_index]; [self performSelector:@selector(createStreamer)] ; [self setButtonImage:[UIImage imageNamed:@"loadingbutton.png"]]; [streamer start]; NSLog(@"selected index previous2==%d",selectedIndex); NSString *newtitle=[array_AudioName objectAtIndex:new_index]; self.title=newtitle; [self performSelector:@selector(enablePrevious) withObject:nil afterDelay:2.0]; } else { Previousbutton.enabled = NO; } } - (void) enablePrevious { Previousbutton.enabled = YES; }


AudioStreamer class has a bug related to Pause during streaming. So a nice post is given on <a href="https://github.com/mattgallagher/AudioStreamer/issues/26" rel="nofollow">gitHub</a> to solve this problem.


  • Interpolate and fill pandas dataframe with datetime index
  • How to perform a selector on the main thread with the AppDelegate in a global function, in swift?
  • Recursive function on sublist returning None
  • Explode a row to multiple rows in pandas dataframe
  • iOS 4.0 contentScaleFactor and scale - how to handle in 3.1.3?
  • using AVSystemController in iPhone App
  • Python regex catastrophic backtracking
  • use grep and awk to transfer data from .srt to .csv/xls
  • Should ScheduledExecutorService.scheduleAt* methods re-schedule tasks if the task throws RuntimeExce
  • Manually ending the IntentService worker thread
  • how to Display Files From Files Sharing in Swift 3
  • Optimal way to set pixel data?
  • AJAX Chat Box Scrolling Up Issue
  • NodeJS using node-serialport sometimes becomes unresponsive
  • Is it ok to submit a build to the app store for testing when a previous build is waiting for review?
  • Problem with sockets in C#
  • setTimeOut and local function
  • C++ how to get substring after get position of its index
  • Visual Studio not stopping on an exception being thrown
  • ProgressBar Paint Method?
  • How to get value of the slider, when touchend or mouseup events are used?
  • how to translate xml using xslt with complex rules
  • detecting connection lost in spark streaming
  • How to replace TouchesBegan with UIGestureRecognizer
  • RabbitMQ java client stops consuming messages
  • You tube videos are not playing
  • Delphi: Where is the shortcut that started the application? [duplicate]
  • How can I tell a form not to dispose a particular control when it closes?
  • Python delete lines of text line #1 till regex
  • SonarQube: Cannot deactivate rule with missing quality profile
  • MySQL WHERE-condition in procedure ignored
  • Trying to switch camera back to front but getting exception
  • Adding custom controls to a full screen movie
  • Rearranging Cells in UITableView Bug & Saving Changes
  • using conditional logic : check if record exists; if it does, update it, if not, create it
  • How get height of the a view with gone visibility and height defined as wrap_content in xml?
  • FormattedException instead of throw new Exception(string.Format(…)) in .NET
  • Sorting a 2D array using the second column C++
  • java string with new operator and a literal
  • playing video using jmf