开发者

CoreMedia.CMTime

开发者 https://www.devze.com 2023-01-15 21:08 出处:网络
I want to use the method Seek of the class AVPlayer. But this method take a parameter CMTime. Could anyone knows about this object.

I want to use the method Seek of the class AVPlayer. But this method take a parameter CMTime. Could anyone knows about this object.

In order to move the playback 开发者_StackOverflow中文版cursor to a given time.


The Apple documentation contains information on the CMTime struct.

As I understand it, you set the "TimeScale" to a timescale suitable for the media (e.g. 44100 = 1/44100 sec - which might be suitable for a CD). Then the "Value" represents units of that timescale. So, a value of 88200 would be 2 secs.

CMTime cmTime = new CMTime();
cmTime.TimeScale = 44100;
cmTime.Value = 88200;

Isn't too clear though, I'll grant you.


there are syntax errors in the code. it should be:

CMTime cmTime;
cmTime.timescale = 44100;
cmTime.value = 88200;

or just

CMTime cmTime = CMTimeMake(88200,44100);
0

精彩评论

暂无评论...
验证码 换一张
取 消