Controlling the starting point and playback length of media streams in a page

Source: Internet
Author: User
Control | media | page | Media recently in a Web project, the customer proposed that in the audition audio file, enter the start time and the end time, then play from the start time and stop at the end time. Google search a few times, can not find the relevant documents, only to do their own research.
At the beginning, the main focus was on the properties of the Media Player control, and found the following related properties:
CurrentPosition Returns or sets the current position of the clip (double).
Duration Returns or sets the playback time (double) for clip clips.
Selectionend Returns or sets the end position of the stream (double).
SelectionStart Returns or sets the starting position of the stream (double).
After testing, by controlling the currentposition properties, you can achieve the required functionality. The other three properties do not work at all. However, when the page is placed on a remote server, it is found that the feature does not work. Originally in the buffer has not reached the beginning of the broadcast time, is not jump.
Later, I was able to focus on the Windows Media Player 9 Series SDK, and found that in Windows Media Metafile Elements reference StartTime, Duration two element is exactly what I need. To use these two element needs to be in the ASX file.
The ASX file format is as follows:
<ASX version= "3.0" >
<title>your TITLE here</title>
<ENTRY>
<ref HREF = "Audio file access path"/>
<starttime value= "0:30.0"/>
<duration value= "00:50"/>
</ENTRY>
</ASX>
After many tests, the scheme is feasible. Now the question is simple. is to have the user submit the start and end times after the ASX file is generated, and then send the file to media Player.
Here's what I do to access the interface:

However, during the testing process, the discovery file passed, but media player can not play, strange. The test found that it was no problem to play directly with local media player, so the problem must be in the properties of Media Player on the page. I reduced the media player's parameters to just one attribute, and found it was OK. Then set the Autostart property to False to find that it is not working. Finally, set the Autostart property to True.
The German property of the final player is set as follows:
<param name= "AutoStart" value= "true" >
<param name= "Filename" value= "" >
<param name= "Showpositioncontrols" value= "true" >
<param name= "ShowStatusBar" value= "true" >



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.