jessuni / shikwasa

An audio player born for podcast
https://shikwasa.js.org
MIT License
476 stars 30 forks source link

[feature request] Customizable player templates #59

Open cgpro opened 2 years ago

cgpro commented 2 years ago

It would be a very handy feature to make the player templates customizable.

The player is based on templates already: https://github.com/jessuni/shikwasa/tree/main/src/templates But it's referenced internally at the moment.

I could imagine the following:

const TemplateChapter = `... my fancy markup ...`
const TemplateIcon = `...`
const TemplatePlayer = `...`

// or with an import (a bit cleaner)
import { TemplateChapter, TemplateIcon, TemplatePlayer  } from './shikwasa-templates.js';

const player = new Shikwasa({
    container: () => document.querySelector('.shikwasa-player'),
    tplChapter: TemplateChapter,
    tplIcon: TemplateIcon,
    tplPlayer: TemplatePlayer,
    audio: {
        title: '...', 
        artist: '...',
        cover: '...',
        src: '...',
        },
});

Sometimes it is necessary to change the icons or change the structure of the layout fundamentally, which would be easy to do in this case.

travisvn commented 1 year ago

This would be awesome 👍

rolandschuetz commented 11 months ago

Implemented with https://github.com/jessuni/shikwasa/pull/84