Selecting an ASF files for the Windows Media Player (JavaScript)

 

 

Description:

 

 

Goal: Load an embedded Windows Media Player with a new ASF file based on a button or link that the user selects.  This is useful for creating a list of songs or movies that the user can select without reloading the web page.

 

This is accomplished by controlling the filename parameter of the Active X Control and the filename method of the Embedded Plug-In for NetScape.

 

CODE TO PUT IN YOUR WEB PAGE:

 

The first step in this process is to embed the Windows Media Player in your web page.  This is easy to do with All Browser Friendly HTML and JavaScript Code that you can cut and paste directly into your web page.  Notice that I am leaving the filename property of the Windows Media Player Blank and the SRC property of the Embedded Windows Media Player. This information will be assigned to the player depending on which of the bottuns or links the user selects.

 

Add this code between the <Body> tags of your web page.

 

<OBJECT ID="MediaPlayer" 

            classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" 

            CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"

            standby="Loading Microsoft Windows Media Player components..."

            type="application/x-oleobject">

 

            <PARAM NAME="FileName" VALUE="">

            <PARAM NAME="AnimationatStart" VALUE="true">

            <PARAM NAME="TransparentatStart" VALUE="false">

            <PARAM NAME="AutoStart" VALUE="true">

            <PARAM NAME="ShowControls" VALUE="true">

                                                  

            <Embed type="application/x-mplayer2"

            pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/"

                        src=" "

                        Name=MediaPlayer

                        ShowControls=1

                        ShowDisplay=1

                        ShowStatusBar=1                     

                        >

            </embed>

                                               

</OBJECT>

 

Add this JavaScipt code before the first body tag.

 

<script language="JavaScript">

<!--

    if ( navigator.appName == "Netscape" )

    {

        navigator.plugins.refresh();

        document.write("\x3C" + "applet MAYSCRIPT Code=NPDS.npDSEvtObsProxy.class" )

        document.writeln(" width=5 height=5 name=appObs\x3E \x3C/applet\x3E")

     }

//-->

</script>

 

Now that you have the Windows Media Player in your page you, you will need to create some buttons or links to that the user can access to select a Media File. In this example we show three different methods.

 

 

Links

 

<font FACE="Verdana,Arial,Helvetica" SIZE="2"><a href="#top"  OnClick="LoadPlayer ('first.asf')"     >First Video</a></font><BR>

 

Form Field Buttons

 

<input TYPE="Button" style="Arial" NAME="Number of Marker" VALUE="    First Video   " OnClick="LoadPlayer ('first.asf')">

 

Clickable Images

 

<a href="#top" border="0"  OnClick="LoadPlayer ('first.asf')"  ><Img Src="part2.jpg"  border="0"></a>

 

 

 

I am using a simple OnClick JavaScript Event to assign the name of an ASF file to the video variable of the Loadplayer function.  Here is the code for the LoadPlayer function. 

 

 

 

 

This function is accomplishing two different things.  First it is detecting which browser the user running to view the Windows Media Content.  If the user is using Internet Explorer then the browser will assign the variable videochoice to the filename property of the Windows Media Player Active X control.  The play method is called and the Windows Media Player starts playing.  If the user is running NetScape Navigator then the player runs the setFileName method of the Embeded Windows Media Player.  It changes the filename to whatever is assigned to the videochoice variable.  It then execute the Play() method of the Windows Media Player.  This method starts the player running.

 

 

EVENTS AND PARAMETERS TO PUT IN YOUR NETSHOW SERVICES STREAM           

 

No events or parameters are needed for this presentation.

Seattle Flash Designer and Web Designer : Mikey Longr:

I specialize in Seattle Web Design and Seattle Flash Design. Michael has been working on the web for over ten years and specializes not only in web design technologies like Macromedia Flash and HTML but web development technologies including the asp, asp.net and PHP4. As a Flash Designer in Seattle Washington I have done work for top names in the ever expanding Flash Animation industry. I owned a new media and multimedia design company for three years. OverDrive Media specilized in multimedia development including Flash, streaming, web design and database driven media systems.

Flash has revolutionized the way that web graphics are created and built an entirely new market for 3d Animation and motion graphics. Flash Animation started as a very simple method for creating vector based web animation. The Flash Movie was little more than a slight advancement of the animated gif. The files were large, the drawing options limited and the end result clunky. In the early days of the Internet (5 years ago) this was enough to blow the competition out of the water. While their have been numerous ways to create motion graphics none of these methods has combined the impact and usability of Flash. Flash became the standard for online motion graphics because it was easy to use. Web animators did not have to understand code or advanced scripting language. You could design in flash, move things around, restructure the animation and duplicate effects with ease. None of this was possible before Macromedia Flash.