@bcaster/bcaster-feed-widget

0.0.4 • Public • Published

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 the mount event is triggered

<div id="bcaster-feed-widget"></div>

Embedding via CDN

<script src="https://unpkg.com/@bcaster/bcaster-feed-widget@0.0.4/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 or yarn 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 or yarn 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 - English
  • fi - Finnish

CHANGELOG

Version 0.0.1

  1. Bcaster Feed Web embeddable widget

Version 0.0.2

  1. Map esc key to closing the modal to ensure accessibility.

Version 0.0.3

  1. Update media card styles - margins.

Version 0.0.4

  1. Add Upload Type and Media Viewer Link to Overview Modal.

Readme

Keywords

Package Sidebar

Install

npm i @bcaster/bcaster-feed-widget

Weekly Downloads

0

Version

0.0.4

License

ISC

Unpacked Size

63.2 kB

Total Files

24

Last publish

Collaborators

  • ajcity
  • kenigbolo