サイレントモードでもサウンドを鳴らす


/ Published in: Objective C
Save to your folder(s)



Copy this code and paste it in your HTML
  1. #import <AudioToolbox/AudioToolbox.h>
  2.  
  3.  
  4. -(void) viewDidLoad{
  5. AudioSessionInitialize(NULL,NULL,NULL,NULL);
  6.  
  7. //カテゴリをMediaPlaybackにする
  8. UInt32 sessionCategory = kAudioSessionCategory_MediaPlayback;
  9. AudioSessionSetProperty =(kAudioSessionProperty_AudioCategory,
  10. sizeof(sessionCategory),
  11. &sessionCategory);
  12. AudioSessionSetActive(YES);
  13. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.