mjordan / islandora_workbench

A command-line tool for managing content in an Islandora 2 repository
MIT License
24 stars 39 forks source link

Add support for remote video media #252

Open mjordan opened 3 years ago

mjordan commented 3 years ago

Currently, Workbench assumes media have files attached to them. Remote video doesn't have a file.

dara2 commented 3 years ago

+1 for this enhancement. We have multiple clients who are using remote video files and remote audio files, so having this would be awesome.

dara2 commented 3 years ago

Hi @mjordan - I wanted to check in about this again and see where it is in the queue. Thanks! Updating to add: we will need support for importing remote audio files as well.

mjordan commented 3 years ago

I've been distracted from work on #287 during the last couple weeks and need to finish it before taking anything other than emergency support on. However, I've cleared those distracting things from competing with Workbench and plan on digging into #287 until it's done. Once it is, I can turn to remote video.

I have to admit I am not entirely clear on how remote video media work differently than locally-hosted Islandora media. I opened https://github.com/Islandora/documentation/issues/1868, and am not sure if the behaviour described there is expected or not.

In any event, I will move on to resolving this issue as soon as I can but the queue is not as predictable as I'd like.

I assume that remote audio will work in the same way as remote video, but I'm unaware of the standard way that Islandora 2.0 will handle it. https://github.com/Islandora/documentation/issues?q=is%3Aissue+is%3Aopen+remote+audio+ doesn't bring up anything useful. What kind of configuration do you folks at B-D use for remote audio?

mjordan commented 3 years ago

@dara2 I was just chatting with Eli in Slack and it appears that remote audio is not yet part of core Drupal. Remote video (for Youtube and Vimeo) is. I'm going to add this to Wednesday's tech call to get the discussion going.

dara2 commented 3 years ago

Hi @mjordan - Thank you for the update! And thank you for adding this to the tech call agenda. While remote audio isn't in core Islandora, we will be creating a media type for it. Depending on where the client will be hosting the files, we're hoping to use a module like https://www.drupal.org/project/media_entity_soundcloud. So I'm thinking Remote Audio will be set up in a similar way to Remote Video, where it's a Media entity with a field with a URL pointing to the file. I just threw a comment in the Islandora issue you'd opened re: Remote Video.

mjordan commented 3 years ago

Just some notes as ideas come in:

mjordan commented 2 years ago

For reference, here's the _format=json request body for a remote video using the core field_media_oembed_video field:

