我以秒为单位获得当前播放值,但我需要以毫秒为单位。我试图currentTime.value/currentTime.scale。但它没有得到确切的价值。如何获取当前播放时间,AVPlayer中的CMTime以毫秒为单位?
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乘以秒?大声笑我很困惑! IT应该是秒/ 1000 –
毫秒=秒/ 1000。它的权利之一。我错误地写了 –