3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

swiftで効果音の再生終了後に処理を実行する

Last updated at Posted at 2016-07-22

つまづいたのでメモ。
効果音を鳴らしてから、録音を開始したい時などに。
(Swift3.0,Xcode8 beta3)

SoundCompletion.swift
 
//通知音を選択
let soundIdRing:SystemSoundID = 1057
                    
//通知音を再生終了時のコールバックを指定
AudioServicesAddSystemSoundCompletion(soundIdRing, nil, nil, { (soundIdRing, nil) -> Void in
                        
//再生終了後に実行したいコード
print("hoge")
                        
}, nil)

//音を鳴らす                    
AudioServicesPlaySystemSound(soundIdRing)

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?