HighTechTalks DotNet Forums  

asp.net and windows media player

Dotnet Scripting microsoft.public.dotnet.scripting


Discuss asp.net and windows media player in the Dotnet Scripting forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Eveready
 
Posts: n/a

Default asp.net and windows media player - 08-22-2005 , 12:59 PM






Hello,

I am attempting to embed a WMP object in a web page using VB.net. The
following code works in a straight html page, but gives a
"Microsoft JScript runtime error: 'Player1' is undefined"
error when the button is clicked.

Can any one tell me what I am doing wrong?

<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<OBJECT id="Player1" height="300" width="300"
classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" VIEWASTEXT>
<PARAM NAME="URL" VALUE="video/TimeCodeTest.wmv">
</OBJECT>

<INPUT type="button" value="Button" onclick="goTime();">

<script>
function goTime(){
Player1.controls.currentPosition = '90';
}
</script>
</form>
</body>
</HTML>

Thanks !

Reply With Quote
  #2  
Old   
Eveready
 
Posts: n/a

Default RE: asp.net and windows media player - 08-23-2005 , 05:51 PM






The problem is that the WMP is inside the form tag, and as such must be
reffered to in the javascript as document.forms[0].player1

"Eveready" wrote:

Quote:
Hello,

I am attempting to embed a WMP object in a web page using VB.net. The
following code works in a straight html page, but gives a
"Microsoft JScript runtime error: 'Player1' is undefined"
error when the button is clicked.

Can any one tell me what I am doing wrong?

body MS_POSITIONING="GridLayout"
form id="Form1" method="post" runat="server"
OBJECT id="Player1" height="300" width="300"
classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" VIEWASTEXT
PARAM NAME="URL" VALUE="video/TimeCodeTest.wmv"
/OBJECT

INPUT type="button" value="Button" onclick="goTime();"

script
function goTime(){
Player1.controls.currentPosition = '90';
}
/script
/form
/body
/HTML

Thanks !

Reply With Quote
  #3  
Old   
Ric Paton
 
Posts: n/a

Default Re: asp.net and windows media player - 08-29-2005 , 10:57 AM



Client side, away from .Net, that's not true.

A simple...

document.getElementById("myPlayerID").properties

....once the element has rendered should work regardless of where the
<object> tag sits in the markup. True in IE you can reference the
element direct simply using it's ID like your initial example, but it's
not standards compliant and a bad habbit to get into.

Also..

document.forms["formname"].elements["elementname"].property

....shouldn't work either as it is referring to the name attribute, no
the ID. Perhaps .Net provides a name for you automatically (it
shouldn't, that's a deprecated attribute). IE does have some "oddities"
though when handling names/ids on the page so perhaps that is going on,
although it shouldn't be relied on and no other browser deals with these
attributes in this way.

So barring IE's oddness, personally I would stick with the w3c method,
getElementsById.

Hope this helps.

Ric.


Eveready wrote:
Quote:
The problem is that the WMP is inside the form tag, and as such must be
reffered to in the javascript as document.forms[0].player1

"Eveready" wrote:


Hello,

I am attempting to embed a WMP object in a web page using VB.net. The
following code works in a straight html page, but gives a
"Microsoft JScript runtime error: 'Player1' is undefined"
error when the button is clicked.

Can any one tell me what I am doing wrong?

body MS_POSITIONING="GridLayout"
form id="Form1" method="post" runat="server"
OBJECT id="Player1" height="300" width="300"
classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" VIEWASTEXT
PARAM NAME="URL" VALUE="video/TimeCodeTest.wmv"
/OBJECT

INPUT type="button" value="Button" onclick="goTime();"

script
function goTime(){
Player1.controls.currentPosition = '90';
}
/script
/form
/body
/HTML

Thanks !

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.