Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 5 of 5
  1. #1
    Senior Member rosland's Avatar
    Join Date
    Jul 2003
    Location
    Norway
    Posts
    1,944
    Member #
    2096
    My Javascript skills are fairly basic, so I don't know how to solve the following:

    I have a page with an embedded Windows Media player window. The code for the player window looks like this:
    (The .m3u files are there both to hide the path reference to the actual mp3 files, and to make them stream.)
    Code:
    <OBJECT id="VIDEO" width="320" height="240" 
    	style="position:relative; left:300;top:50;"
    	CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"
    	type="application/x-oleobject">
    	
    	<PARAM NAME="URL" VALUE="http://www.somepage.com/music/filename.m3u">
    	<PARAM NAME="SendPlayStateChangeEvents" VALUE="True">
    	<PARAM NAME="AutoStart" VALUE="False">
    	<PARAM name="uiMode" value="mini">
    	<PARAM name="PlayCount" value="1">
             <PARAM name="stretchToFit" value="True">
    </OBJECT>
    What I would like to do, is to have a set of links above the player window, each pointing to a different .m3u file again pointing to a different .mp3 song.

    To make this happen, I need the script to alter two parameters in the video player object:
    Code:
    <PARAM NAME="URL" VALUE= variableName >
    where variableName would be replaced by the URL from the link, and...
    Code:
    <PARAM NAME="AutoStart" VALUE="False">
    where False needs to be replaced with True to make the player start automatically.

    Any suggestions?
    S. Rosland

  2.  

  3. #2
    Senior Member rosland's Avatar
    Join Date
    Jul 2003
    Location
    Norway
    Posts
    1,944
    Member #
    2096
    BTW, made it work with PHP. I thought it would cause a delay due to reloading the page, but it doesn't. It's seamless and instantaneous, which I thought you needed Javascript to achieve.

    I would, however, like to know how you could achieve the same in javascript. There might be a problem with the media player object, as I think you need to reload it to force the altered commands to take effect.
    S. Rosland

  4. #3
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    PHP Code:
    <script language="javascript">

        function 
    loadSong(url) {
            var 
    songPlayer document.getElementById("VIDEO");
            var 
    songUrl songPlayer.getElementByName("URL");
            var 
    songStart songPlayer.getElementByName("AutoStart");
            
    songUrl.setAttribute("VALUE"url);
            
    songStart.setAttribute("VALUE""true");
        }

    </script> 
    PS - you should use lowercase in most element and attribute names. Unless specified otherwise, w3c has made lowercase the standard for all naming.

  5. #4
    Senior Member rosland's Avatar
    Join Date
    Jul 2003
    Location
    Norway
    Posts
    1,944
    Member #
    2096
    Thanks Steve.
    S. Rosland

  6. #5
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    Any time, Stale. :-D


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 12:56 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com