Radiant Media Player
Install QUANTEEC for Radiant Media Player
3 steps:
- CDN
- NPM
1- Import the QUANTEEC library for Radiant Media Player into your webpage:
<script src="https://files.quanteec.com/quanteec/latest/quanteec-radiantmediaplayer.min.js"></script>
1- After installing the QUANTEEC npm repo, import the QUANTEEC library for Radiant Media Player :
import Quanteec from "@quanteec/quanteec-plugin/quanteec-radiantmediaplayer.min.js"
2- Adjust the QUANTEEC configuration to your quanteecKey and specific options:
var quanteecConfig = {
quanteecKey: "<your-quanteec-key>"
};
To create a new QUANTEEC configuration and/or retrieve your default QUANTEEC key, you must first go to the Config page of your panel.
A complete description of the possible options of the quanteecConfiguration object can be found here.
In your QUANTEEC configuration, remember to set a different videoID if you have different formats of the same stream (e.g., one DASH stream and one HLS stream) or two variants of the same stream (one stream with English audio and one stream with another language).
3- Link QUANTEEC to Radiant Media Player right after the setup of the Radiant Media Player instance:
const rmp = new RadiantMP('rmp');
new Quanteec(quanteecConfig, rmp, function(quanteecPlayer) {
console.log(quanteecPlayer);
})
QUANTEEC Loading order
The creation of the QUANTEEC object with new Quanteec must be executed BEFORE the launch of the video by the player. Be careful to not create it AFTER rmp.init, for example, by calling it asynchronously
Here is a complete example of the use of QUANTEEC with Radiant Media Player:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="initial-scale=1, width=device-width, viewport-fit=cover">
<title>TODO supply a title</title>
<!-- 1- Include QUANTEEC library in your <head> -->
<script src="https://files.quanteec.com/quanteec/latest/quanteec-radiantmediaplayer.min.js"></script>
<!-- Include Radiant Media Player library in your <body> or <head> -->
<script src="https://cdn.radiantmediatechs.com/rmp/9.6.2/js/rmp.min.js"></script>
</head>
<body>
<!-- Player container element -->
<div id="rmp"></div>
<!-- Set up player configuration options -->
<script>
// 2- Adjust QUANTEEC configuration
var quanteecConfig = {
quanteecKey: "<your-quanteec-key>",
videoID: "<enter-your-custom-videoID>" // [Optional but recommended] String --> specific name to identify a video. Useful if the videosource url contains a token which is different for every user. By default: the videoSource value is used.
};
// Streaming source - HLS
const src = {
hls: "https://your-hls-url.m3u8", // Or dash: "https://your-dash-url.mpd"
};
// Then we set Radiant Media Player player settings
const settings = {
licenseKey: 'your-license-key',
src: src,
width: 640,
height: 360,
forceHlsJSOnMacOSSafari: true,
forceHlsJSOnIpadOS: true,
autoplay: true
};
const rmp = new RadiantMP('rmp');
// 3- Link QUANTEEC to Radiant Media Player right **after** the setup of the Radiant Media Player instance, protected by a try catch
var quanteecPlayer = null;
try {
new Quanteec(quanteecConfig, rmp, function(returnedQuanteecPlugin) {
quanteecPlayer = returnedQuanteecPlugin;
})
} catch (err) {
// If QUANTEEC is not available or an unusual issue occurs
}
rmp.init(settings);
</script>
</body>
</html>
Good practice: try-catch block
One good practice is to encapsulate the instantiation of the QUANTEEC object within a try-catch block. This approach provides a robust mechanism for handling situations where QUANTEEC might not be available or may encounter compatibility issues.
Script loading
Embedding QUANTEEC on a webpage involves loading an external script. If, for any reason, this script fails to load or execute correctly, an error may occur. Wrapping the instantiation of the QUANTEEC object in a try-catch block allows you to catch and handle these errors gracefully.
Unusual environments
Web environments are diverse, and unusual browsers or plugin associations might cause issues with QUANTEEC. By encapsulating the new Quanteec() operation in a try-catch block, you can account for scenarios where QUANTEEC is either unavailable or incompatible with the current browser, preventing unhandled exceptions.