Tuesday, 29 January 2013



HI THIS TOUTORIAL WILL HELP FULL FOR STARTUP IN IOS CREATED BY NAVEENRAJU


Playing an Audio file in IPhone AudioPlayer and
Play an Audio file in IPad or in Any Tablet



















                                           




                                          




                                           






Code For Above Video Demo:



ViewController.xib




ViewController.h




//
//  ViewController.h
//  MusicFileDemo
//
//  Created by Naveen on 29/01/13.
//  Copyright (c) 2013 apple. All rights reserved.
//

#import <UIKit/UIKit.h>

#import "AVFoundation/AVFoundation.h"
@interface ViewController : UIViewController
<AVAudioPlayerDelegate>
{
    AVAudioPlayer *audioPlayer;

}



- (IBAction)myPlay:(id)sender;


- (IBAction)myStop:(id)sender;



@end





ViewController.m




//
//  ViewController.m
//  MusicFileDemo
//
//  Created by naveen on 29/01/13.
//  Copyright (c) 2013 apple. All rights reserved.
//
#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
    
    NSError *error;
    
    
    
    NSURL *url=[NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:@"naveen" ofType:@"mp3"]];
    
    
    
    
    audioPlayer=[[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error];
    
    
    
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)myPlay:(id)sender {
    
    
    [audioPlayer play];  
    
}

- (IBAction)myStop:(id)sender {

    [audioPlayer stop];    
}
@end














No comments:

Post a Comment