TypeScript Support

How to use Radiant Media Player in a TypeScript project?

With Radiant Media Player 7, it is now possible to use Radiant Media Player in a TypeScript project out of the box.

First download Radiant Media Player self-hosted package. Active customers can download the self-hosted package in our back-end. Trial users can contact us to obtain this package.

In the dist/ folder are two files, dist/rmp.min.d.mts and dist/rmp.min.d.ts. These files add types declaration respectively for rmp.module.js (Radiant Media Player as a ES2015 module) and rmp.min.js (Radiant Media Player as a standalone external library). Your TypeScript project should automatically recognized those typings files but you can also manually add rmp.min.d.mts or rmp.min.d.ts to your types folder in your TypeScript project).

Typings files can also be fetched from our cloud-player:

The rmp.min.d.mts and rmp.min.d.ts files are generated from JavaScript using JSDoc syntax.

Player code example

// import Radiant Media Player as a ES2015 module
import RadiantMP from './radiantmediaplayer/dist/rmp.module.js';

const rmp = new RadiantMP('rmp');
const settings = {
  licenseKey: 'your-license-key',
  src: { hls: 'https://your-hls-url' },
  width: 640,
  height: 360,
  pathToRmpFiles: './radiantmediaplayer/'

let timeupdateCount = 0;
rmp.on('timeupdate', () => {
  if (timeupdateCount === 10) {

In the above example you will see that player API methods like seekTo are properly recognized by TypeScript and that you can import the RadiantMP class without having to specify an any type on it.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 3.0 License.

©2015-2024 Radiant Media Player. All Rights Reserved.