Forum Replies Created

Viewing 1 replies (of 1 total)
  • I had the same issue, but I discovered something interesting that can point in the right direction. What I discovered is that for some reason, the call to the function $background_task->trigger … is not working.
    But if instead we do a direct call to the method generate_audio( $post_id )
    then the audio is generated in the S3 bucket, and then I can reproduce the audio in the player, and everything seems to work as expected.

    So here is the file I edited:

    wp-content/plugins/amazon-polly/admin/AmazonAI-PollyService.php

    at the bottom of this function:
    public function save_post( $post_id, $post, $updated ) {

    You will find following lines of code:

    if( ! ( wp_is_post_revision( $post_id) || wp_is_post_autosave( $post_id ) ) ) {
                $logger->log(sprintf('%s Starting background task process ( id=%s )', __METHOD__, $post_id));
                $background_task = new AmazonAI_BackgroundTask();
                $background_task->trigger(self::GENERATE_POST_AUDIO_TASK, [ $post_id ]);
                // *** Added this extra line here ***
                $this->generate_audio( $post_id ) ;
            }

    I added that extra line at the end:

    $this->generate_audio( $post_id ) ;

    This is just calling directly a function that is located below in the same class.
    Somehow that forces the audio to be generated on S3 bucket, and I can reproduce the audio in the player as expected.
    Now, I will not claim that this is a correct fix, but it should point in the right direction, and it is working fine for me.

Viewing 1 replies (of 1 total)