JW Player,支持AAC和播放列表的flash播放器使用教程

来源:Hyde Coffee

JW Player: Flash Video Player 简介

JW Flash Player是一款LongTail Video出品的网页播放器,支持所有Adobe Flash Player包含的格式(FLV, H.264, MP4, MP3, AAC, JPG, PNG and GIF),支持xml播放列表,功能强大且使用方便。

用JW Flash Player播放AAC音频

1.在LongTail Video 官网下载JW Player 5.1,解压后把player.swf和swfobject.js上传到服务器;

2.上传AAC音频文件到服务器(推荐使用Nero AAC 编码器转换音频文件,AAC和MP3的比较可参考维基百科);

3.制作基于XSPF的xml播放列表,代码如下(文件地址是必须的,其他元素可省略),保存为xml文档上传到服务器;

<?xml version="1.0" encoding="UTF-8"?>
<playlist version="1" xmlns="http://xspf.org/ns/0/">
<trackList>
<track>
<location>音频文件地址</location>
<creator>艺术家名字</creator>
<album>专辑名字</album>
<title>作品名字</title>
<annotation>个人评论</annotation>
<duration>音频时长</duration>
<image>图片地址</image>
<info>相关网址</info>
</track>
<track>
第二个文件,代码同上
</track>
<track>
第三个文件,以此类推
</track>
</trackList>
</playlist>

4.在网页上插入如下代码,即可在那个位置显示播放器。

<script type='text/javascript' src='swfobject.js文件地址'></script>
<div id='mediaspace'>播放器会代替这段文字</div>
<script type='text/javascript'>
var so = new SWFObject('player.swf文件地址','mpl','像素宽度','像素高度','9');
so.addParam('allowfullscreen','true');
so.addParam('allowscriptaccess','always');
so.addParam('wmode','opaque');
so.addVariable('playlistfile','xml文件地址');
so.addVariable('volume','100');
so.addVariable('playlist','bottom');
so.addVariable('autostart','true');
so.addVariable('repeat','list');
so.write('mediaspace');
</script>

实际效果请看博客侧边栏。

This entry was posted in 原创. Bookmark the permalink.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>