iphone - Add sound to AVMutableVideoComposition multiple times -
i'm using avmutablevideocomposition
add video , audio.
i have multiple video , audio files stitch together, works fine.
i'm using code add audio:
avurlasset *audioasset = [[avurlasset alloc] initwithurl:[nsurl fileurlwithpath:path] options:nil]; [compositionaudiotrack inserttimerange:titlerange oftrack:[audioasset trackswithmediatype:avmediatypeaudio][0] attime:partzerotime error:&err];
the path correct (used nslog check) , partzerotime insertion point every audio track (the audio played @ beginning of video only). audio file same (some m4a file).
this works first audio, though. every subsequent audio isn't played. not receive error adding audio asset.
i tried create separate track music, same result.
any ideas?
[edit]
i might not entirely clear want do, here's more information: have video composition of several clips stitch avmutablecomposition. contains intro (where try add music), followed 1 or 2 clips, intro (with music) followed more video. added separate track music --music--silence--music--silence.
i tried adding silence insertemptytimerange
messes everything. used inserttimerange:tr oftrack:nil
... gives me same result before: first music clip played, every following clip won't...
i'm pulling hair out on this...
ok, dumb... :)
the problem was, defined timerange wrong. instead of using cmtimerangemake(kcmtimezero, introduration)
defined cmtimerangemake(introstart, introduration)
introstart
starting time of music...
Comments
Post a Comment