Supported Playlists


原文地址 翻译:孙小二 QQ:176300676 MSN(EMAIL):sunboyu@gmail.com

FLV Media Player和Image Rotator都有定义播放列表的接口最常用的有三个: XSPF (much used for CC music), RSS (much-used for Podcasts) and ASX (much-used on Windows servers).

常用接口参数和标签

你可以把一个文件列表当作一个文件播放.无论图片还是链接,设置都非常方便.底下是一些flash参数和XSPF,RSS,ASX的标签.

XSPF示例 RSS示例ASX示例
FlashvarXSPF TagRSS TagASX Tag
file <location> <media:content> <ref>
image <image> <media:thumbnail> <param name="image">
id <identifier> <guid> <param name="id">
link <info> <link> <moreinfo>
type <meta rel="type"> <media:content> <param name="type">
captions <meta rel="captions"> - <param name="captions">
audio <meta rel="audio"> - <param name="audio">
title <title> <title> <title>
author <creator> <author> <author>
category <album> <category> <param name="category">

读者可能注意到title和author变量没有具体的参数,是因为在播放单个文件的时候不需要显示这些信息,Also, audio and captions flashvars don't have an RSS reprentation; there's simply no tag for them.

category变量只有一个用法:如果你给他赋值commericail,播放器会认为这个播放列表是个广告.这个参数不能忽略,而在播放列表中却不能出现.这里是个使用播放列表的简单的例子.

常见错误:

在使用播放列表的时候常见的两个问题.一是尽量使用完整的链接(http://)来引用文件和图片.很多问题都是由于地址不完整引起的.注意:flash引用图象和mp3的时候是检测html中的标签而引用flv文件的时候是用swf中检测.二是播放列表最好和swf文件放在同一主机上.因为flash播放器的一个安全机制.这个可以用域的方式解决.你可以把一个播放列表放到本地web站点中,但可以引用外部的资源.

自动生成播放列表

在服务端很容易为播放器生成一个播放列表.你不必非得使用xml为扩展名的文件,而他会自动识别为播放列表.低下是一个PHP+MYSQL生成播放列表的例子:

// first connect to database
$dbcnx = @mysql_connect("localhost","USERNAME","PASSWORD");
$dbselect = @mysql_select_db("DATABASE");

// next, query for a list of titles, files and links.
$query = "SELECT title,file,link FROM mp3_table";
$result = mysql_query($query) or die('Error: '.mysql_error());

// third, build the playlist
header("content-type:text/xml;charset=utf-8");
echo "<playlist version='1' xmlns='http://xspf.org/ns/0/'>\n";
echo "<trackList>\n";
while($row = @mysql_fetch_array($result)) {
  echo "\t<track>\n";
  echo "\t\t<title>".$row['title']."</title>\n";
  echo "\t\t<location>".$row['file']."</location>\n";
  echo "\t\t<info>".$row['link']."</info>\n";
  echo "\t</track>\n";
}
echo "</trackList>\n";
echo "</playlist>\n";

文件命名为playlist.php,你可以设置file=playlist.php为你flash的参数,php在调用的时候执行.

关于播放列表,论坛里有好多解决的方案,大家可以去论坛看.

Armani Shoes with high quality and low price online. Ralph Lauren polo shirts wholesale at low price now. NIke SB online store sale NIKE dunks shoes at wholesale price. Moncler Jackets the best cloth for winter. lacoste oulet online with big discount. Gucci Shoes sale cheap online. Polo Outlet online wholesale to you. NFL JERSEYS cheap wholesale at low price. polo outlet shirts, polo outlet ralph lauren shirts with high quality and low price. christian louboutin shoes cheap online. POLO SHIRTS with high quality wholesale at POLO OULET online store.