When a Vidu task reaches completed, CometAPI gives you a different kind of response to handle: the content operation returns the generated video as video/mp4, not another JSON task record.
That distinction makes the client flow simple, but important:
- Create the Vidu task through CometAPI and retain its task ID.
- Read the task metadata and poll until the task status is
completed. - Call
GET /v1/videos/{id}/contentwith that same ID. - On the successful branch, stream or save the response bytes as an MP4. Do not send the success body through a JSON parser.
The content endpoint is therefore a media-download step, not a second status lookup. Keep the task ID as the durable link between the metadata you polled and the file you store. In a streaming client, check the response status and content type before opening the destination, then write the body without decoding it as text.
There is also an incomplete-task branch to account for. If the Vidu task is still running, the endpoint returns a JSON error rather than video bytes. Treat that response as a signal to continue the task-status workflow; do not create a partial MP4 from it. The documentation does not prescribe a polling interval or retry schedule, so choose those operational policies separately for your application.
The practical parser boundary is: task metadata and an incomplete-task error are JSON, while the successful content response is binary video/mp4. Keeping those branches explicit prevents a successful CometAPI download from being lost to a JSON-only response handler.