1, jwplayer player download:
http://developer.longtailvideo.com/trac/browser/tags/mediaplayer-5.0
2, JS:
<script type= "Text/javascript" src= "${basepath}/resources//jquery.js" ></script>
<script type= "Text/javascript" src= "${basepath}/resources/jwplayer/jwplayer.js" ></script>
<script type= "Text/javascript" >
var Theplayer; Save current player for action
$ (function () {
Theplayer = Jwplayer (' Container2 '). Setup ({
Flashplayer: ' ${basepath}/resources/jwplayer/player.swf ',
File: ' ${basepath}/resources/jwplayer/video.mp4 ',
Playlist: [
{duration:32, File: "/uploads/video.mp4", Image: "/uploads/video.jpg"},
{duration:124, File: "/uploads/bbb.mp4", Image: "/uploads/bbb.jpg"},
{duration:542, File: "/uploads/ed.mp4", Image: "/uploads/ed.jpg"}
< #list cacheveds as cved>
{file: ' ${basepath}/${tempdir}/${cved.localfilepath} ', title: ' ${cved.localfilepath} '},
</#list >
],
"Playlist.position": "Right",
"Playlist.size": 100,
width:600,
HEIGHT:350,
Dock:false
});
Play Pause
$ ('. Player-play '). Click (function () {
if (theplayer.getstate () = ' PLAYING ') {
Theplayer.play (TRUE);
This.value = ' pause ';
} else {
Theplayer.play (FALSE);
This.value = ' play ';
}
});
Stop it
$ ('. Player-stop '). Click (function () {theplayer.stop ();});
Get status
$ ('. Player-status '). Click (function () {
var state = Theplayer.getstate ();
var msg;
Switch (state) {
Case ' buffering ':
msg = ' loading in ';
Break
Case ' PLAYING ':
msg = ' playing ';
Break
Case ' PAUSED ':
msg = ' pause ';
Break
Case ' IDLE ':
msg = ' Stop ';
Break
}
Alert (msg);
});
Get Playback Progress
$ ('. Player-current '). Click (function () {alert (theplayer.getposition ());});
Jump to a specified position play
$ ('. Player-goto '). Click (function () {
if (theplayer.getstate ()! = ' PLAYING ') {//If it is not currently playing, start the player first
Theplayer.play ();
}
Theplayer.seek (30); Start playback from the specified position (in seconds)
});
Get video length
$ ('. Player-length '). Click (function () {alert (theplayer.getduration ());});
});
</script>
3. HTML
<body>
<!--video Playback--
<div id= "Container2" ></div>
<!--
<input type= "button" class= "Player-play" value= "Play"/>
<input type= "button" class= "Player-stop" value= "Stop"/>
<input type= "button" class= "Player-status" value= "Get Status"/>
<input type= "button" class= "Player-current" value= "current playing seconds"/>
<input type= "button" class= "Player-goto" value= "go to 30th second play"/>
<input type= "button" class= "Player-length" value= "video duration (seconds)"/>
-
</body>
How to use Jwplayer player