muxinc / upchunk

Uploads Chunks! Takes big files, splits them up, then uploads each one with care (and PUT requests).
MIT License
336 stars 46 forks source link

get asset ID or playback ID when upload is finished? #65

Closed arcticmatt closed 3 years ago

arcticmatt commented 3 years ago

I'm trying to do the following:

  1. User uploads video (from browser) using upchunk
  2. After the upload is complete, I want to display their video

This would be easy if upchunk gave me the asset ID or playback ID when the upload is finished. But as far as I can tell, it doesn't, and I need to add a webhook in order to get this functionality.

mmcc commented 3 years ago

Totally see what you mean, but this is out of scope for UpChunk itself. This library is just for facilitating chunked resumable uploads and doesn't really know anything about Mux at all (or at least tries to stay agnostic). We're exploring higher-level components, though!

We typically suggest integrating with webhooks as a general best practice, but if it helps you can also get the asset ID via the direct upload endpoint. Once the upload is complete the direct upload object includes the newly created asset id. In stream.new we use a similar workflow and just hit the related upload/asset endpoints to ultimately show the player.

If you have other questions feel free to shoot an email to help@mux.com or jump on Intercom. I bumped an internal feature request on this one, I agree the upload workflow is a little convoluted right now, particularly when not using Webhooks 😞

danpalmieri commented 2 years ago

This is disappointing! Receive the file id is the expected default workflow in 99% of apps.

shahidbasheer commented 6 months ago

is there any api to get asset by passing the passthrough key?

mmcc commented 6 months ago

@shahidbasheer No, the passthrough field can't be used as a filter or anything along those lines. You can filter the asset list with upload_id and live_stream_id.

shahidbasheer commented 6 months ago

thank you from creeate direct upload I got the upload id and fetch assets with that.

$upload = $uploadsApi->createDirectUpload($createUploadRequest); $url = $upload->getData()->getUrl(); $upload_id = $upload->getData()->getId();

mmcc commented 6 months ago

Yep, that's what I would do too!

aikonoer commented 5 months ago

no plans to simplifying it and just return asset id after upload?

RubenStark commented 2 months ago

But like whats the point, if I cant get the upload ID to play the video the user just upload, it just have no sense

malithmcr commented 1 month ago

why is this issue closed if you don't provide a proper solution?

mmcc commented 1 month ago

I get where you’re coming from, but it’s simply not the level this library lives at. It’s a generic library anyone can use with a storage backend that accepts chunks. It only knows about an upload url, it does not, and cannot, know about your Mux asset details.

We have a full example that involves handling webhooks for this workflow in our docs.

We do want to provide higher level abstractions for this, but those would live in Mux-specific projects like Mux Uploader.