ios - loop music with SKAction -


I want to loop my background music with an ascation but the music stops after a line when I Let's move to another scene. Is there a way to start the loop and play it on different scenes? Now the code is placed in the init method of MyScene - is there a better place ... maybe the Finnish launching option?

Here's what I've tried:

  if (Delegate.musicOn == Yes & amp; representative.CongressIISplaying ==) {SKAction * playMusic = [ Switched Placeface Named: @ "Loop.Wave" Waiter End: Yes]; SKAction * Loop Music = [Skeleton Ritactic Action: Play Magic]; [Speed ​​run action: loop music]; Delegate.musicIsPlaying = Yes; }    

You are SKAction . Instead, use AVAudioPlayer :

  NSString * filePath = [[NSBundle mainBundle] pathForResource: @ "music" type: @ "MP3"]; NSError * error; AviDio Player * GameSeniellop = [[AviPlayer Player] at with content of URL: [NSUr File URL: Pathpath] Error: & amp; Error]; If (error) {nslog (@ "error in audio player:% @", [error localization]]; } And {gameSceneLoop.numberOfLoops = -1; [KSKen Loop PreparationPlay]; [Sportsskin loop play]; }    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -