EZAudio icon indicating copy to clipboard operation
EZAudio copied to clipboard

EZAudioPlayer with HTTP streaming URL not working

Open eyeezzi opened this issue 7 years ago • 0 comments

TLDR; How do i use EZAudioPlayer with a HTTP Streaming URL?

My goal is to display the waveform of a live HTTP stream in realtime. I have a streaming URL like http://myradio.com/listen, which works fine in browsers. After reading the documentation, I figured I'll do this in 2 steps:

  1. Create an EZAudioPlayer initialized with my streaming URL and set player delegate to self. [EZAudioPlayer audioPlayerWithURL:<my_url> delegate:<self>]
  2. Then implement the EZAudioPlayerDelegate method below in which I update my EZAudioPlot view.
-(void)audioPlayer:(EZAudioPlayer *)audioPlayer playedAudio:(float **)buffer withBufferSize:(UInt32)bufferSize withNumberOfChannels:(UInt32)numberOfChannels inAudioFile:(EZAudioFile *)audioFile {
    __weak typeof (self) weakSelf = self;
    dispatch_async(dispatch_get_main_queue(), ^{
        [weakSelf.audioPlot updateBuffer:buffer[0]
                          withBufferSize:bufferSize];
    });
}

However, I cannot get past step 1 because the EZAudioPlayer will not initialize with a HTTP streaming URL, I suppose it is checking for file existence and simply failing since the url is not a local file. How can I remedy this? Thanks.

eyeezzi avatar Feb 19 '17 22:02 eyeezzi