Module Drupal Illustration Voir sur
Nb téléchargements : 7


  • Code
  • Documentation
  • Miscellaneous
  • User interface



permet l'intégration d'AmplitudeJS


Status : Published
Projects : Modules
Maintenance status : Seeking new maintainer
Development status : Maintenance fixes only
Supported Branches : 1.0.
shield Stable releases for this project are covered by the security advisory policy.


The module defines the AmplitudeJS ( audio player external library for Drupal along with media field formatters. These are based on the AmplitudeJS example players:


  1. Install the module (more information about that here:
  2. You must also install the AmplitudeJS library. The module needs the following file:
    You can get it with composer if your composer.json is set properly for downloading npm packages (more information about that here composer require npm-asset/amplitudejs:^5.3 or you can download it manually from the URL, and copy it to the /libraries/amplitudejs/dist/ folder.
  3. Enable the amplitudejs module - it just defines the external library for Drupal. If you develop a custom formatter based on this library, you'll need just this one.
  4. Enable the amplitudejs_formatters submodule if you want to use the AmplitudeJS example players as media field formatters.

How to set the formatters from the amplitudejs_formatters submodule

  1. After enabling the module, you'll need to have a media type that will contain the necessary fields for the audio player formatters. If you installed the core media module, there should be an audio media type, you can extend that.
    The following fields are required in the media type:
    • A file field that'll contain 1 mp3 file.

    The following fields are optional in the media type:

    • Text field for song name.
    • Text field for song artist.
    • Text field for song album name.
    • Image field for song album art. (It is not required but advised to create a custom image style that will be used for displaying the album art)
  2. If the media type is done, create a media reference field for your content type.
  3. Set the previously created media type as reference type there.
  4. Navigate to Manage display and set one of the audio player formatters available for that media field.
  5. Open the formatter settings.
  6. There you'll need to assign different fields for different data with tokens. If you installed the contrib token module (, you can browse the available tokens. Here's a help for setting the tokens:
    • Audio file field name: provide the file URL, so use [media:audio_file_fieldname:entity:url] and replace audio_file_fieldname with the field's machine name that contains the audio file.
    • Title field name: use [media:name] if you want to use the media's own title or if you have a separate field for the song name, use the following: [media:song_name_fieldname]
    • Artist field name: [media:artist_name_fieldname]
    • Album Art field name: use [media:image_file_fieldname:entity:url] for the original image URL. If you want to use an image style instead, use the following: [media:image_file_fieldname:image_style_machine_name:url] Don't forget to replace the image_file_fieldname with the field machine name that contains the image file & replace the image_style_machine_name with the image style's own machine name.
    • Album field name: [media:album_field_name]

    Here's an example setting:
    AmplitudeJS formatter token settings example

  7. Save the settings, and now you can create content.

You can set up multiple media fields with multiple audio player formatters but due to the limitations of the AmplitudeJS library, only one player will play the audio simultaneously.

Since 1.0.1, you can also use the formatters for simple File fields that contain 1 or more mp3 files. Then in the settings you must set [file:url] as the "Audio file field name". Another new thing in that release that you can also set tokens from the parent entity. For example, if you use a file field in a content type, you can set the node title in the Formatter settings as [node:title]. The same can be done if you use media fields.

Tip: click the "Browse available tokens" button to search and insert the proper field token.

Toutes les informations proviennent du site