ASX PlayList files for continuous playback of multiple songs

Source: Internet
Author: User

It is often seen that some music sites have such a function: You can select the checkbox before the song name on the page and click the play button to play these selected songs continuously.

If a single audio file is played in a document, you can use a common method, such as the third method described here.

But now there are multiple songs, and the method is not as good as it is ~ I remember the list file M3U saved when I used the winampplayer. The current mediaplayer player uses the WPL list file format. Of course, here I want to use the ASX PlayList file.

An ASX file is a text file mainly designed to redirect streaming information, similar to an RPM (RM transit file) file.

The main reason for redirecting stream information using the ASX file is: currently, common browsers generally do not support the MMS protocol for playing stream information, so we use the ASX file.

The ASX contains the URL corresponding to the media content. When we connect a hyperlink to ASX in HTML, the browser will directly send the content of ASX to media player, media Player uses the corresponding protocol to open the multimedia information stream or multimedia file at the specified position based on the information of the ASX file.

After the ASX file is used, when the browser finds that a connection is related to Asx, it knows that media player is required to play the stream information, so it starts Meida player, media Player can use the MMS protocol to play stream information.

The format of a standard ASX file is as follows:

<ASX version = "3.0">
<Entry> <ref href = "http: // server/song1.asf"/> </entry>
<Entry> <ref href = "http: // server/song2.asf"/> </entry>
<Entry> <ref href = "http: // server/song3.asf"/> </entry>
</ASX>

Note that the ASX file is not a media file, but a list of media files. The address of the media file is represented by the href attribute of the subnode ref of the entry node.

Of course, you can also define more sub-nodes in the entry node to enrich the information of the current media file, such:

<ASX version = "3.0">

<Entry>
<Ref href = "http://www.kmtv.com.cn/edit/uploadfile/200583195159842.MP3"/>
<Title> lonely (www.164.cc) </title>
<Author> [Nana] (www.164.cc) </author>
<Copyright> belongs to the rights holder of the Song recording company or artist. </Copyright>
</Entry>

<Entry>
<Ref href = "http://www.syzone.cn/mov/mymp3/yeyeye.mp3"/>
<Title> yeyeye (www.164.cc) </title>
<Author> [DJ] (www.164.cc) </author>
<Copyright> belongs to the recording company or singer owner </Copyright>
</Entry>

</ASX>

<Title> </title> indicates the title of the media file, and <author> </author> indicates the author of the media file (the artist singing the song ), <copyright> </Copyright> indicates the copyright statement of the media file.

For more information, see: http://support.microsoft.com/kb/247355/zh-cn

With an understanding of the ASX file format, you can create a media playlist file by yourself to meet the continuous playback requirements of multiple songs.

So how can I insert the ASX file into the page for playback? The common method is to insert the ASX file into the page as a normal media file (as mentioned in this Article)

However, for dynamic song playback, different list files are required for selecting different songs each time. This is obviously not suitable, so the ASX content must be dynamically generated.

Because the file format of ASX is fixed, you can query the paths of related media files based on the songs you select and write the file content of ASX cyclically. So, when the ASX file format remains unchanged, you can change the suffix of the ASX file to. asp for reference.

For example: http://www.164.cc/2006/testmusic/tt.asp
The connected media playlist file is: http://www.164.cc/2006/testmusic/tm.asp
Although the media list file is of the ASP type, its content is in the ASX format, which does not affect the playing of songs.

In addition, <% response. contenttype = "Video/X-MS-ASF" %> is the method for ASP to declare the current file as an ASX file, but in the TM. when an ASP file is first applied, the user opens the File Link and automatically uses the local mediaplayer for playback.

Test: http://www.164.cc/2006/testmusic/tm1.asp

OK. Let's talk about the static content first. The next step is to extract the media list file TM. asp from the database and dynamically generate the content of the media list file to be continued.

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.