• Stars
    star
    115
  • Rank 304,100 (Top 7 %)
  • Language
    Objective-C
  • Created over 13 years ago
  • Updated over 11 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An online iOS audio player based on AVAudioStreamer with a custom UI.

AudioPlayer

An online iOS audio player based on AVAudioStreamer with a custom UI.

How to use

  1. link CFNetwork.framework, AudioToolbox.framework, QuartCore.framework
  2. import AudioPlayer floder
  3. create an instance of AudioPlayer with AudioButton and url, like below:
  - (void)playAudio:(AudioButton *)button
{    
    NSInteger index = button.tag;
    NSDictionary *item = [itemArray objectAtIndex:index];
    
    if (_audioPlayer == nil) {
        _audioPlayer = [[AudioPlayer alloc] init];
    }
        
    if ([_audioPlayer.button isEqual:button]) {
        [_audioPlayer play];
    } else {
        [_audioPlayer stop];
        
        _audioPlayer.button = button; 
        _audioPlayer.url = [NSURL URLWithString:[item objectForKey:@"url"]];

        [_audioPlayer play];
    }   
}

screenshots