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" >