MediaPlayer Module

RhoElements 2.x API

Overview

The MediaPlayer Module plays audio/video files.

Syntax

mediaPlayer (Module) <META> Syntax

<META HTTP-Equiv="mediaPlayer" content="[method / parameter]">

MediaPlayer JavaScript Object Syntax:
By default the JavaScript Object 'mediaPlayer' will exist on the current page and can be used to interact directly with the mediaPlayer.
To Invoke mediaPlayer methods via JavaScript use the following syntax: mediaplayer.method();

e.g. mediaPlayer.start();

To Set mediaPlayer parameters via JavaScript use the following syntax: mediaplayer.parameter = 'value'; remembering to enclose your value in quotes where appropriate.

e.g. mediaPlayer.filename = 'value';

To set multiple EMML parameters / events on a single line use the following syntax: mediaplayer.setEMML("[Your EMML Tags]");

e.g. mediaPlayer.setEMML("filename:valuestart");

Methods

Items listed in this section indicate methods or, in some cases, indicate parameters which will be retrieved.

NameDescriptionDefault Value
startStarts playing the audio/video file until either the end or 'stop' is received. Please note that at any time only one file can be played.N/A
stopStops playing the aduio/video file.N/A

Parameters

Items listed in this section indicate parameters, or attributes which can be set.

NamePossible ValuesDescriptionDefault Value
filename:[Value] Fully qualified URL or file name. Supports HTTP and File protocols.Plays the specified file. Please note that the file format has to be supported on the platform for playback. N/A
type:[Value] "audio" or "video"The type of the file."video"

Multi Instance

When multiple RhoElememts applications are running the following considerations should be made: Only the foreground RhoElements application is given access to play the media files, when an application is sent to the background any playback that is in progress will be stopped and it will automatically relinquish control of the Audio/Video hardware. When brought back to the foreground, an application previously using the media player will have its previous configuration (eg. name etc.) reapplied to the plugin automatically.

Remarks

Full Screen Videos

Video playback always happens in full screen and the user can use the back button to stop the video. While the video is being palyed there will be controls for Pause, seek, forward and rewind operations.

Licensing issues

The user is responsible for installing the required CODEC and for any legal problems or licensing issues that arise from installing the additional codecs. The media player would play the formats that are available on the device.

File formats

The supported formats vary according to the platform. On Android devices we can play a 3GPP/MP4/MP3/WebM file.

Format of the filename URL

Supports only HTTP and FILE formats. HTTP Example: http://192.168.1.1:8080/Folder/Media.mp4. File Example: file:///Application/Media.mp4. Remember to also wrap your URL with url('') when being used as part of a meta tag, as shown in the examples above.

Requirements

RhoElements Version2.2 (SP1 on windows devices) or above
Supported DevicesAll supported devices
Minimum Requirements
PersistenceNot Persistent - Changes to this module will not persist when navigating to a new page.

HTML/JavaScript Examples

The following META Tag example plays a video file:

<META HTTP-Equiv="mediaPlayer" Content="filename:url('HTTP://192.168.1.1:80/Media/RhoElements.mp4')">
<META HTTP-Equiv="mediaPlayer" Content="start">

The following JavaScript will start and stop a media playback respectively when calling onStart and onStop:

<script>
   function onStart()
   {
    mediaPlayer.filename = url('wtgdev.co.uk/audio.mp3');
    mediaPlayer.type = 'audio';
    mediaPlayer.start();
   }

   function onStop()
   {
    mediaPlayer.stop();
   }
</script>