Problems related to video status in the video details

The behavior of the video status field differs from what is documented. According to the documentation, the status.state is supposed to become ready only when encoding for all resolutions is completed.
However, in reality, it becomes ready as soon as encoding for any one resolution is finished.
https://developers.cloudflare.com/api/operations/stream-videos-retrieve-video-details

A similar discrepancy is mentioned in a community topics, where it is stated that status.state becomes ready only when encoding for all resolutions is completed. However, this doesn’t align with the actual behavior.
https://community.cloudflare.com/t/is-readytostream-true-the-exact-same-as-status-state-ready/401483/2

Currently, because readyToStream and status.state = ready both become true as soon as encoding for any one resolution is completed, they essentially mean the same thing. Is this a documentation error or a Cloudflare Stream issue?

I am interested in monitoring the progress of videos being encoded using the List API. However, since ‘status.state’ changes to ready as soon as encoding for any one resolution is complete, I cannot accurately monitor until the process reaches 100%.
https://developers.cloudflare.com/api/operations/stream-videos-list-videos

1 Like

Hi @zaid
Can you tell me if there has been a spec change in the API or if it is a bug in the API?
Currently, we don’t know what is correct, the actual behavior of the API or the documentation, so we are at a loss as to how to proceed with the implementation of our application.
Below is the actual behavior and the expected behavior, which we hope you can use as a reference.

Expected behavior

If encoding has not been completed.

{
  "readyToStream": false,
  "status": {
    "state": "inprogress",
    "step": "encoding",
    "pctComplete": "25"
  }
}

When encoding has been completed in some resolutions.

{
  "readyToStream": true,
  "status": {
    "state": "inprogress",
    "step": "encoding",
    "pctComplete": "50"
  }
}

If encoding has been completed in all resolutions.

{
  "readyToStream": true,
  "status": {
    "state": "ready",
    "pctComplete": "100"
  }
}

Actual Behavior

If encoding has not been completed.

{
  "readyToStream": false,
  "status": {
    "state": "inprogress",
    "step": "encoding",
    "pctComplete": "25"
  }
}

When encoding has been completed in some resolutions.

{
  "readyToStream": true,
  "status": {
    "state": "ready",
    "step": "encoding",
    "pctComplete": "50"
  }
}

If encoding has been completed in all resolutions.

{
  "readyToStream": true,
  "status": {
    "state": "ready",
    "pctComplete": "100"
  }
}

Sorry for the confusion. I believe the webhook is being fired when readyToStream is set to true. We’ll review the logic and the docs for this because it is confusing as it stands.

If you would like a webhook when all renditions are ready, we have a special webhook that we can enable on your account. Please drop me an email (zaid @cloudflare.com) and we will enable an event called allRenditionsReady. It explictly fires when all renditions are ready.

@zaid
Thank you for your reply.
However, I’m not inquiring about the triggering timing of the webhook; rather, I’m interested in the specifications of the response returned by the Cloudflare Stream API. Could you please provide information about the expected behavior I mentioned in the following reply?

I would like to know if this is the intended specification of the API or if it’s a bug.

Hi, @zaid

I would like to know the answer to my previous inquiry. Could you please let me know if you have any updates?
I look forward to hearing from you.