O'Reilly logo

Cocos2d for iPhone 1 Game Development Cookbook by Nathan Burba

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Streaming audio

In Chapter 1, Graphics, we used the MPMoviePlayerController class to play full motion video. In this recipe, we will use a similar technique to create a streaming audio player.

Streaming audio

Getting ready

Please refer to the project RecipeCollection02 for full working code of this recipe.

How to do it...

Link the MediaPlayer framework to your project. Now, execute the following code:

#import <MediaPlayer/MediaPlayer.h> #import "AppDelegate.h" @implementation Ch6_StreamingAudio -(CCLayer*) runRecipe { //Create music player buttons [[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"music_player.plist"]; CCMenuItemSprite *prevItem ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required