Radiant Media Player

API Documentation



Last updated on January 4, 2017.

API documentation sections


Introduction

The Radiant Media Player API provides a JavaScript interface to programmatically control the player. This API is a unified API, meaning the methods, events and properties exposed here can be used in the same way to control the HTML5 and Flash rendition of the player. Additionally some methods, events and properties are only available for HTML5 or Flash.

When tuning the player API you must self-host the player files or use a specific version of the cloud player (example for current version: https://cdn.radiantmediatechs.com/rmp/3.10.14/js/rmp.min.js).

Demo Source code

For our video ads API please visit this link.


Set up

A basic example of API usage will look like:

<!-- Include Radiant Media Player JavaScript file in your <body> or <head> -->
<script src="https://cdn.radiantmediatechs.com/rmp/3.10.14/js/rmp.min.js"></script>
<!-- Set up your wrapper div with its unique id -->
<div id="rmpPlayer"></div>
<!-- Set up player configuration options -->
<script>
// First we specify bitrates to feed to the player
var bitrates = {
  hls: 'https://streamingrmp-1479.kxcdn.com/vod/smil:bbb.smil/playlist.m3u8'
};
// Then we set our player settings
var settings = {
  licenseKey: 'your-license-key',
  bitrates: bitrates,
  delayToFade: 3000,
  width: 640,
  height: 360,
  poster: 'https://www.radiantmediaplayer.com/images/poster-rmp-showcase.jpg'
};
// Reference to the wrapper div (unique id)
var elementID = 'rmpPlayer';
// Object creation
var rmp = new RadiantMP(elementID);
// Reference to the player container which will receive API events
var rmpContainer = document.getElementById(elementID);
rmpContainer.addEventListener('ready', function() {
  console.log('player ready');
  // we can call API methods now and only now
  rmp.setVolume(0.5);
});
rmpContainer.addEventListener('play', function() {
  console.log('player has received play order');
});
// Player initialization only after API events are registered
rmp.init(settings);
</script>

Radiant Media Player API events

Below is a list of events that are dispatched by Radiant Media Player.

You must register events to the player container before calling the init method or you may miss some.

Events are registered with the native JavaScript addEventListener method applied to the div wrapper holding the player: rmpContainer as defined above. They are unregistered with the removeEventListener method. You must use named function to use the removeEventListener, anonymous functions will not be removed.

All events fired by Radiant Media Player are non-bubbling events.

ready event

HTML5 Flash
function makeReady() {
  console.log('player is ready');
}
// Wait for player to be ready
rmpContainer.addEventListener('ready', makeReady);

The player is ready to receive calls from the API and is appended to DOM.

durationchange event

HTML5 Flash
function makeDurationChange() {
  console.log('player has received duration information');
}
// Wait for player to receive metadata about duration
rmpContainer.addEventListener('durationchange', makeDurationChange);

The player has received metadata for duration.

play event

HTML5 Flash
function makePlay() {
  console.log('playback has started or resumed');
}
// Listen to play event
rmpContainer.addEventListener('play', makePlay);

The play event is fired when the player starts or resumes playback.

In Flash this event may fire upon seek completion.

pause event

HTML5 Flash
function makePause() {
  console.log('playback has paused');
}
// Listen to pause event
rmpContainer.addEventListener('pause', makePause);

The pause event is fired when the player has paused playback.

In Flash this event may fire upon seek start.

timeupdate event

HTML5 Flash
function makeTimeupdate() {
  console.log('the current playback position has changed');
}
// Listen to timeupdate event
rmpContainer.addEventListener('timeupdate', makeTimeupdate);

The timeupdate event is fired when the current playback position has changed.

ended event

HTML5 Flash
function makeEnded() {
  console.log('playback has ended');
}
// Listen to ended event
rmpContainer.addEventListener('ended', makeEnded);

The ended event is fired when playback for the current video has ended.

error event

HTML5 Flash
function logError() {
  console.log('a fatal error occured');
}
// Listen to error event
rmpContainer.addEventListener('error', logError);

This event fires when a fatal error is encountered and the player cannot recover from it. Those errors are most of the time network errors (like 404 on a manifest). They can also be playback errors or DRM errors.

unregistering events

HTML5 Flash
rmpContainer.removeEventListener('ended', makeEnded);

An example of unregistering event with the removeEventListener method and a named function

Additional unified HTML5 and Flash events

HTML5 Flash

Here is a list of additional events that will fire through our API:

  • loadstart Fires when the player starts looking for the specified media
  • loadedmetadata Fires when the player has loaded meta data for the video
  • progress Fires when the player is downloading video data
  • waiting Fires when the video stops because it needs to buffer the next frame
  • playing Fires when the video is playing after having been paused or stopped for buffering
  • seeking Fires when the player starts moving to a new position in the video
  • seeked Fires when the player is finished moving to a new position in the video
  • volumechange Fires when the player changes its volume Use getVolume method to get the current player volume
  • enterfullscreen Fires when the player enters fullscreen mode
  • exitfullscreen Fires when the player enters exitfullscreen mode
  • destroycompleted The player has finished destroying its instance. See the below destroy method.
  • srcchanged Fires when the player has finished changing its source media URL (using the setSrc method)
  • startuptimeavailable startup time analytics data is available
  • resize the player is resizing

There may be some subtle differences between the chain of events in HTML5 vs. Flash. Make sure to test your API implementation before going into production.

HTML5-only events

Following is a list of HTML5 video specific events:

  • loadeddata Fires when the player has loaded the current frame of the video
  • canplay Fires when the player can start playing the video
  • canplaythrough Fires when the player can play through the video without stopping for buffering
  • stalled Fires when the player is trying to get media data, but data is not available
  • suspend Fires when the player is intentionally not getting media data
  • ratechange Fires when the playing speed of the video is changed
  • abort Fires when the loading of video is aborted

HLS to HTML5 video (MSE-based) specific events

  • hlslevelswitch fires when a level (i.e. quality) switch is requested
  • hlsid3tagparsingcompleted fires when parsing id3 is completed. You can get id3 metadata with the getHlsId3TagSamples method. See our HLS ID3 metadata documentation page for more information.
  • hlsjserror fires when an error is encountered with HLS. The difference with the generic error event is that this error will send error details along the error event. When a fatal error occurs both the hlsjserror and error fire. Example:
    rmpContainer.addEventListener('hlsjserror', function(event) {
      console.log('hlsjserror');
      console.log(event.detail);
      console.log(event.detail.type); 
    });
    event.detail is an Object with the following properties holding details about the error:
    • type - the error type (String)
    • details - further details about the error (String)
    • fatal - is the error fatal or not (Boolean)
  • hlsjswarning fires when a warning is encountered with HLS. Note that it is not uncommon for the player to fire a couple of hlsjswarning events during playback but that does not indicate that the player actually has an issue with playing the content. Serious issues are reported with the above hlsjserror event. Example:
    rmpContainer.addEventListener('hlsjswarning', function(event) {
      console.log('hlsjswarning');
      console.log(event.detail);
      console.log(event.detail.type); 
    });

    As with the hlsjserror the event.detail Object is available.
  • hlsjsinstancecreated fires when the hls.js instance has been created. It can be accessed as rmp.hlsJS.

Following is an example of using the hls.js API with Radiant Media Player. Complete documentation for the hls.js API can be found here.

<script src="https://cdn.radiantmediatechs.com/rmp/3.10.14/js/rmp.min.js"></script>
<div id="rmpPlayer"></div>
<script>
// We set our player as usual
var bitrates = {
  hls: 'https://streamingrmp-1479.kxcdn.com/vod/smil:bbb.smil/playlist.m3u8'
};
var settings = {
  licenseKey: 'your-license-key',
  bitrates: bitrates,  
  delayToFade: 3000,
  width: 640,
  height: 360,
  poster: 'https://www.radiantmediaplayer.com/images/poster-rmp-showcase.jpg'
};
var elementID = 'rmpPlayer';
var rmp = new RadiantMP(elementID);
var rmpContainer = document.getElementById(elementID);
// When hlsjsinstancecreated fires then we can access rmp.hlsJS (this is the hls.js instance)
rmpContainer.addEventListener('hlsjsinstancecreated', function() {
  // Example for registering events with hls.js and getting information about the event
  rmp.hlsJS.on(Hls.Events.MANIFEST_LOADED, function(event, data) {
    if (event) {
      console.log(event);
    } 
    if (data) {
      console.log(data);
      console.log('number of levels in playlist: ' + data.levels.length);
    } 
  });
  // Example for getting information each time a new fragment (that is a .ts chunk) is loaded
  rmp.hlsJS.on(Hls.Events.FRAG_LOADED, function(event, data) {
    if (event) {
      console.log(event);
    } 
    if (data) {
      var fragment = data.frag;
      console.log('fragment duration: ' + fragment.duration);
      console.log('fragment level: ' + fragment.level);
      console.log('fragment sequence number: ' + fragment.sn);
      console.log('fragment start offset: ' + fragment.start);
      console.log('fragment URL: ' + fragment.url);
      // Example for getting EXT-X-PROGRAM-DATE-TIME
      if (typeof fragment.programDateTime !== 'undefined') {
        console.log(fragment.programDateTime); // get the Date instance that represents a single moment in time.
        console.log(fragment.programDateTime.getTime()); // returns the numeric value corresponding to the time for the specified Date according to universal time.
      }
    }
  });
});
rmp.init(settings);
</script>

HLS to Flash video specific events

  • hlslevelswitch fires when a level (i.e. quality) switch is requested

MPEG-DASH to HTML5 video specific events

  • manifestloaded fires when the MPEG-DASH manifest has been loaded
  • streaminitialized fires when the MPEG-DASH manifest has been initialized
  • qualitychangerequested fires when a quality (e.g. bitrate) change has started
  • qualitychangerendered fires when a quality (e.g. bitrate) change has completed
  • periodswitchstarted fires when a period switch has started (for multi-period MPEG-DASH content)
  • periodswitchcompleted fires when a period switch has completed (for multi-period MPEG-DASH content)
  • publickeyError fires when an error is encountered by the CDM while processing a license server response message
  • dashjsinstancecreated fires when the dash.js instance has been created. It can be accessed as rmp.dashPlayer.

Following is an example of using the dash.js API with Radiant Media Player. Complete documentation for the dash.js API can be found here.

<script src="https://cdn.radiantmediatechs.com/rmp/3.10.14/js/rmp.min.js"></script>
<div id="rmpPlayer"></div>
<script>
// We set our player as usual
var bitrates = {
  dash: 'https://streamingrmp-1479.kxcdn.com/vod/smil:bbb.smil/manifest.mpd',
  hls: 'https://streamingrmp-1479.kxcdn.com/vod/smil:bbb.smil/playlist.m3u8'
};
var settings = {
  licenseKey: 'your-license-key',
  bitrates: bitrates,  
  delayToFade: 3000,
  width: 640,
  height: 360,
  dashFirst: true,
  poster: 'https://www.radiantmediaplayer.com/images/poster-rmp-showcase.jpg'
};
var elementID = 'rmpPlayer';
var rmp = new RadiantMP(elementID);
var rmpContainer = document.getElementById(elementID);
// When dashjsinstancecreated fires then we can access rmp.dashPlayer (this is the dash.js instance)
rmpContainer.addEventListener('dashjsinstancecreated', function() {
  // Example for listening to dash.js events
  rmp.dashPlayer.on('bufferstalled', function() {
    console.log('bufferstalled');
  });
  rmp.dashPlayer.on('bufferloaded', function() {
    console.log('bufferloaded');
  });
  // Example for printing the current buffer level (seconds) to the console
  setInterval(function() {
    var videoBuffer = rmp.dashPlayer.getBufferLength('video');
    if (typeof videoBuffer === 'number' && !isNaN(videoBuffer)) {
      console.log('currentVideoBuffer (seconds): ' + videoBuffer);
    }
    var audioBuffer = rmp.dashPlayer.getBufferLength('audio');
    if (typeof audioBuffer === 'number' && !isNaN(audioBuffer)) {
      console.log('currentAudioBuffer (seconds): ' + audioBuffer);
    }
  }, 1000);
  // More dash.js events and methods at work
  rmp.dashPlayer.on('qualityChangeRequested', function() {
    console.log('qualityChangeRequested');
  });
  rmp.dashPlayer.on('qualityChangeRendered', function() {
    console.log('qualityChangeRendered');
    console.log(rmp.dashPlayer.getQualityFor('video'));
    console.log(rmp.dashPlayer.getQualityFor('audio'));
  });
});
rmp.init(settings);
</script>

See here for another example related to MPEG-DASH DRM.

Using the dash.js API requires an advanced knowledge of the dash.js library and providing support for such set up is outside of Radiant Media Player scope of support.

MPEG-DASH with DRM to HTML5 video specific events

  • nodrmsupport fires when MPEG-DASH DRM (Widevine/Playready couple) support is not available within the targeted browser. You must set the dashDrmCheck setting to true in order for this event to fire.

Radiant Media Player API read-only methods

The following methods must be queried after the ready event has fired.

getCurrentTime()

HTML5 Flash
rmp.getCurrentTime();

This method returns a Number expressed in milliseconds representing the current playback position in the media content. -1 is returned in case the value is not available.

getDuration()

HTML5 Flash
rmp.getDuration();

This method returns a Number expressed in milliseconds representing the total duration of the media content. -1 is returned in case the value is not available. Note that on some mobile devices (Android mainly) the duration is only available after a successful play event.

getPaused()

HTML5 Flash
rmp.getPaused();

This method returns a Boolean representing the state of the media content either paused or playing. true means the content on stage is currently paused. Null is returned in case the value is not available.

getPlayerMode()

HTML5 Flash
rmp.getPlayerMode();

This method returns a String representing the mode in which the player is: 'html5', 'flash' or 'nosupport'. Null is returned in case the value is not available.

getStreamType()

HTML5 Flash
rmp.getStreamType();

This method returns a String representing the currently loaded streaming type within the following values: 'hlsmse', 'hls', 'dashmse', 'mp4', 'webm', 'hlsflash', 'hdsflash' or 'mp4flash'. Null is returned in case the value is not available.

'hlsmse' means the player uses HLS through Media Source Extensions in HTML5 video through our JavaScript HLS parser. This is as opposed to native HLS streaming in HTML5 video (iOS, Mac OS Safari) which will return 'hls'. 'hlsflash' will be returned for HLS to Flash.

'dashmse' means the player uses MPEG-DASH through Media Source Extensions and our JavaScript MPEG-DASH parser.

getVolume()

HTML5 Flash
rmp.getVolume();

This method returns a Number representing the current player volume (between 0 and 1). -1 is returned if this value is not available.

getMute()

HTML5 Flash
rmp.getMute();

This method returns a Boolean stating if the player is currently in mute mode or not.

getPlayerVersion()

HTML5 Flash
rmp.getPlayerVersion();

This method returns a String representing the current player version (MAJOR.MINOR.PATCH as in Semantic Versioning).
This setting has been added with Radiant Media Player version 3.2.2

getFullscreen()

HTML5 Flash
rmp.getFullscreen();

This method returns a Boolean representing the current state of the player (true = player in fullscreen mode).

getPlayerWidth()

HTML5 Flash
rmp.getPlayerWidth();

This method returns a Number representing the current width in pixels of the player. Returns 0 if not available.

getPlayerHeight()

HTML5 Flash
rmp.getPlayerHeight();

This method returns a Number representing the current height in pixels of the player. Returns 0 if not available.

getBitrates()

HTML5 Flash
rmp.getBitrates();

This method returns an Array representing the available renditions for the playing stream. This method is only available for HLS-MSE to HTML5 video, HLS to Flash and MPEG-DASH to HTML5 video. Null is returned if this value is not available. Each element of the returned Array is an Object. The width, height, bitrate properties of this object can be queried to get the related values of each rendition.

getCurrentBitrateIndex()

HTML5 Flash
rmp.getCurrentBitrateIndex();

This method returns a Number representing the index of the currently playing rendition. This method is available for HTML5 video with HLS-MSE, MPEG-DASH, MP4 or WebM and HLS to Flash. Null is returned if this value is not available. Index starts at 0 for the lower rendition. Use this in conjunction with the getBitrates method to get data about the currently playing rendition for HLS and MPEG-DASH.

getAbrAutoMode()

HTML5 Flash
rmp.getAbrAutoMode();

This method returns a Boolean stating if the player is in ABR auto mode (true) or not (false). Null is returned if this information is not available.

getPlaybackRate()

HTML5
rmp.getPlaybackRate();

This method returns a Number representing the current playback rate. Null is returned if this value is not available. This method is only available for HTML5 video

getHlsId3TagSamples()

HTML5
rmp.getHlsId3TagSamples();

This method returns an Object representing the ID3 timed metadata in an HLS stream. This method is only available for HLS to HTML5 video. Null is returned if this value is not available. See our HLS ID3 metadata documentation page for more information.


Radiant Media Player API methods

The following methods must be called after the ready event has fired.

play() method

HTML5 Flash
rmp.play();

When invoked, this method will cause the player to start playback or resume it if it was paused.

On mobile devices this method must always be called within a user interaction callback (click, touchstart ...). Also note that the play method must only by called after the player has fired the ready event. Practically the user interaction registration should happen after the ready event has fired (this is a player requirement that cannot be bypassed due to the advanced features that Radiant Media Player is offering). You cannot programmatically call play without a valid user interaction on mobile devices. This functionality is disabled on mobile devices by the OS itself. Failure to comply to this rule will produce erratic behaviour. For example on Chrome for Android you will have a warning message in your browser console which will look like:
Failed to execute 'play' on 'HTMLMediaElement': API can only be initiated by a user gesture

pause() method

HTML5 Flash
rmp.pause();

When invoked, this method will cause the player to pause playback.

stop() method

HTML5 Flash
rmp.stop();

When invoked, this method will cause the player to pause playback returning its playhead to 00:00:00.000 (for on-demand content) and show the current poster.
Note that if an ad is present on stage, this stop method will have no effect. You must first call the stopAds method, wait for the adalladscompleted event and then call stop.

seekTo(ms) method

HTML5 Flash
rmp.seekTo(5000);

When invoked, this method will cause the player to seek to the value indicated as parameter. Parameter value ms is a Number expressed in milliseconds. Note that milliseconds precise seeking is not guaranteed as it depends on the browser implementation of the currentTime property. Most of the time you can expect a 100 ms precision with modern browsers. This method will return Boolean true if successful or Boolean false if the seek operation could not complete.

For MP4 progressive download in Flash the player will only seek to a point where it has buffer for it (preloading).

Example for starting the player at a specific timestamp:

<script src="https://cdn.radiantmediatechs.com/rmp/3.10.14/js/rmp.min.js"></script>
<div id="rmpPlayer"></div>
<script>
var bitrates = {
  hls: 'https://streamingrmp-1479.kxcdn.com/vod/smil:bbb.smil/playlist.m3u8',
};
var settings = {
  bitrates: bitrates,
  licenseKey: 'your-license-key',
  delayToFade: 3000,
  width: 640,
  height: 360,
  poster: 'https://www.radiantmediaplayer.com/images/poster-rmp-showcase.jpg',
};
var elementID = 'rmpPlayer';
var rmp = new RadiantMP(elementID);
// Our container to receive API events
var rmpContainer = document.getElementById(elementID);
// When the player reaches the playing event we order a seek
// Note that it is important to wait for the playing event 
// to properly seek into content that has not been started yet
var onPlayingSeekTo = function() {
  // Remove listener to clear the player
  rmpContainer.removeEventListener('playing', onPlayingSeekTo);
  rmp.seekTo(30000);
};
rmpContainer.addEventListener('playing', onPlayingSeekTo);
rmp.init(settings);
</script>

This method will have no effect with live stream as seeking is not possible in a live stream.

setVolume(volume) method

HTML5 Flash
rmp.setVolume(0.8);

When invoked, this method will change the volume level of the player audio track. Parameter value volume is a Number ranging from 0 to 1.

An example of implementation with the setVolume, setMute, getMute, getVolume methods can be viewed here.

setMute(muted) method

HTML5 Flash
rmp.setMute(true);

When invoked, this method will cause the player to enter or exit mute mode based on the input parameter. muted parameter should be a Boolean with true meaning the mute mode should be engaged and false the mute mode should be disengaged.

An example of implementation with the setVolume, setMute, getMute, getVolume methods can be viewed here.

setLoop(loop) method

HTML5 Flash
rmp.setLoop(true);

When invoked, this method will change the player loop mode. Parameter value loop is a boolean. When set to true it will enabled loop mode. When set to false it will disable it.
On iOS or MacOS Safari the loop attribute is not supported with HLS in HTML5 video. This is not an issue with Radiant Media Player but a lack of support from Safari. Feel free to implement a fallback mechanism if you have to for those specific devices.

resize() method

HTML5 Flash
rmp.resize();

When invoked, this method will force the player to refresh its dimension based on its parent container dimension.

setPlayerSize(width, height) method

HTML5 Flash

This setting has been added with Radiant Media Player version 3.6.7

rmp.setPlayerSize(960, 540);

When invoked, this method will dynamically resize the player to the provided width and height parameter. The player will call the API resize method automatically once the new width and height are set. The width and height parameters must be Number in pixels.

showCaptions(lng) method

HTML5 Flash
rmp.showCaptions('en');

When invoked, this method will display closed captions for the queried language. The lng parameter must be a 2 digit ISO 639-1 (two-letter) string. This is currently only supported for external WebVTT files fed to the player (i.e. not for in-manifest captions).

hideCaptions() method

HTML5 Flash
rmp.hideCaptions();

When invoked, this method will hide closed captions.

setPoster(posterUrl) method

HTML5 Flash
rmp.setPoster('https://www.radiantmediaplayer.com/images/poster-rmp-showcase.jpg');

This methods takes a posterUrl string and updates the player with this new poster.

showPoster() method

HTML5 Flash
rmp.showPoster();

This methods causes the current player poster to be displayed on stage.

hidePoster() method

HTML5 Flash
rmp.hidePoster();

This methods causes the current player poster to be hidden from the stage.

setControls(controls) method

HTML5 Flash
rmp.setControls(false);

This method hides (controls parameter set to false) or shows ( controls parameter set to true) the player controls (including modules, logo, ad UI ...). controls parameter must be a boolean.

destroy() method

HTML5 Flash
rmp.destroy();

This method clear events listeners for the player and empty its buffer. The player container is thus ready for removal from DOM. This method is typically used to remove a player instance and replace it with a new one. See the update player example below for an implementation sample.

If you want to update the player you need to wait for the destroy method to complete. This is when the destroycompleted event fires on the player container.

setPlaybackRate() method

HTML5
rmp.setPlaybackRate(rate);

When invoked, this method will order the player to modify its playback rate to rate where rate is Number. Decent values for rate ranges from 0.5 to 4 and can be increment by 0.1. Values outside this range are not supported as they can cause playback issue in some browsers. This is an HTML5 only method.

toggleFullscreen() method

HTML5
rmp.toggleFullscreen();

When invoked, this method will order the player to switch between normal and fullscreen mode. If in fullscreen the player will exit fullscreen mode. If in window mode the player will enter fullscreen mode. It is up to you to track the current player display mode. Due to inherent limitations set by Adobe between Flash and JavaScript this method cannot be ported to Flash and is only available for the HTML5 rendition of the player.

setBitrate(index, type) method

HTML5 Flash
rmp.setBitrate(0, 'video');

This method allows to set the bitrate/rendition for the player based on an index value (index must be a Number). Index as 0 will set the player to play the lowest bitrate available. This method returns null if it is not able to update the bitrate (like with an index out of bound request).

For HLS-MSE and MPEG-DASH to HTML5 video or HLS to Flash setting index to -1 will restore the player to its 'auto' bandwidth detection.

For MPEG-DASH a type parameter (String) is available. This parameter can be 'video' or 'audio' and allows to set the bitrate separately for the audio or/and video tracks.

This method is available in HTML5 video for HLS-MSE, MPEG-DASH, MP4 and WebM and for HLS to Flash.

An example of implementation with the setBitrate, getCurrentBitrateIndex, getBitrates, getAbrAutoMode methods can be viewed here.


Updating the player


Full update

HTML5 Flash

Below is an en example of implementation that uses the destroy player method and update the page dynamically (i.e. no need to reload the page) with a new player instance. This approach can be quite powerful as it allows to update the player with a completely new set up (new streaming data, ads, captions, configuration options ...).

If you are using a MVC framework like Angular and are updating the player you must follow this approach in order to properly dispose of the current player instance and recreate it as your view is updated.

The update player method is also implemented in our external playlist setup.





Get the source code for this example here.

Here is a more advanced example of inline playlist that will cause the player to automatically play/update the content on click of a button. View source for this example for better understanding of the inner workings of the update API.

Before updating the player will exit fullscreen in HTML5 or Flash (if in fullscreen mode when destroy() is called). This is a requirement to avoid layout issues.


Partial update

HTML5 Flash

This section describes how to partially update the player with a new media source URL. This minimalist approach allows to change the player media content without creating a new player instance but has some limitations as to which player features can be updated. One other advantage of using this method is that it allows for smooth transition of content even in fullscreen mode while the full-update approach for the player requires the player to exit fullscreen before updating.

If at any time you require a feature update that is not supported with the partial update approach please use the full-update approach which supports updating of all player features.

Supported source files
  • MP4 for HTML5 & Flash video
  • HLS for HTML5 & Flash video

MPEG-DASH or WebM are not supported for this approach.

Unsupported features

While using the setSrc method the player will change its media source with the new URL but it will not:

  • Update the contentTitle setting
  • Update the Google Cast casting URL - googleCast setting must be set to false
  • Update the HD menu (bitrate selector) - displayStreams setting must be set to false
  • Update closed captions
  • Update Google Analytics data - you can still use the player API to set up your own tracking
  • Work with audio-only stream (this is untested)
  • Work with backupBitrates
  • Work with the custom ad scheduler or client-side ad waterfalling - you can still use "simple" video ads and update the adTagUrl after the src has changed (see below)
Player methods

setSrc(src) method

rmp.setSrc('https://streamingrmp-1479.kxcdn.com/vod/smil:bbb-long.smil/playlist.m3u8');

This method allows to set the player source streaming URL without creating a new player instance. When the src has been changed a srcchanged event is fired.
The setSrc method is used with our in-player playlist layout.

getSrc() method

rmp.getSrc();

This method returns a String stating the currently playing media source URL. It returns null if this value is not available.

Loading a new video ad after setting src

This can be done by calling the loadAds method. You need to first listen for the srcchanged event and once this has been fired call the loadAds method on the next play event (after srcchanged event has fired).

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