PDA

View Full Version : loading new asx file on a page...


cortic
06-17-2003, 10:55 AM
Ok, first sorry if this belongs in the DOM forum, but I’m trying to find a client-side solution to this and would like to leave it open as possible.

I’m making a CD for a client, html (loaded in the default browser) some JavaScript and CSS *basically a website with no server-side* anyway there is a lot of multimedia in the form of avi and mpg video and audio so I’m using object and embed to put an *.asx file on the pages, the *.asx file just looks something like:

<ASX version = "3.0">
<ENTRY>
<REF HREF = "56a.avi" />
</ENTRY>
</ASX>

the elements on the page that call it up look like:

<div id="mov">
<OBJECT ID="MediaPlayer" style="position:absolute;" WIDTH=240 HEIGHT=230
CLASSID="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95"
STANDBY="Loading Windows Media Player components..."
TYPE="application/x-oleobject">
<PARAM NAME="FileName" VALUE="56a.asx">
<PARAM NAME="ShowControls" VALUE="False">
<PARAM NAME="ShowStatusBar" VALUE="False">
<EMBED style="position:absolute; " TYPE="application/x-mplayer2" SRC="56a.asx" name="WinMedia" ShowStatusBar="false" ShowControls=0
NAME="MediaPlayer"
WIDTH=240
HEIGHT=230>
</EMBED>
</OBJECT>
</div>

fine, works, however – I need to change the 'playing file' without changing the page, I've never done anything like this before so I try accessing filename and src attributes and nothing, is there any way I can access the object and embed element and change the playing file? (obviously without using server-side as there’s no server lol)

cortic
06-17-2003, 11:07 AM
Ok, I thought if I can’t access a running vid I could maybe make an iframe and load it using a search string so I tried.. changed ‘mov’ to an iframe accessing a file named loader.htm then set src to loader.htm?56a .. but it turns out I can’t seem to even generate the object and embed elements, check my code:

MSobj = document.createElement("OBJECT");
MSobj.setAttribute('id','MediaPlayer');
MSobj.style.position='absolute';
MSobj.setAttribute('width','240');
MSobj.setAttribute('height','240');
MSobj.setAttribute('CLASSID','CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95');
MSobj.setAttribute('STANDBY','Loading Windows Media Player components...');
MSobj.setAttribute('TYPE','application/x-oleobject');
MSpar1 = document.createElement("PARAM");
MSpar1.setAttribute('NAME','FileName');
MSpar1.setAttribute('VALUE','56a.asx');
MSpar2 = document.createElement("PARAM");
MSpar2.setAttribute('NAME','ShowControls');
MSpar2.setAttribute('VALUE','False');
MSpar3 = document.createElement("PARAM");
MSpar3.setAttribute('NAME','ShowStatusBar');
MSpar3.setAttribute('VALUE','False');

NSemb = document.createElement("EMBED");
NSemb.style.position='absolute';
NSemb.setAttribute('TYPE','application/x-mplayer2');
NSemb.setAttribute('SRC','56a.asx');
NSemb.setAttribute('name','WinMedia');
NSemb.setAttribute('ShowStatusBar','false');
NSemb.setAttribute('ShowControls','0');
NSemb.setAttribute('WIDTH','240');
NSemb.setAttribute('HEIGHT','230');

MSobj.appendChild(MSpar1);
MSobj.appendChild(MSpar2);
MSobj.appendChild(MSpar3);
MSobj.appendChild(NSemb);
document.body.appendChild(MSobj);

maybe I’m jumping the gun a bit, I know IE hates setAttribute and tends to need caps at weird bits but NS isn’t showing anything … this is getting confusing, any help or suggestions would be more than welcome.

cortic
06-18-2003, 01:50 AM
well, the only thing i can come up with is making different html files for each asx file and loading them through the iframe, messy as hell and since there are like hundreds of movie clips its going to be a pain creating them, i'll sleep on it, hope somone can think of another solution by morning... save me a lot of work lol