I am converting a video, uploaded to cloud storage using a signed URL, using Transcoder API. I have written a cloud function that is triggered with write operations on the bucket. Everything is working fine but I need to get a notification when the conversion is completed. I am creating the job to convert the vid using the following code. I am trying to follow the solution proposed in this answer Google Cloud Platform: Convert uploaded MP4 file to HLS file
def create_job_from_preset(project_id, location, input_uri, output_uri, preset):
"""Creates a job based on a job preset.
Args:
project_id: The GCP project ID.
location: The location to start the job in.
input_uri: Uri of the video in the Cloud Storage bucket.
output_uri: Uri of the video output folder in the Cloud Storage bucket.
preset: The preset template (for example, 'preset/web-hd')."""
client = TranscoderServiceClient()
parent = f"projects/{project_id}/locations/{location}"
job = transcoder_v1.types.Job()
job.input_uri = input_uri
job.output_uri = output_uri
job.template_id = preset
job.ttl_after_completion_days = 1
job.config = transcoder_v1.types.JobConfig(
PubsubDestination={
topic_name=f"projects/{project_id}/topics/testing"
}
)
response = client.create_job(parent=parent, job=job)
print(f"Job: {response.name}")
return response
The following snippet in the above code is not working
job.config = transcoder_v1.types.JobConfig(
PubsubDestination={
topic_name=f"projects/{project_id}/topics/testing"
}
)
I have viewed the following but couldn't find any solution.
https://cloud.google.com/transcoder/docs/how-to/create-pub-sub
How to configure pubsub_destination in Transcoder API of GCP