Closed RizwanAslam closed 3 years ago
Hi @RizwanAslam thanks for reaching out. Good question -- let me help clarify. The short answer is that after the upload success
fires you will need to do one of two things:
upload_id
video.upload.asset_created
(more details here) -- this will contain the full upload
object which will have an asset_id
property.^ Either of those methods is a valid approach.
It sounds like you understand this bit -- but to clarify the relationship between Mux Uploads and Mux Assets for anyone else that may come across this:
Mux Upload
POST /uploads
id
, url
, status
, new_asset_settings
, error
url
property with Upchunk to perform the upload -- it sounds like you got this farGET /uploads/:id
API Reference or listen for the video.upload.asset_created
Webhooksasset_id
property.Mux Asset
asset_id
property from the completed upload to fetch the asset/assets/:id
: API Referencestatus
("preparing"
, "ready"
, "errored"
), playback_ids
, aspect_ratio, an
upload_id`, etc."preparing"
state and assuming a valid video file as been uploaded then it will transition to "ready"
. If the file was not a video file, or happens to be invalid for another reason then the asset will be in the "errored"
status. Hopefully that clarifies the relationship between Uploads and Assets. Here's a guide that might be helpful too.
Let us know if you're still stuck and we'd be happy to help!
Hi @dylanjha, yup I got it now. Thank you very much for your quick response. Cheers
On success callback, there is nothing passed to that method instead of the error object. I am confused about how we will get the URL of the uploaded asset which I will use to preview the video.
// subscribe to events upload.on('success', err => { console.log("Wrap it up, we're done here. 👋"); });