ios - Audio plays fine on iPhone and simulator but gets cut off on iPad -
i'm making app user can press forward/backward buttons. each time these buttons pressed, playing audio file stops, , audio file begins. of these files not loop.
i playing audio files code similar following:
audiourl2 = [nsurl fileurlwithpath:[[nsbundle mainbundle]pathforresource:@"sound2" oftype:@"aac"]]; audio2 = [[avaudioplayer alloc] initwithcontentsofurl:audiourl2 error:nil]; [audio2 play]; audio1 = nil; audio3 = nil; i have arc enabled, i'm not explicitly releasing audio files.
for part, above code works fine. have not encountered problems on iphone device, nor on iphone or ipad simulators. of audio on ipad device works.
however, 1 of audio files not play, if avoid touching buttons while it's playing. every time play audio file on ipad, can hear beginning of audio file, gets cut off @ same place. problem occurs on ipad, not of other devices or simulators.
here's tried far:
- deleted app ipad. cleaned, rebuilt, , re-installed app
- restarted ipad
- ensured mute / soft mute off
- toggled mute / soft mute few times, , left mute off
- increased ipad's volume
after trying each of above, find same audio file cut off @ same place.
why happening, , 1 file in particular? how can resolve it?
update
i tried using @property (strong, nonatomic) avaudioplayer *audio2; in header, , tried replacing "strong" "retain", still have same problem.
next, stuck audio2.numberofloops = 1; before play call see happen. interestingly enough, audio2 repeat, each loop ends @ cut-off point before. maybe went wrong when sound2 added ipad build?
it appears sound2.aac file got corrupted somehow. deleted file app , cleaned project. re-saved .aac file, brought new .aac file project, , cleaned again. after running on ipad again, sound2.aac played in full.
Comments
Post a Comment