Multi-file playback method for Web page embedded Windows Media player player

Source: Internet
Author: User

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();
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.