Skip to main content
A white cassette tape laying in the grass.

How to add an audio player to a content node in Drupal 9

Getting an audio player to show on your content nodes only takes a few steps. However, like many things in Drupal, knowing what those few steps are can be a bit of a challenge. This short guide will provide a basic introduction for anyone looking to use this core functionality on their site.

Step 1: Enable the Media module

The media module is available in Drupal core, and just needs to be enabled.

Step 2: Create a new Media type

In the admin toolbar, navigate to Structure > Media types > Add media type
You may or may not have specific needs that determine how you name your media type. I simply named mine Audio file, and then selected Audio file for the Media source selection field. Don't forget to click save.

Step 3: Create an entity reference field on the entity type that should contain your audio player

In the most basic case, you will add a field to the content type where you want an audio player. When you get to the field type drop-down, select Media (under Reference). Of course, label your field according to your needs.

note: If you are using the paragraphs module, you might choose to create a new paragraph type and add a field there instead.

Click Save and continue

Click Save field settings

Now you will be directed to the Edit tab for your new field. Select your desired settings. The important bit here is that you scroll to the REFERENCE TYPE field set, and click the checkbox next to your new media type (Audio file in my case).

Scroll to the bottom and click Save settings

If you added this field directly to your content type, then you should be all set.
If you are using paragraphs, don't forget to enable your new paragraph type on the paragraph field of your content type.

More about...

Drupal 9

Syndications

Comments

Add new comment

The content of this field is kept private and will not be shown publicly.

Markdown

The comment language code.
CAPTCHA Please help us focus on people and not spambots by answering this question.

Name a content management framework which Agaric has expertise with!