Can't switch a single asset video back to using default editor for the presentation

I am currently trying to put the streamingUrl of a video in a model that uses a SingleAsset of type video.
This streamingUrl can be obtained with the grapqhl query:

{ allVideos(filter: {id: {eq: <someId>})
    video {
      video {
        streamingUrl
      }
    }
}

To do so, I tried to use the ‘Computed Fields’ Editor in the presentation.
Unfortunately I was not able to display the streamingUrl with it.

When trying to put the ‘Default Editor’ back, I have the error ‘Couldn’t update the field!’ when saving the model.

Questions
Is the issue expected? Is there a way to fix that without recreating the whole collection from scratch?

Hey @ion.alberdi, and welcome to the community!

I think you can actually do a direct lookup from the plugin and compose a streamingUrl yourself, and not need to use GraphQL at all?

Try this for the Computed Fields plugin:

const upload = await getUpload(video.upload_id)

if(upload && upload.mux_playback_id) {
  return `https://stream.mux.com/${upload.mux_playback_id}.m3u8`
} else {
  return ''
}

That should get you:


If that doesn’t work, could you provide a little more information, please? (Or link to the project & model in question so I can take a look? You can DM me or email us at support@datocms.com if you want to keep it private).

  • What kind of field are you trying to use it with?
  • What is the code you’re currently using with the plugin?

Also, may I ask why you need to display the streamingUrl inside the DatoCMS admin dashboard? Typically that is something that only the frontend needs to know about (and it can fetch that using GraphQL directly when it makes the request for the rest of the content, without needing a separate computed field).

Also, if this is the part you’re more concerned about (not being able to save the record because the plugin isn’t returning a valid string), you can fix it a few different ways:

  1. Change the plugin code to what I mentioned above, which should get you a working Mux streaming URL
  2. Change the plugin to code to just return '', which will make that field save with an empty string (but at least you can save)
  3. Uninstall the plugin altogether

Any of those should work, depending on your objective, and won’t require you to recreate the entire collection. Please let me know if that helps :slight_smile:

(Note: This was resolved via email followups. Additionally, we shipped a fix for the issue where you could not switch back to the default editor. Sorry for the inconvenience!)

Additionally, we shipped a fix for the issue where you could not switch back to the default editor.

Indeed thank you so much for this fix :pray: have a great day!

1 Like