Wednesday, 15 August 2012

ios - how to import songs dynamically to our app in Objective C -



ios - how to import songs dynamically to our app in Objective C -

i tried iphone app.in app need import songs table-view when click on import button.i don't know how import songs dynamically.please tell me frameworks used. have played locally saved songs code:- using 2 frameworks `avfoundation.framework,mediaplayer.framework

#import "viewcontroller.h" #import <mediaplayer/mediaplayer.h> #import <avfoundation/avfoundation.h> @interface viewcontroller () @property (nonatomic, strong) avaudioplayer *audioplayer; - (ibaction)playsound:(id)sender; @end @implementation viewcontroller - (void)viewdidload { [super viewdidload]; nsbundle *mainbundle = [nsbundle mainbundle]; nsstring *filepath = [mainbundle pathforresource:@"drum" oftype:@"mp3"]; nsdata *filedata = [nsdata datawithcontentsoffile:filepath]; nserror *error = nil; self.audioplayer = [[avaudioplayer alloc] initwithdata:filedata error:&error]; [self.audioplayer preparetoplay]; self.audioplayer.numberofloops = -1; } - (void)didreceivememorywarning { [super didreceivememorywarning]; // dispose of resources can recreated. } - (ibaction)playsound:(id)sender { [self.audioplayer play]; uiview *wrapperview = [[uiview alloc] initwithframe:cgrectmake(20, 120, 260, 20)]; wrapperview.backgroundcolor = [uicolor clearcolor]; [self.view addsubview:wrapperview]; mpvolumeview *volumeview = [[mpvolumeview alloc] initwithframe: wrapperview.bounds]; [wrapperview addsubview:volumeview]; } @end

output code songs played locally need when click play button should import 10 songs in tableview , songs mush played. please give me idea. in advanced.

ios iphone objective-c media-player avfoundation

No comments:

Post a Comment