ios - Reduce AVPlayer Video Memory Usage -


we have video player play videos inside avplayer (1gb of content in 8mb .mov files in size). load avplayer using avmutablecomposition of video track , audio track on local disk bundled app.

we like:

avasset* videoasset = [[avurlasset alloc] initwithurl:videourl options:nil]; avasset* voiceasset = usevoice ? [[avurlasset alloc] initwithurl:voiceurl options:nil] : nil;  avmutablecomposition* composition = [[avmutablecomposition alloc] init];  avmutablecompositiontrack* videotrack = [composition addmutabletrackwithmediatype:avmediatypevideo preferredtrackid:kcmpersistenttrackid_invalid]; avmutablecompositiontrack* audiotrack = [composition addmutabletrackwithmediatype:avmediatypeaudio preferredtrackid:kcmpersistenttrackid_invalid]; avmutablecompositiontrack* voicetrack = usevoice ? [composition addmutabletrackwithmediatype:avmediatypeaudio preferredtrackid:kcmpersistenttrackid_invalid] : nil;  nserror* error = nil; [videotrack inserttimerange:cmtimerangemake(kcmtimezero, videoasset.duration) oftrack:[[videoasset trackswithmediatype:avmediatypevideo] firstobject] attime:kcmtimezero error:&error]; if (error) {     [[mngappdelegate sharedmanagers].errormanager presenterror:error]; }  if ([videoasset trackswithmediatype:avmediatypeaudio].count > 0) {     [audiotrack inserttimerange:cmtimerangemake(kcmtimezero, videoasset.duration) oftrack:[[videoasset trackswithmediatype:avmediatypeaudio] firstobject] attime:kcmtimezero error:&error];     if (error) {         [[mngappdelegate sharedmanagers].errormanager presenterror:error];     } }  if (usevoice) {     [voicetrack inserttimerange:cmtimerangemake(kcmtimezero, voiceasset.duration) oftrack:[[voiceasset trackswithmediatype:avmediatypeaudio] firstobject] attime:kcmtimezero error:&error];     if (error) {         [[mngappdelegate sharedmanagers].errormanager presenterror:error];     } } 

and load using replacecurrentitemwithplayeritem (except first one).

    [self.player replacecurrentitemwithplayeritem:nextitem]; 

we never create playlist or can go back. replace when new video needs played.

what we're noticing vm tracker showing our dirty size going crazy. once play first 8mb file approach 80mb of dirty. replace more , more videos can our dirty size 200mb+. within 20-30 videos app killed , low memory crash log.

is there special should doing reduce memory of avplayer replace clips in player?


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -