Skip to content

Instantly share code, notes, and snippets.

ipmcc / OneShotAVAudioPlayer.h
Created Aug 24, 2013
A subclass of AVAudioPlayer that retains itself until playback ends or encounters an error, so you don't have to keep a strong reference to it. Supports pass-through to an exogenous delegate that gets set (which is captured in a zeroing weak reference). It's probably inadvisable to use this, but what the heck!
View OneShotAVAudioPlayer.h
#import <AVFoundation/AVFoundation.h>
@interface OneShotAVAudioPlayer : AVAudioPlayer