This is a library that allows you to embed a podcast in your web page.
- Provide a podcast URL, see a podcast rendered
- Total library size is
~4.5kb
- Optionally provide a limit to the number of episodes displayed
- Each episode has its own audio player
Note: To parse the RSS/podcast/XML feed into usable JSON, the podcast is loaded through Narro (using a simple pass of the rss-parser library). This avoids bloating the client library with an RSS parser.
- Create an element on your page with the class
pb-embed
and attributedata-feed="<podcast-url-here>"
. - Include the
bundle.js
either in your own compiled js or as ascript
tag before thebody
closing tag. - Optionally, provide your own styling of the embed (see
./example/example.css
). - Optionally, provide an attribute of
data-limit="<some number>"
to limit the number of episodes displayed.
// Initialize all nodes with class 'pb-embed' on the page
pb.init();
// Initialize an embedded feed inside a given DOM node
var node = document.querySelector('#myId');
var embed = pb.createEmbed(node);
// Initialize an embedded feed inside a given DOM node, with a feed URL
var feed = 'http://mypodcast.com/feed.xml';
embed = pb.createEmbed(node, feed);
// Reload a given feed/embed
embed.reload();
See https://github.com/NarroApp/Pb/tree/master/example
<div class="pb-embed" data-feed="http://on.narro.co/foobar" data-limit="5">
</div>
Working usage: https://narroapp.github.io/Pb/