From 4375ee399f97ae6c83552e92d1ac13d8b1eb6d97 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Mon, 7 Oct 2024 16:11:13 +0500 Subject: [PATCH] docs: Add README --- README.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..2f949fb --- /dev/null +++ b/README.md @@ -0,0 +1,45 @@ +# Kinescope Player Iframe API Loader + +[![npm package](https://img.shields.io/npm/v/@kinescope/player-iframe-api-loader.svg?style=flat-square)](https://www.npmjs.org/package/@kinescope/player-iframe-api-loader) + +A simple loader of JavaScript files ([Iframe API](https://docs.kinescope.io/player/latest/)) and TypeScript types who uses Kinescope Player Iframe API. + +## Installation + +```shell +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: + +```ts +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: + +```ts +import '@kinescope/player-iframe-api-loader/types'; + +const factory = window.Kinescope?.IframePlayer; +if (factory) { + const player = await factory.create(...); +} + +``` + +> Player embedding docs: https://docs.kinescope.io/player/latest/iframe/IframePlayerFactory.html#create