iCulture forum | iPhone, iPad,  iPod touch, Apple TV en iOS

iCulture forum | iPhone, iPad, iPod touch, Apple TV en iOS (https://forum.iculture.nl/)
-   Ontwikkelen voor iOS (https://forum.iculture.nl/f133/development/f58/ontwikkelen-voor-ios/)
-   -   achtergrondmuziek (https://forum.iculture.nl/f133/development/f58/ontwikkelen-voor-ios/33951-achtergrondmuziek.html)

Tim14ww 09-05-09 23:54

achtergrondmuziek
 
Edit: Opgelost, met de volgende code :

Code:

AVAudioPlayer *myExampleSound;  //this variable can be named differently
   
    NSString *myExamplePath = [[NSBundle mainBundle] pathForResource:@"sample" ofType:@"m4a"]; // *Music filename* is the name of the file that you want to play.  BE SURE that you type the correct characters as the system is case-sensitive.  It caused a crash for me...  Very painful.
   
    myExampleSound =[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:myExamplePath] error:nil];
   
    myExampleSound.delegate = self;
   
    [myExampleSound prepareToPlay];
 
    [myExampleSound play];
    //[myExampleSound stop];
       
    myExampleSound.numberOfLoops = 10; /* can be as many times as needed by the application  -    myExampleSound.numberOfLoops = -1; >> this will allow the file to play an infinite number of times  */

Letwel, gebruik een m4a file.

Lock plz.

Greetz


Alle tijden zijn GMT +2. Het is nu 23:54.