I've written a CEP panel that needs to retain focus. I'd like a way to start/stop playback of the active sequence without having to select the timeline or program windows (causing the CEP panel to lose focus).
I thought I would be able to find a command in ExtendScript to start or stop playback, but I can't find anything. Does such a command exist?
There is nothing in PPro's ExtendScript API to control Program monitor playback; just Source monitor.
Please explain more about "needs to retain focus"; from a user's perspective, what's the workflow you're trying to support?
Sorry, Bruce. Just noticed your question. The reason the panel needs to retain focus is that it utilizes key bindings to perform some actions (so if I press "a", my script does something; if I press "b", it does something else, etc.). Those key bindings only work if the panel has focus. If I can't control playback from my panel, I have to switch back and forth between the timeline and my panel - which is annoying. The spacebar key to start/stop play works from within the panel, but I normally want the sequence to play at double speed so I can quickly work through the entire sequence. To do that, I have to click on timeline, start it at doublespeed, then quickly switch back to my panel before any keys need to be pressed. Make sense?
The solution I found below works great. I just added some additional key binds to emulate the J, K, and L key actions (backward, stop, forward, etc.). Now I never have to leave my panel and my custom key binds always work.
Yes, makes sense; glad you found a solution that works for you.
Not in the offical API, but in the undocumented QE Dom you can.
app.enableQE(); qe.startPlayback(); qe.stopPlayback();
Thanks, Justin. I assumed it was in QE somewhere.
startPlayback and stopPlayback currently do the same thing - toggle playback. Basically, it's like pressing the spacebar.
I found something that works a bit better, at least for my purposes:
This is exactly what I was looking for. You can set the playback speed using the single parameter:
1 = normal speed
0.5 = half speed
-1 = reverse
0 = stop
There's also a stop() method that does the same thing as play(0).
Posting all this for any future visitors.