The web-embedded media Player player is simple, and the following code completes a simple player:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1- transitional.dtd">
<meta content="text/html; charset=utf-8" http-equiv="Content- Type" />
<title>音乐播放器÷</title>
<body>
<object height="200" type="video/x-ms-wmv" width="200">
<param name="filename" value="C:\Users\SkyD\Music\Groove Coverage\far away from home .mp3" />
<param name="autostart" value="true" />
<param name="loop" value="true"/>
</object>
</body>
Operation Effect:
How do I get the player to play multiple audio/video files?
There is no way to add multiple filename parameters directly to the HTML to achieve multiple file playback, it is possible to create a playlist and then point the filename parameter to the location of the playlist.
The following C # code is used to create a playlist file supported by Windows Media Player:
public static void 生成ASX音乐播放列表文件(string 存储路 径, params string[] 文件路径列表)
{
StringBuilder s = new StringBuilder();
foreach (var f in 文件路径列表)
{
s.AppendLine(string.Format(@"<Entry><Ref href = ""{0}""/></Entry>",f));
}
StreamWriter sw = new StreamWriter(存储路径, false, Encoding.Default);
sw.Write(string.Format(@"<Asx Version = ""3.0"" >{0} </Asx>",s));
sw.Close();
}