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>

sambecAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.