Jump to content

Recommended Posts

Posted

We're working on a module that will automatically send media off for AI captioning via the Speechmatics API.

To do this, the module hooks a page save and if the set media field has content, and the set caption field is empty - then it will strip the audio using FFmpeg and sent it for captioning. The captions are then received via a webhook and saved back to the page.

One thing we'd like to improve is how the module triggers. Stripping audio from videos using FFmpeg is fast. but can still take a while for long videos.

Currently we hook after Pages::save.

$this->addHookAfter('Pages::save', $this, 'sendContentForTranscription');

This still seems to delay the page saving, as the system seems to be waiting for FFmpeg to finish and the POST request to be sent for the API. Is there a hook that will run after the page has saved, but without holding up the page save? More like how LazyCron triggers after a page view, but without holding up a page view.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...