I know I can start jPlayer at a given point in time or by percent by doing:
$("#jquery_jplayer").jPlayer("playHead", 30);
This is when issuing the play command (works fine), but how can I constrain the play time between two fixed points, either by absolute time or percent is fine? Ie I want it to start at 30% and end at 50%, etc. Basically just a good snippet of a song. Any ideas or pointers?
http://www.happyworm.com/jquery/jplayer/latest/developer-guide.htm#jPlayer-playHead
Well in jPlayer 1.2 (not newest) you should have an "onProgressChange" event (used for updating the playedTime text), so if you had a global (gasp) var like
var demoSong = true;
Then you could make your onProgressChange function look like this
$("#jquery_jplayer").jPlayer("onProgressChange", function(loadPercent, playedPercentRelative, playedPercentAbsolute, playedTime, totalTime) {
jpPlayTime.text($.jPlayer.convertTime(playedTime));
jpTotalTime.text($.jPlayer.convertTime(totalTime));
if(demoSong) {
if(playedPercentAbsolute > 50) {
$("#jquery_jplayer").jPlayer("stop");
}
}
});
I'm in the middle of converting my site to jPlayer 2.0 and the changes in event binding will make this answer unhelpful going forward. Maybe it can give you a head start though.