Radiant Media Player

Working with Ionic framework

Guide sections

Get started with Ionic framework

Ionic framework provides tools and services for developing native and progressive web apps with ease using web technologies like JavaScript, CSS, HTML5 and Sass.

It is based on Apache Cordova and Angular. Radiant Media Player can be used in with any Cordova-based framework and as such we support using Radiant Media Player with Ionic framework. You may want to take on our working with Cordova guide for more information on how to use Radiant Media Player in a Cordova-based application.

Using Radiant Media Player with Ionic framework requires a PLATFORM Edition license key.

Scope of support

We support the following environments for using Radiant Media Player with Ionic framework:

  • Ionic framework 3+
  • Android 5+
  • iOS 10+ (WKWebView)
  • iPadOS 13+ (WKWebView)

When using Radiant Media Player in a production Ionic-based application we recommend using self-hosting of player files within the application for better performance. Active customers can download the self-hosted package in our back-end. Trial users can use the cloud player for testing purposes.

With the announcement of Apple in december 2019, to remove support for UIWebView API by end 2020, we only support WKWebView API for iOS apps built with Cordova or Ionic. See this blog post to help you update to WKWebView API.

Installing Ionic framework

In this guide we will review how to add Radiant Media Player to a simple Ionic Framework based application.

We can start with Ionic Framework get started and install it along with cordova. This command line will install the latest available version for each component:

npm install -g cordova ionic

After that we will start a simple application using the Ionic Framework "tabs" template:

ionic start myApp tabs

We can test our "tabs" application in our favorite browser

cd myApp
ionic serve

This mode can help us to kick start our development before testing and deploying on an actual device.

This guide is not a comprehensive guide on how to build a media-oriented mobile application with Ionic Framework - it is just intended to lay some common grounds to make sure Radiant Media Player can be used in such an application.

Developing our application

Now that we are all set we can start exploring our "tabs" application. In our myApp directory we should have something that looks like:

  • hooks/
  • node_modules/
  • platforms/
  • plugins/
  • resources/
  • src/
  • www/
  • config.xml
  • ionic.config.json
  • package.json
  • tsconfig.json
  • tslint.json

We should also have some git related files/folders and a README.md.

In order to add Radiant Media Player to our "tabs" application we will work in the src/ folder. This folder should look like:

  • app/
  • assets/
  • pages/
  • theme/
  • index.html
  • manifest.json
  • service-worker.js

First we will open the index.html file to add Radiant Media Player JavaScript library:

In this example we use Radiant Media Player self-hosted player files. For the purpose of this guide those files were put under the assets/rmp/ folder (this folder was not created by Ionic). While it is also possible possible to use our cloud player it is generally best to host the player files within the application itself when going for production for best performance.

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <meta charset="UTF-8">
  <title>Ionic App</title>
  <meta name="viewport" content="initial-scale=1, width=device-width, viewport-fit=cover">
  <meta name="format-detection" content="telephone=no">
  <meta name="msapplication-tap-highlight" content="no">
  <link rel="icon" type="image/x-icon" href="assets/icon/favicon.ico">
  <link rel="manifest" href="manifest.json">
  <meta name="theme-color" content="#4e8ef7">
  <script src="cordova.js"></script>
  <link href="build/main.css" rel="stylesheet">
  <!-- Here we add Radiant Media Player JavaScript library -->
  <script type="text/javascript" src="assets/rmp/js/rmp.min.js"></script>

  <script src="build/polyfills.js"></script>
  <script src="build/vendor.js"></script>
  <script src="build/main.js"></script>

Now we will head towards the pages/home/ folder in which we should find:

  • home.html
  • home.scss
  • home.ts

In home.html we will add our player container:


<ion-content padding>
  <h2>Welcome to RMP + Ionic!</h2>
    This starter project comes with simple tabs-based layout for apps
    that are going to primarily use a Tabbed UI. It also holds a super cool 
    video displayed with Radiant Media Player on its home page.
  <!-- Here comes our player container -->
  <div id="rmpPlayer"></div>

In home.ts we will add our player logic:

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';

// We need to decalre our global RadiantMP constructor 
declare const RadiantMP: any;

  selector: 'page-home',
  templateUrl: 'home.html'

export class HomePage {

  elementID: string = 'rmpPlayer';
  rmp: any = null;

  constructor(public navCtrl: NavController) {


  // When home page comes into view we play our player
  ionViewDidEnter() {
    if (this.rmp && this.rmp.getReady()) {

  // When we leave home page for another page we pause our player
  ionViewWillLeave() {
    if (this.rmp && this.rmp.getReady()) {

  // When home page initially loads we configure and init our player
  ionViewDidLoad() { 
    var src = {
      hls: 'https://your-hls-url.m3u8'
    var settings = { 
      licenseKey: 'your-license-key',
      src: src,
      width: 640,
      height: 360,
      autoplay: true,
      pathToRmpFiles: 'assets/rmp/',
      // if we need ads
      // ads: true,
      // rmp-vast is generally preferred in Cordova-based apps to display ads
      // but if you are using Google ads servers (DFP, AdSense, AdX), the IMA SDK is required
      // see https://www.radiantmediaplayer.com/docs/latest/mobile-applications.html#mobile-video-ads
      // adParser: 'rmp-vast',
      // adTagUrl: 'https://www.radiantmediaplayer.com/vast/tags/inline-linear.xml',
      contentMetadata: {
        poster: [
    this.rmp = new RadiantMP(this.elementID);

    // handle "tabs" in fullscreen mode
    var rmpContainer = document.getElementById(this.elementID);
    var FW = this.rmp.getFramework();
    var bottomTabBar;
    rmpContainer.addEventListener('enterfullscreen', function () {
      if (!bottomTabBar) {
        bottomTabBar = <HTMLElement>document.querySelector('.tabbar.show-tabbar');
      FW.addClass(bottomTabBar, 'rmp-no-display');
    rmpContainer.addEventListener('exitfullscreen', function () {
      if (!bottomTabBar) {
        bottomTabBar = <HTMLElement>document.querySelector('.tabbar.show-tabbar');
      FW.removeClass(bottomTabBar, 'rmp-no-display');


You can download a src folder example here.

Testing and deploying

Now that our app includes our player we can start testing it. We can use ionic serve to live develop and test our application in a desktop browser.

To test on a device we will need some Android and iOS specific tools. Follow this Ionic Framework guide to install the requirements for testing and deploying your application.

Then for Android we can use ionic cordova run android --device to test our application on an actual Android device.

For iOS we can use ionic cordova run ios --device.

Deploying to iOS specific considerations

We assume you have followed the above Ionic Framework guide for deploying on iOS and that you are all set. Additionally you will need to tune the following:

  • You need to configure your Ionic application to play media content inline for the player to work as expected. This can be achieved by adding <preference name="AllowInlineMediaPlayback" value="true" /> to your config.xml file.
  • By default when an iOS device is in silent mode (the little switch above the side volume buttons) HTML5 media content is played without sound. A background audio cordova plugin allows to work around this issue.

As a conclusion

Ionic offers a wealth of features and services for building professional-level mobile applications. It is widely used by the mobile developer community and the near-native experience it provides is acknowledged by many in the industry.

By making sure Radiant Media Player works within an Ionic-based application we hope you can build amazing media-oriented mobile applications without the complexity and the cost of using native SDK.

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