MP4GetSampleIdFromTime returns the sample id of the track sample in which the specified time occurs.

The specified time should be in the track time scale. See MP4ConvertToTrackTimestamp() for how to map a time value to this time scale.

It is wise to use MP4GetSampleTime() with the returned sample id so one can adjust for any difference between the specified time and the actual start time of the sample.

If the calling application needs a sample that can be accessed randomly then the wantSyncSample argument should be set to true. This could be the case for a player that is implementing a positioning function and needs to be able to start decoding a track from the returned sample id.