Я получаю текущее значение воспроизведения в секундах, но мне нужно в миллисекундах. Я попробовал currentTime.value/currentTime.scale. Но он не получил точной стоимости.Как получить текущее время воспроизведения, CMTime в миллисекундах в AVPlayer?
CMTime currentTime = vPlayer.currentItem.currentTime; //playing time
CMTimeValue tValue=currentTime.value;
CMTimeScale tScale=currentTime.timescale;
NSTimeInterval time = CMTimeGetSeconds(currentTime);
NSLog(@"Time :%f",time);//This is in seconds, it misses decimal value double shot=(float)tValue/(float)tScale;
shotTimeVideo=[NSString stringWithFormat:@"%.2f",(float)tValue/(float)tScale];
CMTime currentTime = vPlayer.currentItem.currentTime; //playing time
CMTimeValue tValue=currentTime.value;
CMTimeScale tScale=currentTime.timescale;
NSTimeInterval time = CMTimeGetSeconds(currentTime);
NSLog(@"Time :%f",time);//This is in seconds, it misses decimal value
double shot=(float)tValue/(float)tScale;
shotTimeVideo=[NSString stringWithFormat:@"%.2f", (float)tValue/(float)tScale];
вы не можете сделать второй/1000? –
@ HariKrishnan.P Вы уверены, что умножаете секунды на 1000? lol Я в замешательстве! Это должно быть секунды/1000 –
miliseconds = секунды/1000. его правильный. Я ошибаюсь, чтобы написать –