Note that there are some explanatory texts on larger screens.

plurals
  1. POiOS online radio streaming questions
    primarykey
    data
    text
    <p>I have to create app that provides online radio streaming (icecast), preferably .ogg format. So I have next questions:<br/></p> <ol> <li>How can I play <strong>.ogg</strong> format audio stream? Are there any supported classes? Because I can't find any, so I think that it is impossible without many bitwise operations using <code>CFNetwork</code>, <code>CoreAudio</code>, <code>AudioToolbox</code> etc. <strong>(I don't look at cocos2d, because it's ridiculous) Am i wrong?</strong></li> <li>I'm playing mp3 stream for now (no possibility for .ogg for me). I tried to use <code>AVPlayer</code>, <code>MPMovieMediaController</code>, <strong>AudioSreaming lib by MattGallagher and by DigitalDJ</strong>, and none of these solutions can't provides me metadata access.</li> </ol> <p><strong>For AVPlayer:</strong></p> <pre><code> -(void)playButtonPressed:(id)sender { NSURL *grindURL = [NSURL URLWithString:@"http://radio.goha.ru:8000/grind.fm"]; grindFMPlayer = [[AVPlayer alloc] initWithURL:grindURL]; [grindFMPlayer.currentItem addObserver:self forKeyPath:@"status" options:0 context:nil]; AVPlayerItem *item = grindFMPlayer.currentItem; [grindFMPlayer play]; } -(void)stopButtonPressed:(id)sender { AVURLAsset *ass = grindFMPlayer.currentItem.asset; NSArray *arr = [ass commonMetadata]; NSArray *it_meta = [grindFMPlayer.currentItem timedMetadata]; [grindFMPlayer pause]; } </code></pre> <p><strong>arr</strong> and <strong>it_meta count</strong> always <strong>0</strong>, no song\artist\any metadata.<br/> The same for the <code>MPMovieMediaController</code>, metadataUpdate never called</p> <pre><code>streamAudioPlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:@"http://radio.goha.ru:8000/grind.fm"]; streamAudioPlayer.movieSourceType = MPMovieSourceTypeStreaming; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(MetadataUpdate:) name:MPMoviePlayerTimedMetadataUpdatedNotification object:nil]; [streamAudioPlayer play]; </code></pre> <p>and in stop button method:</p> <pre><code>timedMeta = [streamAudioPlayer timedMetadata]; if ([streamAudioPlayer timedMetadata]!=nil &amp;&amp; [[streamAudioPlayer timedMetadata] count] &gt; 0) { NSLog(@"metadata count = %d", [[streamAudioPlayer timedMetadata] count]); for (MPTimedMetadata *metadata in [streamAudioPlayer timedMetadata]) { NSLog(@"description %@", metadata.allMetadata); if ([[metadata.allMetadata valueForKey:@"key"] isEqualToString:@"title"]) { NSString *text = [metadata.allMetadata valueForKey:@"value"]; NSString* filename = text; } } } </code></pre> <p><code>[streamAudioPlayer timedMetadata]</code> always nil.</p> <p>I've tried</p> <ul> <li><a href="https://github.com/mattgallagher/AudioStreamer" rel="nofollow noreferrer">https://github.com/mattgallagher/AudioStreamer</a></li> <li><a href="https://github.com/DigitalDJ/AudioStreamer" rel="nofollow noreferrer">https://github.com/DigitalDJ/AudioStreamer</a></li> </ul> <p>These 2 projects for shoutcast and icecast - <a href="http://www.mikejablonski.org/2009/04/17/reading-shoutcast-metadata-from-a-stream/" rel="nofollow noreferrer">http://www.mikejablonski.org/2009/04/17/reading-shoutcast-metadata-from-a-stream/</a></p> <p>But still have no luck to get current playing track info, which only obtains in <a href="http://code.google.com/p/audiostreamer-meta/" rel="nofollow noreferrer">SHOUTcast app</a> as </p> <p><strong>1st</strong> <code>Metadata = 'StreamTitle='</code>, </p> <p><strong>2nd</strong> <code>metadata = ''</code> and <code>bitrate = '128000'</code><br/> (So I think I have to have deal with bytes from <strong>http</strong> headers response or something like this? but wtf, it's shoutcast metadata, but my radiostream is icecast. Have no idea)<br/> I would be grateful for any help!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload