Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsWindows VistaWindows XPWindows MeWindows 98Windows 95Virtual PCInternet ExplorerOutlook ExpressWindows MediaSecurity
Related Topics
MS Server ProductsMS OfficePC HardwareMore Topics ...

Windows Forum / Windows Media / General Topics / July 2005

Tip: Looking for answers? Try searching our database.

creating a dropdown menu in an ASX file

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
bryan - 25 Jul 2005 21:46 GMT
is it possible to create a drop down menu in an asx file? do I need to
use Javascript or HTML? how do I go about doing this. any help?
Neil Smith [MVP Digital Media] - 26 Jul 2005 17:49 GMT
>is it possible to create a drop down menu in an asx file? do I need to
>use Javascript or HTML? how do I go about doing this. any help?

ASX files are playlists. They don't appear in any browser, so as a
result you cannot "create a dropdown menu" sorry.

Maybe you should start by stating what you want to achieve, possibly
posting a web address of something-you-saw-which-looks-like-what-you
want to do.

Cheers - Neil
bryan - 27 Jul 2005 19:46 GMT
I understand that ASX files are playlists. Instead of viewing the
entire playlist that one sees after an ASX has been created, I am
trying to just create a drop down menu with the option of selecting the
"chapter point" I wish to jump to. I have not seen an example of this
anywhere yet, but my boss said to research this to see if it was
possible. He said I may have to do this with HTML and/or javascript
neither of which I know much about.

I've taught myself how to create ASX files, but no where did I see how
to incorporate javascript or HTML. I am hoping there is someone out
there with more knowledge of this topic than I and can help me out or
offer advice.

I mad a posting on another message board and was given this as advice:

"Copy the code into your website and replace the paths / names with
your names of your paths / name of songs:

Code:
<script language="javascript">var streams = new Array();
streams[0] = new makeStream("dreamer.wav", "1...I'm Just a Dreamer -
Ozzy Osbourne");
streams[1] = new makeStream("albatross.wav", "2...Albatross - Fleetwood
Mac");
streams[2] = new makeStream("somevelvetmorn.wav", "3...Some Velvet
Morning - Nancy Sinatra and Lee Hazelwood");
streams[3] = new makeStream("bestieverhad.wav", "4...Grey Sky Morning -
Vertical Horizon");"

Where do I go from here? thanks.
Neil Smith [MVP Digital Media] - 27 Jul 2005 22:38 GMT
>I understand that ASX files are playlists. Instead of viewing the
>entire playlist that one sees after an ASX has been created, I am
>trying to just create a drop down menu with the option of selecting the
>"chapter point" I wish to jump to.

Now this is another question, because chapter points are usually used
in reference to Quicktime player, and they are reference points which
allow you to jump to another point in the video programatically.

In windows media, you get 'markers' which you add using the media file
editor. The problem is it depends how you host the file how useful
they are as jump-points into a single video file. If you stick your
files on a web server, then you get pseudo-streaming, it's a form of
long-term file download. It also means that you have to wait till the
video is downloaded up to the marker before you can play it ... and
you can't easily jup backwards again.

If hosted on a media server you can do this jumping about between
markers, but if you had one of those then we'd probably be talking
about server side playlists rather than a cheap and cheerful
javascript solution.

So if you need 'chapter points' you'd better redefine your problem and
post info about the technology you have available.

> I have not seen an example of this
>anywhere yet, but my boss said to research this to see if it was
>possible. He said I may have to do this with HTML and/or javascript
>neither of which I know much about.

OK well I posted this solution about a year ago, it should be
adaptable (obviously I won't repost the entire thread here) :

http://groups.google.co.uk/group/microsoft.public.windowsmedia.player.web/browse
_thread/thread/d134164e3d514963/31720a45648e0a4d?lnk=st&q=%22showPlayItems()%22+
author:Neil+author:Smith+author:[MVP+author:Digital+author:Media]&rnum=4&hl=en#3
1720a45648e0a4d


You should read it end to end several times probably, to understand
the implications of what's happening. It's a workable solution which
needs only minor modifcation to meet your stated requirements.

>I've taught myself how to create ASX files, but no where did I see how
>to incorporate javascript or HTML. I am hoping there is someone out
>there with more knowledge of this topic than I and can help me out or
>offer advice.

Well my advice really is to make the playlist (dropdown) dynamically
from a database source, using your web server scripting language, so
.NET or PHP or Perl or whatever. It's less chance of failing in a
range of web browsers.

>I mad a posting on another message board and was given this as advice:
>"Copy the code into your website and replace the paths / names with
>your names of your paths / name of songs:

Well I can see what this code is intended to do, but of course it's an
outline, there's no actual makeStream function so you'd have to write
one ;-)

>Code:
><script language="javascript">var streams = new Array();
>streams[0] = new makeStream("dreamer.wav", "1...I'm Just a Dreamer -
>Ozzy Osbourne");

In the code in the thread above, there's a function showPlayItems()
which can be adapted to make a dropdown. First you'd need to have a
form, so let's say

<form name="playlist" id="playlist" onchange="setPlayItem()">
    <select name="playitems" id="playitems">
        <option value="">Please Select</option>
    </select>
</form>

Now you need to adapt the showPlayItems() function from making DOM
elements to creating options in the select element.

Read here if you're unfamiliar with creating options in a dropdown :
http://www.quirksmode.org/js/options.html
http://www.javascriptkit.com/script/cut183.shtml

For example :

function showPlayItems() {
    df=document.forms["playlist"];
//    Get an handle to the select box
    di=df.playitems;
//    Restrict our select to the 1st (blank) option value
    di.length=1;
    playlistItems=WMP9.currentPlaylist.count;
    for (i=0; i<playlistItems; i++) {
//    Add each option text+value in turn from the playlist   
//    Make sure the next line (from di[ ... to ... name, i) is kept
//    on one line for Javascript or you'll get a script error
        di[di.length] = new
Option(WMP9.currentPlaylist.item(i).name, i);
    }
    playListLoaded=true;
    WMP9.controls.stop();
}

Finally, you'd change the setPlayItem function something like this to
use the select element onchange as input instead of the DOM element :

function setPlayItem() {
    df=document.forms["playlist"];
    di=df.playitems;
    index=df.playitems[df.playitems.selectedIndex].value;
    if (index != '') {
        playlistItems=WMP9.currentPlaylist.count;
        if (playlistItems > 0) {

WMP9.controls.currentItem=WMP9.currentPlaylist.item(index);
            WMP9.controls.play();
        }
    }
}

Cheers - Neil
Neil Smith [MVP Digital Media] - 27 Jul 2005 22:43 GMT
Err I actually meant to post http://tinyurl.com/77sh7 which is easier
to cut & paste ;-)

Cheers - Neil
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.