{
  "mid": [
    {
      "value": 900
    }
  ],
  "uuid": [
    {
      "value": "19909901-4edb-4ef5-b979-a7fab1fa8809"
    }
  ],
  "vid": [
    {
      "value": 900
    }
  ],
  "langcode": [
    {
      "value": "en"
    }
  ],
  "bundle": [
    {
      "target_id": "remote_video",
      "target_type": "media_type",
      "target_uuid": "20579c9d-bcb4-47b9-8237-650bc3f46bbf"
    }
  ],
  "revision_created": [
    {
      "value": "2022-06-29T14:08:05+00:00",
      "format": "Y-m-d\\TH:i:sP"
    }
  ],
  "revision_user": [
    {
      "target_id": 1,
      "target_type": "user",
      "target_uuid": "791847b8-d33c-41c6-af77-7446316f281e",
      "url": "\\/user\\/1"
    }
  ],
  "revision_log_message": [],
  "status": [
    {
      "value": true
    }
  ],
  "uid": [
    {
      "target_id": 1,
      "target_type": "user",
      "target_uuid": "791847b8-d33c-41c6-af77-7446316f281e",
      "url": "\\/user\\/1"
    }
  ],
  "name": [
    {
      "value": "San Francisco 1906 (New Version) in Color [60fps, Remastered] w\\/added sound"
    }
  ],
  "thumbnail": [
    {
      "target_id": 953,
      "alt": "",
      "title": null,
      "width": 480,
      "height": 360,
      "target_type": "file",
      "target_uuid": "a503bbac-d682-4685-932f-c16767517f70",
      "url": "http:\\/\\/localhost:8000\\/sites\\/default\\/files\\/oembed_thumbnails\\/2022-06\\/M0uPNR59LsjfJqxzESROEROWmsFJKOXtA8TocILzJCE.jpg"
    }
  ],
  "created": [
    {
      "value": "2022-06-29T14:04:49+00:00",
      "format": "Y-m-d\\TH:i:sP"
    }
  ],
  "changed": [
    {
      "value": "2022-06-29T14:08:05+00:00",
      "format": "Y-m-d\\TH:i:sP"
    }
  ],
  "default_langcode": [
    {
      "value": true
    }
  ],
  "revision_translation_affected": [
    {
      "value": true
    }
  ],
  "path": [
    {
      "alias": null,
      "pid": null,
      "langcode": "en"
    }
  ],
  "content_translation_source": [
    {
      "value": "und"
    }
  ],
  "content_translation_outdated": [
    {
      "value": false
    }
  ],
  "field_media_oembed_video": [
    {
      "value": "https:\\/\\/youtu.be\\/sHkc83XA2dY"
    }
  ],
  "field_media_of": [
    {
      "target_id": 1102,
      "target_type": "node",
      "target_uuid": "3e211bf8-aa62-440a-8707-39c40f0eac74",
      "url": "\\/node\\/1102"
    }
  ]
}

The field containing the URL to the video ('field_media_oembed_video') is:

"field_media_oembed_video":[{"value":"https:\/\/youtu.be\/sHkc83XA2dY"}]

So we don't need a new field type. But, there's no local media file, and no mimetype, both of which we'll need config/logic in Workbench to address.

mjordan commented 1 year ago

I've hit what appears to be a roadblock. I can manually (in the standard media add/edit form) create a remote video using the "share" URL for https://www.youtube.com/watch?v=YTE0OTVOnZU, which is https://youtu.be/YTE0OTVOnZU. But, when I use that URL in Workbench CSV, Drupal doesn't create the media because "Unprocessable Entity: validation failed.\\nfield_media_oembed_video: The given URL does not match any known oEmbed providers.

"https://youtu.be/*" is indeed listed in the "endpoints" section of YouTube's entry at https://oembed.com/providers.json, which is what is configured at admin/config/media/oembed-providers. So I'm not sure what's going on.

I'm going to leave this for now but if anyone has any info they can share about why Drupal's REST interface doesn't like oEmbed URLs that start with https://youtu.be/, please share!

Summary of work done to date:

dara2 commented 1 year ago

Hi @mjordan - not sure if you've already done this, but in the oEmbed Providers module configuration, have you set up a "Provider Bucket" and clicked on "YouTube"? We had to set up a "bucket" for Remote Video and then check off some of the allowed providers (at /admin/config/media/oembed-providers/buckets/video/edit).

mjordan commented 1 year ago

Hi @dara2, thanks. Even with a bucket containing Youtube I'm still getting the The given URL does not match any known oEmbed providers. error.

mjordan commented 1 year ago

@dangercat I'm really sorry not to get back to you sooner.

I haven't looked at this since December, but I don't see a way around the The given URL does not match any known oEmbed providers. error I am getting. I'll try to document it and submit an issue on drupal.org since at this point I suspect this is a bug in the Oembed REST interface. But until that issue is resolved, Workbench will not be able to populate remote video fields.

mjordan commented 1 year ago

Noting here that @aOelschlager did some relevant work over at https://github.com/mjordan/islandora_workbench/pull/625 that pushes us a bit further to supporting remote media.

dara2 commented 3 weeks ago

Hi @mjordan - I was wondering if additional work on this is on the roadmap for Workbench? Also I was looking at #625 and wondering if that means there is a workaround we could implement in the meantime?