JME is a declarative HTML component library including DOM APIs and CSS-hooks to extend/customize HTML5 mediaelements (audio/video)
mediaplayer
div
state-idle
state-waiting
state-playing
state-initial
state-ended
state-error
focusenter
useractive
fover
(:hover)
controlbar
controls
{ property boolean controlbar; property boolean fullscreen; readonly property jQuery media; jQuery addControls(controls); readonly property string embedUrl; jQuery getIframe([width, height]); };
The mediaplayer
element class wraps a mediaelement (audio/video) and associates this mediaelement with its control elements. The mediaplayer
element class serves also as an user interaction wrapper for the player.
Using jme pseudo classes to build the user interface.
.mediaplayer .media-controls {
transition: all 400ms ease 0s;
}
/* hide player controls, if mediaelement is playing,... */
.mediaplayer.state-playing .media-controls {
opacity: 0;
}
/* ...but show controls if user is moving his mouse */
.mediaplayer.useractive .media-controls {
opacity: 1;
}
Using jme interface to switch to custom styleable controls:
$('div.mediaplayer').jmeProp('controlbar', true);
Using jme interface to toggle fullscreen:
$('div.mediaplayer').jmeProp('fullscreen', function(i, state){
return !state;
});
Dynamically add a new control to a mediaplayer:
$('div.mediaplayer')
.jmeFn('addControls', $('<button class="play-pause">play/pause</button>').prependTo('body') )
;
audio
video
{ readonly property jQuery player; property mixed srces; readonly property boolean isPlaying; readonly property number progress; jQuery togglePlay(); Rangearray concerningRange([type:string ("buffered"), time:string (currentTime)]); formatedTime formatTime(seconds:number[, format:Array]); };
play-pause
button
state-paused
, state-playing
{ readonly property jQuery player; readonly property jQuery media; };
mute-unmute
button
state-mute
, state-unmute
{ readonly property jQuery player; readonly property jQuery media; };
buffer-progress
div
{ readonly property jQuery player; readonly property jQuery media; readonly proptery Number progress; };
volume-slider
div
{ readonly property jQuery player; readonly property jQuery media; };
time-slider
div
format
{ readonly property jQuery player; readonly property jQuery media; property mixed format; //not implemented yet };
currenttime-display
div
format
countdown
{ readonly property jQuery player; readonly property jQuery media; property boolean countdown; property mixed format; };
currenttime-display
div
format
{ readonly property jQuery player; readonly property jQuery media; property mixed format; };
based on http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/