0.0.15 • Published 9 months ago
@kinescope/player-iframe-api-loader v0.0.15
Kinescope Player Iframe API Loader
A simple loader of JavaScript files (Iframe API) and TypeScript types who uses Kinescope Player Iframe API.
Installation
npm install --save @kinescope/player-iframe-api-loader
# or
yarn add @kinescope/player-iframe-api-loader
Features
The loader replaces standard way of loading and using Iframe API such as onKinescopeIframeAPIReady
callback.
Also the library contains TypeScript type definitions. It is possible to use only TypeScript types without loader.
Example:
import * as iframeApiLoader from '@kinescope/player-iframe-api-loader';
// Load the latest stable version.
const factory = await iframeApiLoader.load();
// Create the player. Look at the docs, the link below.
const player = await factory.create(...);
Using only types:
import '@kinescope/player-iframe-api-loader/types';
const factory = window.Kinescope?.IframePlayer;
if (factory) {
const player = await factory.create(...);
}