MMedia

From HTML5 Builder
Jump to: navigation, search

The MMedia component provides a media player for audio and video files.

You can use it to play movies and songs, develop complex media players, or even combine it with an MCanvas to apply visual effects to a video; all without relying on heavy client-side plugins like Flash.

Usage

In order for the MMedia component to work properly, you must provide at least a list of Sources, as well as a MediaType (video by default).

Control from JavaScript

The media player can display client-side playback controls (defined by the web browser), but you can also choose not to display controls at all (set ShowControls to false), and use client-side properties and methods to control the playback. That way you can define your own controls.
Note: You can display the client-side controls and control the playback from JavaScript, they are not mutually exclusive.

Stop the Download

To stop the download of the media file, pause its playback and empty its source:

var component = $('#ComponentName').get()[0];
component.pause();
component.src = "";

Playback Ranges

You can specify a playback range on the URL of a source file using a hashtag (#) with the following syntax: #t=[starttime],[endtime]. The time can be specified as a floating-point value in seconds (10.5 means 10 and a half seconds) or as a list of hours, minutes and seconds separated by colons (02:30:00 means 2 hours and a half). Both the start and end times are optional, their absence meaning from the beginning and until the end respectively.

For example:

  • movie.wav#t=60, would skip the first minute of playback.
  • movie.mp4#t=,01:00:00 would play only the first hour.

Client-side Features

DOM Elements

The component generates the following client-side DOM elements:

Client-side Events

Documented in the RPCL Reference.

Server-side Features

Properties, Methods and Events

Documented in the RPCL Reference.

See Also

Personal tools