Plugin or Tag or both for a custom audioplayer

Hi,

I need to create a custom audioplayer that can be inserted into an article where needed. Currently I am using a snippet, which works fine but is not flexible enough. Since I am new to plugins and tags I wonder which is the best way?
1.) Create a plugin that provides a tag, 2.) extend the kirby audio tag, or 3.) create a custom kirbytag only.

The player needs assets a javascript library and its own js and a css.The user needs to choose an mp3 file and define some custom options that are used by the javascript for certain play modes. What would be the best way to implement this? I am not sure if tags can use its own assets (JS, css)

Thanks
Carsten

A plugin that provides:

  • a custom kirbytag (HTML output)
  • css and js assets

For the options, they could be part of your kirbytag syntax, and you could output them as data attributes in the HTML:

<audio class="something"
  src="…" controls
  data-option1="x"
  data-option2="y"></audio>

And write your own short JS script that uses the JS lib to enhance this tag with the customized player.

1 Like