Warning Older Docs! - You are viewing documentation for a previous released version of RhoMobile Suite.

MediaPlayer Module

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");
MediaPlayer Ruby Object Syntax:
By default the Ruby Object 'MediaPlayer' will exist on the current page and can be used to interact directly with the MediaPlayer. All Methods, Parameters and Events are the same as JavaScript, however, notice 'MediaPlayer' needs to start with an uppercase letter. Another difference in Ruby is that methods do not end in '()'
To Invoke MediaPlayer methods via Ruby use the following syntax: MediaPlayer.method()

e.g. MediaPlayer.start
To Set MediaPlayer parameters via Ruby use the following syntax: MediaPlayer.parameter = 'value' remembering to enclose your value in quotes where appropriate.

e.g. MediaPlayer.filename = 'value'

Methods

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

Name Description Default Value
start Starts 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
stop Stops playing the aduio/video file. N/A

Parameters

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

Name Possible Values Description Default 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 Version 2.2 (SP1 on windows devices) or above
Supported Devices All supported devices
Minimum Requirements
Persistence Not 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 onStart and onStop are called

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

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