How to use CMTime

I have an AVPlayer in my app.
To go to a certain time I obviously have to use:


The needed values are CMTime which should be kind of someTime, someTimebase.
I searched a lot (probably the wrong way) and can’t find a way to create a value pair that is accepted.

Any help is really appreciated.

CMTime is a struct, so it gets bridged to a record in AppleScript. This gives an example by calling a method that returns one:

use AppleScript version "2.5" -- 10.11 or later
use framework "Foundation"
use framework "AVFoundation"
use scripting additions

set theFile to choose file with prompt "Choose an Av file of some sort"
set theAsset to (current application's AVURLAsset's assetWithURL:theFile)
set durationInfo to theAsset's duration() -- returns record like: {value:2911360, timescale:1000, flags:1, epoch:0}

I don’t think CMTime was bridged before 10.11.

Many thanks Shane.
Turned out that I’m an idiot :sweat_smile:

My first thought last night when I read your reply was that I already used this code snippet and it didn’t help me.
Now I think I was a kind of idiot the time before.
All of the examples I found only used value & timescale - but those were mainly swift.
So I tried all variants of value & timescale without success instead of using an example I already had.