jPlayer

HTML5 Audio & Video for jQuery

a project by happyworm

jPlayer Android Fix

See release note [2.5.5] for an important update relating to this issue.

This demo investigates the problems with Android 2.3 implementation of the HTML5 Media Spec.

Issues addressed:

  • Missing ended events.
  • Failure when setMedia is followed by play.
  • Failure when the media has finished playing. The audio that was just playing is corrupted by it ending.

Issues remaining:

  • Quickly pressing play on the GUI after changing media causes a failure. Pressing pause again and waiting will cause the media to reset through the ended event fix.

View the source of this page to see the jPlayerAndroidFix(id, media, options) class, which has been made as a wrapper to jPlayer. The id is the CSS selector of the jPlayer div. The media is the media object given in the ready event's setMedia command. The options are the usual jPlayer options, except that you should not give a ready event handler.

var id = "#jquery_jplayer_1";
var media = {
	mp3:"http://www.jplayer.org/audio/mp3/Miaow-07-Bubble.mp3",
	oga:"http://www.jplayer.org/audio/ogg/Miaow-07-Bubble.ogg"
};
var options = {
	swfPath: "/my/swf/path",
	supplied: "mp3,oga",
	wmode: "window",
	smoothPlayBar: true,
	keyEnabled: true
};
var myFix = new jPlayerAndroidFix(id, media, options);

Use the controls below to change the media, or to change and play the media.

myFix.setMedia(Bubble).play() | myFix.setMedia(Lismore).play()

Press play to start the media.