RadioKit Toolkit JS: Broadcast Metadata
Options
All
  • Public
  • Public/Protected
  • All
Menu

RadioKit JS Toolkit: Broadcast Metadata

High-level JavaScript API for querying metadata of RadioKit-powered channels.

Usage

Compatibility

  • For IE9 and older compatibility use any Promise polyfill.
  • For IE8 compatibility use ES5-shim.

Code Example

In the web browser:

var metadataListener = new window.RadioKit.Toolkit.Broadcast.Metadata.MetadataListener("your_access_token", "fd9a7d1c-a387-40a0-b876-2799668d6f9d");

metadataListener.setUpdateCallback(function(metadata) { 
    console.log("Metadata: ", metadata); 
});

metadataListener.setPositionCallback(function(position, duration) { 
    console.log("Position: ", position, "Duration: ", duration); 
});

metadataListener.start()
    .then(function() { 
        console.log("Started");
    })
    .catch(function(reason) {
         console.warn("Failed", reason);
    });

In the Node.JS:

import { MetadataListener } from 'radiokit-toolkit-metadata-broadcast';

const metadataListener = new MetadataListener("your_access_token", "fd9a7d1c-a387-40a0-b876-2799668d6f9d");

metadataListener.setUpdateCallback((metadata) => console.log("Metadata: ", metadata));

metadataListener.setPositionCallback((position, duration) => console.log("Position: ", position, "Duration: ", duration));

metadataListener.start()
    .then(() => console.log("Started"))
    .catch((reason) => console.warn("Failed", reason));

Demo

See demo

The repository contains some simple demo in the demo/ subdirectory.

  • Clone the repository
  • Enter demo/ subdirectory.
  • Run simple webserver from it, e.g.: python -m SimpleHTTPServer
  • Open http://localhost:8000/ in your web browser.

Documentation

See docs

Documentation is located in the docs/ subdirectory.

It can be rebuilt by running gulp typedoc after cloning the repository.

Development

Preparing environment

  • Clone the repo
  • Enter dir with the project
  • Install NPM packages: npm install (you can use also yarn install)
  • Install TypeScript interpreter

Building browser bundle

  • Type npm run browser

Browser-compatible version will be located in dist/browser/.

Authors

Marcin Lewandowski marcin@radiokit.org

License

MIT

Index

External modules

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc