扫一扫分享
JW Player是一款非常优秀的网页媒体播放器,支持H.264 ( .mp4, .mov, .f4v )、FLV ( .flv ) 、3GPP ( .3gp, .3g2 )、OGG Theora ( .ogv )和WebM ( .webm )视频格式,MP3 ( .mp3 )、AAC ( .aac, .m4a )、OGG Vorbis ( .ogg )和WAV ( .wav )音频,同时也支持swf和图片( gif 、jpg、png)和YouTube格式视频。 支持html5,有着非常丰富的插件可用(部分是收费的,如广告插件)。
<!DOCTYPE html>
<html>
<head>
<script src='LINK_TO_YOUR_PLAYER'></script>
<script>jwplayer.key='YOUR_KEY';</script>
</head>
<body>
<div id="player">Loading the player...</div>
<script>
// Setup the player
const player = jwplayer('player').setup({
file: 'LINK_TO_YOUR_FILE.mp4'
});
// Listen to an event
player.on('pause', (event) => {
alert('Why did my user pause their video instead of watching it?');
});
// Call the api
const bumpIt = () => {
const vol = player.getVolume();
player.setVolume(vol + 10);
}
bumpIt();
</script>
</body>
</html>
手机预览