@bcaster/bcaster-feed-widget
v0.0.4
Published
An embeddable web widget for showing bcaster feed items
Downloads
7
Readme
bcaster-feed-widget
An Embeddable web widget for media feeds powered by Bcaster
Getting Started
The BCaster Feed Widget can be accessed via CDN UNPKG or CDN JSDELIVR as well as NPM. When imported via CDN, it exposes a global BCasterFeedWidget
which accepts configuration arguments
Example Usage
To get the BCaster Feed Widget working, copy any of the following code snippet examples that apply, into your web project and replace the appId value with your unique bcaster lite app Id
⚠️ In order for the widget to mount, you are required to have an empty div with an id
bcaster-feed-widget
in your html page. The div should be on the page before themount
event is triggered
<div id="bcaster-feed-widget"></div>
Embedding via CDN
<script src="https://unpkg.com/@bcaster/[email protected]/dist/bcaster-feed-widget.js"></script>
<script>
const feedWidget = new BCasterFeedWidget({
apiKey: '53d83cs45-1csauy-47c5sfde-80ffad8-45eefsds031de',
apiSecret: '7632vqeldh286vqis89112s5d7vd2938d29dbd286d98b2',
feedId: '5623dxq65d2o9a9u02h29h',
});
feedWidget.mount();
</script>
Embedding via NPM (ES5 and older)
First install the package by running
npm install @bcaster/bcaster-feed-widget
oryarn add @bcaster/bcaster-feed-widget
const BCasterFeedWidget = require('@bcaster/bcaster-feed-widget');
const feedWidget = new BCasterFeedWidget({
apiKey: '53d83cs45-1csauy-47c5sfde-80ffad8-45eefsds031de',
apiSecret: '7632vqeldh286vqis89112s5d7vd2938d29dbd286d98b2',
feedId: '5623dxq65d2o9a9u02h29h',
});
feedWidget.mount();
Embedding via NPM (ES6 and later)
First install the package by running
npm install @bcaster/bcaster-feed-widget
oryarn add @bcaster/bcaster-feed-widget
import BCasterFeedWidget from '@bcaster/bcaster-feed-widget';
const feedWidget = new BCasterFeedWidget({
apiKey: '53d83cs45-1csauy-47c5sfde-80ffad8-45eefsds031de',
apiSecret: '7632vqeldh286vqis89112s5d7vd2938d29dbd286d98b2',
feedId: '5623dxq65d2o9a9u02h29h',
});
feedWidget.mount();
Configuration Options
The Bcaster Feed widget library exposes a default BCasterFeedWidget Javascript class which accepts configuration options in the form of a standard Javascript Object. The configuration options signature are as follows
@param {Object} args Configuration values
@param {String} args.apiKey (Required) The client api key
@param {String} args.apiSecret (Required) The client api secret
@param {String} args.feedId (Required) The ID of a given feed
@param {String} args.mode (Optional) {Defaults to 'production'} Mode option for switching between development and production. This option allows the possibility to run in a sandbox environment
@param {Number || String} args.numOfItems (Optional) {defaults to 20} The number of items to be displayed as an embeded feed
@param {String} args.lang (Optional) {Defaults to 'en'} Language attribute for localization
@param {Object} [args.divStyle] (Optional) Configuration values for the feed div style
@param {Number} [args.divStyle.height] (Optional) {Defaults to 200} Height for the media feed div {unit value in `px`}
@param {Number} [args.divStyle.width] (Optional) Width for the media feed div {unit value in `%`}
@param {String} [args.divStyle.orientation] (Optional) {Defaults to 'vertical'} The orientation of the feed div scrolling direction i.e. (either 'vertical' or 'horizontal')
@example
const feedWidget = new BCasterFeedWidget({
apiKey: '53d83cs45-1csauy-47c5sfde-80ffad8-45eefsds031de',
apiSecret: '7632vqeldh286vqis89112s5d7vd2938d29dbd286d98b2',
feedId: '5623dxq65d2o9a9u02h29h',
mode: 'development',
numOfItems: 20,
lang: 'en',
});
Supported Languages
Currently the following language options are supported
en
- Englishfi
- Finnish
CHANGELOG
Version 0.0.1
- Bcaster Feed Web embeddable widget
Version 0.0.2
- Map
esc
key to closing the modal to ensure accessibility.
Version 0.0.3
- Update media card styles -
margins
.
Version 0.0.4
- Add Upload Type and Media Viewer Link to Overview Modal.