Working With Electron

Scope of support

Building desktop apps for Windows, macOS and Linux can be an essential part of your OTT strategy. Those apps can be published on the Windows Store or Mac App Store and this can significantly extend your reach. You can easely use Radiant Media Player in an Electron-based desktop app to achieve those goals.

Electron is a framework for creating native desktop applications with web technologies like JavaScript, HTML, and CSS. It runs on a local node.js server, uses Chromium browser as a basis for rendering web content and provides a complete set of API to access native desktop functionalities. Electron is an already popular and reliable framework and is used to build major desktop apps like Visual Studio Code or Skype.

In terms of concept Electron works very similarly to Cordova, the main difference is that with Cordova you can build iOS and Android mobile apps and with Electron you can build desktop apps for Windows, macOS and Linux.

Building Electron-based desktop apps with Radiant Media Player is only available to PLATFORM Edition customers.

Supported environments

Here are the requirements for using Radiant Media Player with Electron to build desktop apps:

  • Radiant Media Player 6+
  • Electron 15+

The list of supported OS for Electron 15+ can be found here and includes Windows 7+, macOS 10.11+, Ubuntu 14.04+, Fedora 24+ and Debian 8+.

Radiant Media Player could work with previous versions of Electron but they are untested.

Supported features

All player features available for the desktop web are generally available with Radiant Media Player used in an Electron-based desktop app. Below is a non-exhaustive list of features you can expect to be available or not:

Feature Support
MP4/WebM Progressive download
HTML5 video ads (2)
VOD, Live & DVR streaming
360 video
Autoplay (with audio) support
Widevine DRM (3)
Google Cast (4)
Offline download & playback (5)

Video ads support in Electron-based apps

We do support using video ads in an Electron-based app. However, it should be noted that since the HTML5 Google IMA SDK is not officially supported in an Electron app, the preferred solution is to use our VAST parser rmp-vast. If you are using Google Ads (Google Ad Manager, AdSense for Video) or looking for a feature that is supported with the IMA SDK but not with rmp-vast, we still recommend using the IMA SDK even in an Electron app. See this section for more information on using the IMA SDK in a Electron app. The VAST parser can be selected with player setting adParser set to 'ima' or 'rmp-vast'.

DRM support in Electron-based apps

See our working with Electron and DASH with Widevine DRM guide.

Offline playback of media content in Electron-based apps

We support download, storage and playback of offline content with DASH or fmp4-HLS streaming within an Electron-based apps. See our offline storage & playback docs.

Unsupported features:

  • Offline DRM licenses

Offline player starts are saved locally and push to our logging servers when an Internet connection becomes available.

Google Cast support in Electron-based apps

Since Chromium does not support the Google Cast API out of the box, we do not provide support for Google Cast in Electron-based apps. An unofficial Google Cast API wrapper exists and this may be helpful to implement Google Cast support in an Electron-based app outside of Radiant Media Player but this would fall outside our scope of support.

Walk-through using Radiant Media Player in an Electron based desktop app

We will use the electron-quick-start sample app to start with.

Once the electron-quick-start sample app is installed, we can install Radiant Media Player. While you could use our cloud player, we will use self-hosting for this walk-through to easily allow for offline playback case scenario. The structure of the electron-quick-start sample app should look like:

  • media/ - optional (you need to add this folder in your Electron project), here we could store our local/offline media content like MP4, HLS video or images
  • rmp/ - required if using self-hosting (you need to add this folder in your Electron project) - those are Radiant Media Player self-hosted files that can be downloaded in our back-end
  • index.html

Other folders and files are likely to be present but the above are those we need to focus on for now.

Now we will modify our index.html file to add Radiant Media Player:

<!DOCTYPE html>
  <meta charset="utf-8">
  <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
  <!-- Required Content-Security-Policy (CSP) - this is a loose example -->
  <meta http-equiv="Content-Security-Policy" content="default-src * blob: http: https: file: data: 'unsafe-inline' 'unsafe-eval';">
  <!-- Optional - including bootstrap CSS for nicer rendering -->
  <link rel="stylesheet" href="">
  <title>Hello RMP and Electron</title>

  <h1>Hello RMP and Electron</h1>
  <p>We are using Node.js <span id="node-version"></span>,
    Chromium <span id="chrome-version"></span>,
    and Electron <span id="electron-version"></span>.</p>
  <p>Here comes our player container</p>
  <div id="rmp"></div>
  <!-- Include player library -->
  <script src="./rmp/js/rmp.min.js"></script>
    // Our player settings
    const src = {
      // Here we load an online HLS resource
      hls: 'https://your-hls-url.m3u8'
    const settings = {
      licenseKey: 'your-license-key',
      src: src,
      width: 640,
      height: 360,
      // Referencing required self-hosted files
      pathToRmpFiles: './rmp/', 
      // if we need ads
      // ads: true,
      // rmp-vast is generally preferred in Electron apps to display ads
      // but if you are using Google ads servers (Google Ad Manager, AdSense for video), the IMA SDK is required 
      // see
      // adParser: 'rmp-vast',
      // adTagUrl: ''
    const rmp = new RadiantMP('rmp');

Content-Security-Policy meta tag: before packaging an electron app for production you should review the security docs from Electron and notably the Content Security Policy guidelines. In the above example we have included a loose declaration for the CSP meta tag:

<meta http-equiv="Content-Security-Policy" content="default-src * blob: http: https: file: data: 'unsafe-inline' 'unsafe-eval';">

The blob: part is required for Media Source Extensions streaming. The file: part is required to load local resources. The data: part is required to load some internal player resources (base64 splash poster).

For local/offline playback of media resources we shall simply referenced our content from the media/ folder

  // Our player settings
  const src = {
    // Here we load an local/offline HLS resource
    hls: './media/hls/playlist.m3u8',
    // We could also load a MP4 file (optional)
    mp4 : [
  const settings = {
    licenseKey: 'your-license-key',
    src: src,
    width: 640,
    height: 360,
    // Referencing required self-hosted files
    pathToRmpFiles: './rmp/', 
    // Here we load our local/offline poster
    contentMetadata: {
      poster: [
  const rmp = new RadiantMP('rmp');

App white-listing (PLATFORM Edition)

See our guide for mobile apps white-listing as it works the same for Electron-based desktop apps.

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

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