0

How do i change the duration of a created sound created with SKAction.playSoundFileNamed:

var sound = SKAction.playSoundFileNamed("sound.mp3", waitForCompletion: false)

I tried setting sound.duration = 1.0 but with no luck so far ?

Warz
  • 7,386
  • 14
  • 68
  • 120

1 Answers1

0

In short, that is impossible with SKAction.playSoundFileNamed: method.

duration property specifies the time in seconds required for current action to complete.

When using SKAction.playSoundFileNamed: method you don't have control over the audio being played (no pausing, stoping, resuming pitching etc). It's meant to play a sound, nothing more.

Some useful links:

https://stackoverflow.com/a/22590464/3402095

https://stackoverflow.com/a/21023417/3402095

Community
  • 1
  • 1
Whirlwind
  • 14,286
  • 11
  • 68
  • 157