Skip to content

Renaming setSource to initialiseMedia and require a DOM element to render media into

Compare
Choose a tag to compare
@matt-stephenson matt-stephenson released this 29 Jun 13:13
· 41 commits to master since this release

The MediaPlayer setSource method has been renamed initialiseMedia (more representative of what it does).

This method now has a new parameter sourceContainer. This is a required parameter, and is DOM element which you require the media to be rendered into.

In order to simply retain functionality from previous versions, you can pass RuntimeContext.getCurrentApplication().getRootWidget().outputElement in as the sourceContainer.

Note: only HTML5 devices will utilise the container to render the video. Samsung and CEHTML will continue to render the video fullscreen in the background.

Usage:

Before (<9.0.0):

mediaPlayer.setSource('video', 'http://sourceURL', 'video/mp4', {disableSentinels: true});

After (9.0.0):

var mediaContainer = RuntimeContext.getCurrentApplication().getRootWidget().outputElement;
mediaPlayer.initialiseMedia('video', 'http://sourceURL', 'video/mp4', mediaContainer, {disableSentinels: true});

Samsung broadcast changes - detail to follow.