Ошибка OSStatus - 12780 при вызове insertTimeRange: ofTrack: atTime: ошибка: AVMutableCompositionTrack во второй раз

Прежде всего, я должен сказать, что я люблю этот форум, он мне очень помогал. У меня проблема, и я нигде не могу найти на нее ответа, поэтому это мой первый вопрос.

Моя проблема заключается в следующем:

У меня есть видео, представленное AVPlayerItem, пользователь может редактировать время начала видео с помощью кнопки cutBefore, которая обрезает видео слева от ползунка

Для вырезания видео используется следующий метод:

- (void)CutBeforeAction { 

AVMutableComposition *composition = [AVMutableComposition composition];

// Get the audio and video tracks of the video
AVMutableCompositionTrack *compositionVideoTrack = [composition addMutableTrackWithMediaType:AVMediaTypeVideo preferredTrackID:kCMPersistentTrackID_Invalid];
AVMutableCompositionTrack *compositionAudioTrack = [composition addMutableTrackWithMediaType:AVMediaTypeAudio preferredTrackID:kCMPersistentTrackID_Invalid];

// Calculate the new duration
CMTime currStartTime = _player.currentItem.currentTime;
CMTime endTime = _player.currentItem.duration;
CMTimeRange range = CMTimeRangeFromTimeToTime(currStartTime, endTime);

// Insert the new duration to the tracks
NSError *error = nil;
[compositionVideoTrack insertTimeRange:range 
                               ofTrack:[[_player.currentItem.asset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0]
                                atTime:kCMTimeZero
                                 error:&error];

[compositionAudioTrack insertTimeRange:range 
                               ofTrack:[[_player.currentItem.asset tracksWithMediaType:AVMediaTypeAudio] objectAtIndex:0]
                                atTime:kCMTimeZero
                                 error:&error];
// Create a new AVPlayerItem with the new composition
AVPlayerItem *item = [AVPlayerItem playerItemWithAsset:composition];
[self setPlayerItem:item];
[_player replaceCurrentItemWithPlayerItem:item];

// change the player location to the beginning of the video
[_player seekToTime:CMTimeMakeWithSeconds(0, 1)];
[self syncTimeLabel];
[self syncScrubber];

}

При запуске метода - (void) cutBefore в первый раз он работает нормально, когда я запускаю его во второй раз (видео уже редактировалось один раз) методы

[compositionVideoTrack insertTimeRange:range 
                           ofTrack:[[_player.currentItem.asset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0]
                            atTime:kCMTimeZero
                             error:&error];

и

[compositionAudioTrack insertTimeRange:range 
                           ofTrack:[[_player.currentItem.asset tracksWithMediaType:AVMediaTypeAudio] objectAtIndex:0]
                            atTime:kCMTimeZero
                             error:&error];

возвращаются со следующей ошибкой:

Операция не может быть завершена . (Ошибка OSStatus -12780.)

Я попытался выяснить, что означает этот код ошибки, но практически ничего не нашел. xdebug.remote_host = локальный хост xdebug.remote_port = 10000 xdebug.remote_handler = dbgp ...

как избавиться от следующей ошибки несовместимой версии отладчика:

параметр php.ini:

xdebug.remote_enable=true
xdebug.remote_host=localhost
xdebug.remote_port=10000
xdebug.remote_handler=dbgp
xdebug.profiler_enable=1
xdebug.profiler_output_dir="C:\xampp\tmp"

enter image description here

6
задан Gainster 11 May 2011 в 08:59
поделиться