[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1146
  • Last Modified:

Embedded Windows Media Player in an ASP.NET page.

Hi,

I have embedded a Windows Media 9 Player in my ASP>NET page. I used the example in the Player SDK as shown below and control it through scripts. But In order to do that, the Object must be declared outside the Form tags. My problem is: how do I pass player related information, i.e. Player's current position, back to my ASP.NET code behind page? In the example below my variable "position" is not seen by the rest of the code so I can't access it. Can someone help?

Thank you,

<HTML>
<HEAD>
</HEAD>
<BODY>
<Form>
code
...
<\Form>

<OBJECT ID="Player" height="0" width="0"
  CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">
</OBJECT>
<INPUT TYPE="BUTTON" NAME="BtnPlay" VALUE="Play" OnClick="StartMeUp()">
<INPUT TYPE="BUTTON" NAME="BtnStop" VALUE="Stop" OnClick="ShutMeDown()">
<INPUT TYPE="BUTTON" NAME="BtnPosition" VALUE="Position" OnClick="ReadPosition()">
<SCRIPT>
<!--

var position;

function StartMeUp ()
{
    Player.URL = "laure.wma";
}

function ShutMeDown ()
{
    Player.controls.stop();
}

function ReadPosition()
{
    position = Player.controls.currentPosition;();
}

-->
</SCRIPT>
</BODY>
</HTML>

0
sambec
Asked:
sambec
  • 4
1 Solution
 
rkotowicCommented:
Make another frame on this page with your function ReadPosition(), then at your request you will POST value of position to ASP.NET code.

Goodluck
0
 
riyasjefCommented:
Hi

Modify form  and put a hidden field in that

<Form name="frm" method="post" action="uraspx.aspx">

code
...



<input type="hidden" name="hdnPosition">

<\Form>


Also change the fn to

function ReadPosition()
{
    position = Player.controls.currentPosition;();
    document.hdnPosition.value=position;
    document.hdnPosition.submit();
}

and access the postion from the aspx page like


String pos=Request.Form("hdnPosition")


RJ
0
 
rkotowicCommented:
But note, without addidtional frame you will loose contents of page/break playing of movie when you submit forms fields.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
sambecAuthor Commented:
Hi riyasjef,

I have tried your suggestion and it does not work, I get a HTML error saying that "document.hdnPosition" is null or not an object.

I had tried using a hidden field before and got the same message. The problem is that the hidden field has to be declared within the Form tags to return anything to the ASP.NET page. Since the ReadPosition function is outside the Form tags it cannot acces the hidden field to change its value.

I have not yet tried the other suggestion of the additional frame, but I feer it will yield the same results.
0
 
rkotowicCommented:
Use:

document.formName.hdnPosition.value=position;
               ------------

0
 
rkotowicCommented:
Sorry, in your example form name is set to frm, so:

document.frm.hdnPosition.value=position;
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now