### Initialize Player for Program Date Time
Source: https://www.radiantmediaplayer.com/docs/latest/hls-streaming.html
Example setup for a player instance to listen for meta events and retrieve program date time metadata.
```html
```
--------------------------------
### Initialize Player for SEI Metadata
Source: https://www.radiantmediaplayer.com/docs/latest/hls-streaming.html
Example setup for a player instance to listen for meta events and retrieve SEI packet data.
```html
```
--------------------------------
### Initialize Radiant Media Player with Playback Rate
Source: https://www.radiantmediaplayer.com/docs/latest/documentation.html
Example setup for the player including HLS source, license key, and enabled playback rate controls.
```html
```
--------------------------------
### Start Content Download
Source: https://www.radiantmediaplayer.com/docs/latest/offline-storage-playback.html
Initiates the download process for offline storage.
```javascript
rmp.download().then(() => {
console.log('download has completed');
}).catch(warning => {
console.warn(warning);
});
```
--------------------------------
### Implement Mutually Exclusive Playback
Source: https://www.radiantmediaplayer.com/docs/latest/gist/mutually-exclusive-playback/index.html
This example initializes three player instances and uses event listeners to pause the other two players whenever one starts playback. Ensure you replace 'your-license-key' with a valid license key.
```html
```
--------------------------------
### Initialize Player with Custom Labels
Source: https://www.radiantmediaplayer.com/docs/latest/international-player-labels.html
Example showing how to pass a custom labels object during player initialization.
```html
```
--------------------------------
### Initialize Live Audio-Only Player
Source: https://www.radiantmediaplayer.com/docs/latest/audio-only.html
Setup for live HLS audio-only streaming.
```html
```
--------------------------------
### Load Downloaded Item
Source: https://www.radiantmediaplayer.com/docs/latest/offline-storage-playback.html
Starts playback of a previously downloaded item.
```javascript
rmp.loadDownload(storedItem).then(() => {
console.log('loadDownload has completed');
}).catch(warning => {
console.warn(warning);
});
```
--------------------------------
### Module build self-hosting initialization
Source: https://www.radiantmediaplayer.com/docs/latest/player-builds.html
Example of importing the player as an ES2015 module when self-hosting files.
```javascript
// import Radiant Media Player as a ES2015 module
import RadiantMP from 'radiantmediaplayer/dist/rmp.min.mjs';
// HLS streaming source
const src = {
hls: 'https://your-live-hls-url.m3u8'
};
// Your player settings
const settings = {
licenseKey: 'your-license-key',
src,
width: 640,
height: 360,
pathToRmpFiles: 'radiantmediaplayer/',
contentMetadata: {
poster: [
'https://your-poster-url.jpg'
]
}
};
const elementID = 'rmp';
const rmp = new RadiantMP(elementID);
// Player initialisation
async function initRmpPlayer() {
try {
await rmp.init(settings);
} catch (error) {
console.error('Radiant Media Player failed to initialize', error);
}
}
initRmpPlayer();
```
--------------------------------
### Module build cloud-player initialization
Source: https://www.radiantmediaplayer.com/docs/latest/player-builds.html
JavaScript initialization code for the cloud-player module setup.
```javascript
// main.js
// import Radiant Media Player as a ES2015 module (cloud-player)
import RadiantMP from 'rmp';
// HLS streaming source
const src = {
hls: 'https://your-live-hls-url.m3u8'
};
// Your player settings
const settings = {
licenseKey: 'your-license-key',
src,
width: 640,
height: 360,
contentMetadata: {
poster: [
'https://your-poster-url.jpg'
]
}
};
const elementID = 'rmp';
const rmp = new RadiantMP(elementID);
// Player initialisation
async function initRmpPlayer() {
try {
await rmp.init(settings);
} catch (error) {
console.error('Radiant Media Player failed to initialize', error);
}
}
initRmpPlayer();
```
--------------------------------
### Compute player load and startup performance
Source: https://www.radiantmediaplayer.com/docs/latest/api-documentation.html
Example demonstrating how to measure library load time, player readiness, and startup time using event listeners.
```html
```
--------------------------------
### Get preload configuration
Source: https://www.radiantmediaplayer.com/docs/latest/api-documentation.html
Returns the preload mode used for player start up.
```javascript
const preload = rmp.preloadConfiguration;
```
--------------------------------
### Get current DVR time
Source: https://www.radiantmediaplayer.com/docs/latest/dvr-streaming.html
Retrieves the relative time from the start of the current DVR window in milliseconds.
```javascript
const currentTime = rmp.currentTime;
```
--------------------------------
### Initialize Player with Interactive Transcripts
Source: https://www.radiantmediaplayer.com/docs/latest/interactive-transcripts.html
Full implementation example including the required HTML container structure and JavaScript initialization with transcript settings.
```html
```
--------------------------------
### Initialize Radiant Media Player with a custom module
Source: https://www.radiantmediaplayer.com/docs/latest/player-modules.html
Demonstrates the full setup including player initialization and passing a single custom module via the settings object.
```html
```
--------------------------------
### Module build cloud-player HTML setup
Source: https://www.radiantmediaplayer.com/docs/latest/player-builds.html
HTML structure using an importmap to map the player module for cloud-based hosting.
```html
My video app
```
--------------------------------
### Get or set active audio track
Source: https://www.radiantmediaplayer.com/docs/latest/api-documentation.html
Use these methods to get or set the ID of the active audio track.
```javascript
const audioTrack = rmp.audioTrack;
```
```javascript
rmp.audioTrack = 1;
```
--------------------------------
### Radiant Media Player Initialization with Custom Icons
Source: https://www.radiantmediaplayer.com/docs/latest/player-skins.html
Example showing how to include the player script and configure the customIconsLoc setting within the player initialization.
```html
```
--------------------------------
### init(settings)
Source: https://www.radiantmediaplayer.com/docs/latest/api-documentation.html
Initializes the player with the provided settings object.
```APIDOC
## init(settings)
### Description
Starts player initialisation. Returns a Promise that resolves if initialization was successful or rejects to an ErrorData Object.
### Parameters
- **settings** (RadiantMediaPlayerSettings) - Required - The player configuration object.
```
--------------------------------
### Google IMA Ad Tag Example
Source: https://www.radiantmediaplayer.com/docs/latest/video-ads-documentation.html
Example of an ad tag URL configured for use with the Google IMA SDK.
```text
https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dlinear&url=%5Breferrer_url%5D&correlator=%5Btimestamp%5D&description_url=__page-url__
```
--------------------------------
### loadDownload(storedItem)
Source: https://www.radiantmediaplayer.com/docs/latest/offline-storage-playback.html
Starts playback of a previously downloaded item.
```APIDOC
## loadDownload(storedItem)
### Description
Starts playback for a stored item. When playback starts, the player fires a 'playing' event.
### Parameters
- **storedItem** (Object) - The downloaded item object retrieved from listDownloadedContent.
```
--------------------------------
### Initialize Radiant Media Player with rmp-vast
Source: https://www.radiantmediaplayer.com/docs/latest/video-ads-api-rmp-vast.html
This example demonstrates how to include the player script, configure settings for VAST ads, and register event listeners for ad lifecycle tracking.
```html
```
--------------------------------
### Implement Companion Ads with rmp-vast
Source: https://www.radiantmediaplayer.com/docs/latest/companion-ads.html
Example showing how to initialize the player and use the adstarted event to retrieve and append a companion ad to the DOM.
```html
```
--------------------------------
### hlsStartLoad()
Source: https://www.radiantmediaplayer.com/docs/latest/api-documentation.html
Method to start or restart the playlist/fragment loading process.
```APIDOC
## hlsStartLoad()
### Description
Allows to start/restart the playlist/fragment loading process. Should be called after the manifestparsed event has fired.
### Usage
```javascript
rmp.hlsStartLoad();
```
```
--------------------------------
### Manage Mute State
Source: https://www.radiantmediaplayer.com/docs/latest/api-documentation.html
Get or set the muted state of the player.
```javascript
const mute = rmp.mute;
```
```javascript
rmp.mute = true;
```
--------------------------------
### Player Configuration for WebVTT Chapters
Source: https://www.radiantmediaplayer.com/docs/latest/chapters.html
Example showing how to initialize the player with the chaptersLoc setting. The WebVTT file must be served with appropriate CORS headers.
```html
```
--------------------------------
### Get app name
Source: https://www.radiantmediaplayer.com/docs/latest/api-documentation.html
Returns the current appName set for the player.
```javascript
const appName = rmp.appNameConfiguration;
```
--------------------------------
### Initialize Player with Closed Captions
Source: https://www.radiantmediaplayer.com/docs/latest/closed-captions-documentation.html
Full implementation example including script inclusion, player container, configuration settings, and asynchronous initialization.
```html
```
--------------------------------
### Manage content metadata
Source: https://www.radiantmediaplayer.com/docs/latest/api-documentation.html
Get or set the content metadata object.
```javascript
const contentMetadata = rmp.contentMetadataConfiguration;
```
```javascript
rmp.contentMetadataConfiguration = {
title,
description,
poster
};
```
--------------------------------
### Manage waiting UI
Source: https://www.radiantmediaplayer.com/docs/latest/api-documentation.html
Get or set the player waiting mode.
```javascript
const waitingUI = rmp.waitingUI;
```
```javascript
rmp.waitingUI = true;
```
--------------------------------
### Manage loop configuration
Source: https://www.radiantmediaplayer.com/docs/latest/api-documentation.html
Get or set the player loop mode.
```javascript
const loopConfiguration = rmp.loopConfiguration;
```
```javascript
rmp.loopConfiguration = true;
```
--------------------------------
### Get stream type
Source: https://www.radiantmediaplayer.com/docs/latest/api-documentation.html
Returns the currently loaded streaming protocol.
```javascript
const streamType = rmp.streamType;
```
--------------------------------
### rmp.init(settings)
Source: https://www.radiantmediaplayer.com/docs/latest/api-documentation.html
Initializes the player with the provided configuration settings.
```APIDOC
## rmp.init(settings)
### Description
Asynchronously initializes the player instance with the specified configuration object.
### Parameters
- **settings** (object) - Required - Configuration object containing licenseKey, src, width, height, and other player settings.
### Returns
- **Promise** - Resolves when the player is ready for API calls.
```
--------------------------------
### Manage playback state
Source: https://www.radiantmediaplayer.com/docs/latest/api-documentation.html
Get or set the player paused state.
```javascript
const paused = rmp.paused;
```
```javascript
rmp.paused = true;
```
--------------------------------
### init(settings)
Source: https://www.radiantmediaplayer.com/docs/latest/api-documentation.html
Initializes the Radiant Media Player instance with the provided settings.
```APIDOC
## init(settings)
### Description
Initializes the player. This method returns a Promise that resolves when the player is ready or rejects with an ErrorData object if initialization fails.
### Method
Method call on `rmp` instance.
### Parameters
- **settings** (Object) - Required - Configuration object for the player.
### Request Example
```javascript
try {
await rmp.init(settings);
} catch (error) {
console.log(error.code);
console.log(error.message);
}
```
```
--------------------------------
### Get player version
Source: https://www.radiantmediaplayer.com/docs/latest/api-documentation.html
Retrieve the current player version string.
```javascript
const playerVersion = rmp.playerVersion;
```
--------------------------------
### download()
Source: https://www.radiantmediaplayer.com/docs/latest/offline-storage-playback.html
Requests the player to start downloading content for offline storage.
```APIDOC
## download()
### Description
Returns a Promise that resolves when the download request has completed or rejects with a WarningData object. The 'downloadcompleted' event fires when finished, while 'downloadstarted' and 'downloadprogress' provide status updates.
```
--------------------------------
### Initialize Radiant Media Player for Frame-Accurate Seeking
Source: https://www.radiantmediaplayer.com/docs/latest/frame-accurate-seeking.html
This example demonstrates how to configure the player with necessary settings like forceMseHlsOnAppleDevices and use the seekToFrame method once the player is playing.
```html
```
--------------------------------
### Initialize Radiant Media Player
Source: https://www.radiantmediaplayer.com/docs/latest/api-documentation.html
Basic setup including script inclusion, container definition, and player initialization with configuration settings.
```html
```
--------------------------------
### RadiantMP.init(settings)
Source: https://www.radiantmediaplayer.com/docs/latest/documentation.html
Initializes the Radiant Media Player instance with a configuration object.
```APIDOC
## RadiantMP.init(settings)
### Description
Initializes the player with provided settings, including source, license key, and playback configurations.
### Parameters
- **settings** (Object) - Required - Configuration object containing player settings such as `licenseKey`, `src`, `speed`, `speedRates`, and `contentMetadata`.
```
--------------------------------
### livePresentationStartTimeAsDate
Source: https://www.radiantmediaplayer.com/docs/latest/live-dvr-streaming.html
Getter to retrieve the presentation start time of the live stream.
```APIDOC
### livePresentationStartTimeAsDate
#### Description
Returns the presentation start time date for the live stream as an ISO/IEC 8601:2004 string. Returns an empty string if not available.
#### Return Type
String
```
--------------------------------
### Initialize Radiant Media Player with FairPlay Streaming
Source: https://www.radiantmediaplayer.com/docs/latest/fairplay-drm-documentation.html
Basic implementation using the Apple reference sample pattern. Requires providing the HLS URL, server certificate URL, and processSPC URL within the fpsDrm configuration object.
```html
```
--------------------------------
### Get Ad Duration
Source: https://www.radiantmediaplayer.com/docs/latest/video-ads-api.html
Returns the total duration of the linear advertisement in milliseconds.
```javascript
rmp.adDuration;
```
--------------------------------
### Manage controls visibility
Source: https://www.radiantmediaplayer.com/docs/latest/api-documentation.html
Get or set whether player controls are visible.
```javascript
const controlsVisible = rmp.controlsVisible;
```
```javascript
rmp.controlsVisible = false;
```
--------------------------------
### Initialize Player and Overlay Logic
Source: https://www.radiantmediaplayer.com/docs/latest/player-modules.html
Include the player script and initialize the player instance, then append the custom overlay element to the player container with dynamic data updates.
```javascript
```
--------------------------------
### Implement Ad Error Event Handling
Source: https://www.radiantmediaplayer.com/docs/latest/video-ads-api-rmp-vast.html
Full example demonstrating player initialization and listening for the aderror event to query error details.
```html
```
--------------------------------
### Manage controls availability
Source: https://www.radiantmediaplayer.com/docs/latest/api-documentation.html
Get or set whether player controls are available.
```javascript
const controls = rmp.controls;
```
```javascript
rmp.controls = false;
```
--------------------------------
### AudioTrack object structure
Source: https://www.radiantmediaplayer.com/docs/latest/api-documentation.html
Example of the properties contained within an AudioTrack object.
```json
{
active: true, // Boolean: if the current audio track active or not
id: 0, // Number: the audio track id
language: "en" // String: language code for the audio track
}
```
--------------------------------
### Configure Bitmovin Analytics and Handle Source Changes
Source: https://www.radiantmediaplayer.com/docs/latest/bitmovin-analytics.html
Demonstrates initializing the player with Bitmovin Analytics settings and updating the analytics configuration dynamically during a source change event.
```javascript
const src = {
hls: 'https://your-hls-url.m3u8'
};
const analyticsConfig = {
key: 'your-bitmovin-key',
videoId: 'your-video-id',
title: 'your-video-title'
};
const settings = {
licenseKey: 'your-radiant-media-player-key',
src,
width: 640,
height: 360,
autoplay: true,
// Pass Bitmovin Analytics settings
bitmovinAnalyticsConfig: analyticsConfig
};
const rmp = new RadiantMP('rmp');
// Example for changing source with a delay
setTimeout(() => {
rmp.setSrc({
hls: 'https://your-new-hls-url.m3u8'
}).then(() => {
console.log('setSrc has completed');
}).catch(warningOrError => {
// something went wrong with setSrc - it could be fatal error or warning
if (warningOrError.code < 1000) {
// this is a fatal error
console.error(warningOrError);
} else {
// this is just a warning
console.warn(warningOrError);
}
});
}, 10000);
const container = document.getElementById('rmp');
rmp.on('srcchanging', () => {
// Example for checking the current bitmovinAnalyticsConfig setting
let analytics = rmp.bitmovinAnalyticsConfiguration;
console.log(analytics);
// Set new bitmovinAnalyticsConfig just before the source change moves forward - e.g. srcchanging API event
rmp.bitmovinAnalyticsConfiguration = {
key: 'your-bitmovin-key', // Note you need to pass your Bitmovin key each time you call bitmovinAnalyticsConfiguration setter
videoId: 'your-new-video-id',
title: 'your-new-video-title'
};
// If needs be we can check the new bitmovinAnalyticsConfig object
analytics = rmp.bitmovinAnalyticsConfiguration;
console.log(analytics);
});
// Initialization ... and done!
async function initRmpPlayer() {
try {
await rmp.init(settings);
} catch(error) {
console.error('Radiant Media Player failed to initialize', error);
}
}
initRmpPlayer();
```
--------------------------------
### Quality object structure
Source: https://www.radiantmediaplayer.com/docs/latest/api-documentation.html
Example of the properties contained within a Quality object.
```json
{
active: true, // Boolean: if the current audio track active or not
audioCodec: "mp4a.40.2", // String: the audio codec name when available
bitrate: 727221, // Number: the bandwidth in bps required to the play the current rendition
height: 360, // Number: the height in px of the rendition (not available for audio-only feed)
id: 0, // Number: the bitrate id
videoCodec: "avc1.4d401e", // String: the video codec name when available (not available for audio-only feed)
width: 640 // Number: the width in px of the rendition (not available for audio-only feed)
}
```