Using zencoder option - I have implemented a rule to fire an email to a node author on the event 'after video encoding success' - which I assumed would fire when the video file is successfully returned from Zencoder (on postback).

However, the rule is firing on node save or on cron, depending on which option I use (i.e. on successfully submitting the file to Zencoder)..... not after encoding success.

This needs fixing so the event is only triggered on postback, otherwise, in my case, users are informed that the video has been processed prematurely.


Tsubo’s picture

Title: Rule event 'after video encoding success' tiggered incorrectly » Rule event 'after video encoding success' triggered incorrectly

fixed typo in title.

aasarava’s picture

Same problem here.

It seems the "video_success" call is invoked in the process() function in includes/ But when you use Zencoder, the process function queues up the job, so calling video_success here would be too early. Maybe it makes more sense to move the video_success and video_failed events to the TranscoderAbstractionFactories for ffmpeg and zencoder?

The other issue that would pop up with Zencoder is that multiple outputs result in multiple postbacks. Either we need to consolidate outputs into one job request, so that there's only one postback (if that's possible). Or else, we need to track how many outputs (presets) were requested and only fire the success event once the last one comes back and is successful.

Jorrit, what do you think?

Jorrit’s picture

I know this is a bug and what causes it, I just haven't had time to fix it. Ideally, the rules functionality would be put in a separate submodule and greatly improved.

For the multiple videos per job there already is a ticket #1547122: Support multiple outputs per job for zencoder. Until that is implemented, I think I will fire an event for the first successful postback. It is not ideal, but the best I can do now.

Jorrit’s picture

Component: Video Core » Rules
Assigned: Unassigned » Jorrit
aasarava’s picture

If the patch for multiple outputs (#1547122) looks good, then it should be fairly easy to check in processPostback if a Zencoder job is finished, like so:

    if ($notification->job->state == 'finished') {
      if (module_exists('rules') && $video->entity_type == 'node') {
        rules_invoke_event('video_success', node_load($video->entity_id));

This should only get triggered once, after all outputs have been converted by Zencoder.

Jorrit’s picture

Status: Active » Fixed

Fixed in 7.x-2.x-dev. Your patch for #1547122: Support multiple outputs per job for zencoder is not necessary for this change.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.