Class
All views that contain shapes are exported from Flow as `ShapeView` objects.
class Sound
A Sound
object takes in a audio player and triggers playback after a specific TimeInterval
.
A static method that accepts an AVAudioPlayer
and a TimeInterval
in order to initiate playback of an audio file.
static func playAudio(_ audio: AVAudioPlayer, delay: TimeInterval) {
audio.prepareToPlay()
let time = DispatchTime.now() + Double(Int64(delay * Double(NSEC_PER_SEC))) / Double(NSEC_PER_SEC)
DispatchQueue.main.asyncAfter(deadline: time) {
audio.play()
}
}
For example, the following will play the audio file associated with myPlayer
after a delay of 1s
.
Sound.playAudio(myPlayer, delay: 1.0)
result(s) found for “”.