muxinc / mux-ruby

Official Mux API wrapper for ruby projects, supporting both Mux Data and Mux Video.
MIT License
51 stars 14 forks source link

How to list assets that belong to a specific live stream? #29

Closed giugrilli closed 3 years ago

giugrilli commented 3 years ago

Once a live stream finished, assets are created. I want to list all assets that belong to a specific stream id. How?

philcluff commented 3 years ago

Hey @giugrilli, the data.recent_asset_ids field on a live stream will list the 10 most recent assets generated by a live stream.

We also recommend integrating via webhooks. When you receive a webhook about an asset, it will also contain a live_stream_id field, which you can use to model the relationship in your CMS: https://docs.mux.com/docs/webhooks

Thanks!

giugrilli commented 3 years ago

I see, I was expecting a call to retrive all video assets that belong to a live_stream_id. But this way around is fine as well. Out of curiosity: why the assets api do not implement a call similar to the one I was expecting?

Thank you for your quick reply btw!

philcluff commented 3 years ago

No worries!

The core of it is that we're building video infrastructure, not a CMS. As such from Day 1 we've been very careful about API calls that could be seen or used as CMS functionality as we want to make sure people don't accidentally build a CMS on top of us, and then get caught by rate limits when they scale.

That said, we're reviewing things like being able to list entities with more advanced filters this year as we appreciate that the current model can be rather restrictive for many operations.

This feedback is really valuable, thanks!

giugrilli commented 3 years ago

That makes lots of sense, and as you said, there are cases where it can be a bit restrictive. In my case I am giving the possibility to a viewer to watch the recorded streaming, after the stream is finished. However this can be seen as a CMS in some prospective. Basically I will have a history of streams with all the recorded videos in each, for people to watch. Is this a misuse of how mux is intended to be used? Should I download the video assets and use another CMS to enable this functionality?

Thank you!

philcluff commented 3 years ago

Serving your VOD assets is absolutely a good use of Mux, and how it's intended to work, it's just that the metadata and structure around that VOD asset's relationship should be something that you're modelling yourself in your own CMS so that you don't have to ping Mux each time you need to know that relationship.

Thanks!