Experience the starting point and length of the media stream in the page

  
        

Recently, in a web project, the client asked to enter the start time and end time in the audition audio file, and then stopped from the start time to the end time. After searching a few times in google, I can't find related documents, only I have researched myself. In the beginning, I focused 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) of the clip. SelectionEnd returns or sets the end position of the stream (double). SelectionStart returns or sets the starting position of the stream (double). After testing, you can achieve the required functionality by controlling the CurrentPosition property. The other three properties basically have no effect. However, when the page was placed on a remote server, it was found that the feature did not work. It turns out that when the buffer has not arrived at the start of the broadcast time, it is impossible to jump. Later, I was only able to study the Windows Media Player 9 Series SDK and found that the two elements STARTTIME and DURATION in the Windows Media Metafile Elements Reference are exactly what I need. To use these two elements you need 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 several tests, the program works. The problem is simple now. It is to let the user submit the start time and end time to generate the asx file, and then send the file to the media player. The following is the access interface I made: However, during the test, I found that the file was transferred, but the media player could not be played, it was strange. The test found that playing directly with the local media player is no problem, then the problem must be in the properties of the media player on the page. I reduced the media player's parameters to only one attribute left in the filename, and found that it actually went. Then set the autostart property to false and found that it doesn't work. Finally, I had to set the autostart property to true. The final player's property is set as follows: <param name="AutoStart" value="true"><param name="Filename" value=""><param name=" ShowPositionControls" value="true"><param name="ShowStatusBar" value="true">

Copyright © Windows knowledge All Rights Reserved