2016-10-26 4 views
-3

나는 AVAsset 클래스를 사용하고 url을 전달했습니다. 그러나 그것은 기간을 제공하지 않습니다. 나는 nan 만받습니다.AVPlayer 항목 기간이 길어집니다 (유효하지 않음)

CMTime audioDuration = audioAsset.duration; 
float audioDurationSeconds = CMTimeGetSeconds(audioDuration); 
double duration = CMTimeGetSeconds(asset.duration); 

답변

0

코드 아래에 한번,

AVURLAsset *asset1 = [[AVURLAsset alloc] initWithURL:info[UIImagePickerControllerMediaURL] options:nil]; // info[UIImagePickerControllerMediaURL] is url(file url) here. You should pass your url here 

    CMTime videoDuration = asset1.duration; 

    float videoDurationInSeconds = CMTimeGetSeconds(videoDuration); 

하고 URL이 파일 URL 있는지 확인!