Problem/Motivation
Drupal core ships a media type for local audio (core/recipes/audio_media_type, which this recipe already applies) and one for remote video (core/recipes/remote_video_media_type), but nothing for audio hosted on an external service.
So a site that wants an editor to pick, from one media field, either an uploaded audio file or an episode on SoundCloud, Spotify or Mixcloud has no remote option to offer. The editor has to download the episode and re-upload it, which is wrong for a podcast: the canonical copy lives on the hosting service.
No drupal_cms_* recipe provides one either, so there is nothing to depend on instead.
Core's oEmbed media source has exactly one derivative, oembed:video (see Drupal\media\Plugin\media\Source\OEmbedDeriver), and the list of allowed providers is per media type in source_configuration.providers. So the source plugin is reusable as is, and no new plugin or contrib dependency is needed.
Steps to reproduce
- Apply this recipe to a site.
- Go to Administration > Structure > Media types.
- Audio, Image, Document, Video, SVG image and Remote video are there. There is no media type for remote audio.
- Add a media reference field for a podcast episode. There is no bundle to allow that accepts a SoundCloud, Spotify or Mixcloud URL.
Environment: Drupal core ~11.4, Varbase Media Base 1.0.x-dev, PHP 8.4.
Proposed resolution
Add a Remote audio media type on Drupal core's own oEmbed source, mirroring the core Remote video type exactly, so it is familiar and carries no new dependency:
media.type.remote_audio, sourceoembed:video, providers SoundCloud, Spotify and Mixcloud.field.storage.media.field_media_oembed_audioand its field on the bundle, astringfield holding the episode URL.- Default and Media library form displays, and default and Media library view displays.
- The same per-role permissions this recipe already grants for
remote_video, so the roles it configures can create, edit and delete remote audio too.
No new Composer requirement: everything used is Drupal core.
Depends on #3624669, which lets the recipe be applied to a site that already carries media configuration. The merge request branch is based on that issue's branch, so the two do not conflict; it will be rebased onto 1.0.x once #3624669 is merged.
Remaining tasks
- ✅ File an issue
- ✅ Addition/Change/Update/Fix
- ❌ Testing to ensure no regression
- ➖ Automated unit/functional testing coverage
- ➖ Developer Documentation support
- ❌ User Guide Documentation support
- ➖ UX/UI designer responsibilities
- ➖ Accessibility and Readability
- ❌ Reviewed by a human
- ❌ Code review by maintainers
- ❌ Full testing and approval
- ❌ Credit contributors
- ❌ Review with the product owner
- ❌ Update Release Notes
- ❌ Release
User interface changes
- A new Remote audio media type appears under Structure, Media types, and in the Media library when adding media.
API changes
- N/A
Data model changes
- Adds the
remote_audiomedia bundle and thefield_media_oembed_audiostring field on it. Nothing existing changes.
Release notes snippet
- Added a Remote audio media type for audio hosted on an external service such as SoundCloud, Spotify or Mixcloud, on Drupal core's oEmbed source.
Issue fork varbase_media_base-3624670
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
rajab natshahThe Remote audio media type is in the 1.0.1 release: https://www.drupal.org/project/varbase_media_base/releases/1.0.1