Asx scripting

The online asx script processing url is the url to a special web server page which can be the target of a web request (when the user clicks a video shot), in order to build an Windows Media asx script file which in turn will start playing a video segment.

Each video hyperlink eventually resolves to an url which is made of this asx scripting processing page, to which are passed one or more parameters that define a particular video segment.

The asx script technique is required to play a video segment rather than the full video. Fortunately, this web server page can be written with any server-side language, including PHP/JSP/ASP(.NET) and so on. The documentation provides a sample implementation written in PHP, but feel freely to create your own.

Why asx? asx is the name of a declarative file format understood by Windows Media (all versions). You can find reference material of this file format on the web, but in short an asx script defines a video segment thanks to appropriate xml elements.


Sample PHP implementation for the Asx scripting processing page :

header("Content-Type: video/x-ms-asf");

    echo "<asx version=\"3.0\">";
    echo "<title></title>";
    echo " <entry>";
    echo "  <ref href=\"".$media."\" />";

	if (isset($startAt))
	    echo "  <starttime value=\"".$startAt."\" />";

		if (isset($endAt))
			sscanf($startAt, "%d:%d:%d.%d", $h1, $m1, $s1, $micros1);
			sscanf($endAt, "%d:%d:%d.%d", $h2, $m2, $s2, $micros2);

			$seconds1 = $h1 * 3600 + $m1 * 60 + $s1;
			$seconds2 = $h2 * 3600 + $m2 * 60 + $s2;

			$duration = $seconds2 - $seconds1;
			if ($duration < 0)
				$duration = -$duration;

			echo "  <duration value=\"".$duration."\" />";

    echo " </entry>";
    echo "</asx>";



If you want to allow video hyperlinks to work, you need to deploy this page on a web server of your choice. And then reference the resulting deployed url in the AVS publish wizard.