scripting QuickTime player

Devin Asay devin_asay at byu.edu
Thu Jul 7 00:04:21 EDT 2011


On Jul 6, 2011, at 4:33 PM, Timothy Miller wrote:

> Hello,
> 
> I've never tried scripting for a quicktime player. Tricky. A few tips would be helpful.
> 
> In the stack I'm working on, there's only one QT player per card. The filename of the player is already established at openCard, the sound files stored on a local volume. They are in m4a format if that matters. They don't seem to be encrypted.
> 
> The sound files are bird calls. I want to use the stack to practice recognizing bird calls. It all works fine except for one problem. In the first few seconds of each recording, a human voice speaks the name of the bird. I don't want to hear that.
> 
> I wonder if there's some way to script so that the volume is set to zero for the first few seconds, then turns up to normal.
> 
> Alternately, maybe there's a way to script so the player starts at second five of the sound file instead of at the beginning.
> 
> Can this be done? If so, I can probably make it work given a few hints.
> 
> If not, I'll just have to use a sound editor to cut out the first few seconds of each file. There are hundreds of them.
> 
> Thanks in advance,


Tim,

I've got an overview of how to script player objects here:

http://livecode.byu.edu/video/QTinRev.php

For what you want you could 

  set the playSelection of player "foo" to true
  set the startTime of player "foo" to NNN -- where NNN is the starting "frame" number 
  set the endTime of player "foo" to XXX -- where XXX is the ending "frame" number
  start player "foo"

Check out the timeScale property for how to determine where to start and stop.

HTH

Devin

Devin Asay
Humanities Technology and Research Support Center
Brigham Young University





More information about the use-livecode mailing list