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

Generated subtitles error #67

Closed matthewlein closed 1 year ago

matthewlein commented 1 year ago

After updating from 1.9.0 to 3.9.0 I'm getting an error on get_asset with a generated subtitles track

Relevant code:

create_asset_request = MuxRuby::CreateAssetRequest.new
create_asset_request.input = [
  {
    url: [the_source],
    generated_subtitles: [
      {
        language_code: 'en',
        name: 'English CC',
      }
    ]
  },
]
create_response = assets_api.create_asset(create_asset_request)
asset_id = create_response.data.id
...
asset = assets_api.get_asset(asset_id)
ArgumentError (invalid value for "text_source", must be one of ["uploaded", "embedded", "generated_live", "generated_live_final"].):

In the mux web admin I can see the asset was created and has a subtitles track with "text_source": "generated_vod"

{
  "type": "text",
  "text_type": "subtitles",
  "text_source": "generated_vod",
  "status": "ready",
  "name": "English CC",
  "language_code": "en",
  "id": [track_id]
}

Downgrading to 1.9.0 makes everything work perfectly.

philcluff commented 1 year ago

Hi @matthewlein, thanks for letting us know.

We're working on a release for the Ruby SDK which will address this issue and add support for Generated VOD captions. It's likely that this API field was not present (or not an emum) in 1.9.0, so wasn't being validated.

Thanks.

philcluff commented 1 year ago

Hey @matthewlein, this is now available in 3.11.0.

Thanks!

holman commented 1 year ago

Going to add this little bit here since it wasn't immediately apparent in the .md docs as to how to use the new API (it's easy to quickly get lost in the nested land of "what needs to be a Hash and what needs to be an Array", hah). Basically gets added as an option to a Hash on Array input to input rather than being directly added to input:

    create_asset_request.input = [{
      generated_subtitles: [
        MuxRuby::AssetGeneratedSubtitleSettings.new(
          name: "English CC",
          language_code: "en"
        )
      ]
    }]

(Yes, I'm primarily making this note here because inevitably the poor schmuck who runs into this next time will be... me.)

philcluff commented 1 year ago

Thanks for the feedback @holman, I really appreciate it. We're working on an improved SDK which will include better documentation, I'll make sure that this includes generated captions.

Thanks!