Stop a Composition from a Script

Stopping a composition using a script is a simple, one-line operation calling the stop() method of the composition object:

$context.composition.stop();

Stopping a composition can be used to conditionally terminate a composition on the basis of some error.