Creating Media Player object using javascript

M

Mario Ciappara

I am currently embedding media player object in a web page using
javascript on the client and everything is working fine, until I close
the web page and open it again.

Upon doing so I realised that the previous media player object was
still im memory! Because it started playing the previous stream
without even showing the media player interface!

I know where my problem is. I am starting the Media player object
automatically by setting the 'AutoStart' Property to -1 and as a
consequence to this I have no control over the Media Player object
handle created.

Can anyone shed some light as to how to create the Media Player object
manually using Javascript and destroying it on unload of page manually
as well?

Is there any equivalent of the VBScript 'CreateObject' function? I
encounter some CreateActiveXControl function but not sure whether this
is what I require.

Any help would be greatly appreciated.

Below is my code.

Mario Ciappara


<%@ Page language="c#" Codebehind="TVGuide.aspx.cs"
AutoEventWireup="false" Inherits="iSystem1.TVGuide" %>
<%@ Register TagPrefix="cc1" Namespace="A_Collection"
Assembly="A_COLLECTION" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>TVGuide</title>
<meta content="Microsoft Visual Studio 7.0" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
<LINK href="EPG.css" type="text/css" rel="stylesheet">
</HEAD>
<body scroll="no" onload="StartMeUp()" onunload="CloseMeUp()">
<script>
function CloseMeUp()
{
document.TVGuide.Player.controls.stop();
}

function StartMeUp ()
{

if (document.all["MMSURL"].value != "")
{
document.TVGuide.Player.URL = document.all["MMSURL"].value ;
document.TVGuide.Player.controls.currentPosition =
document.all["POSITION"].value ;

}
}
</script>
<form id="TVGuide" method="post" runat="server">
<OBJECT id="Player" height="1" width="1"
classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" VIEWASTEXT>
<PARAM NAME="URL" VALUE="">
<PARAM NAME="rate" VALUE="1">
<PARAM NAME="balance" VALUE="0">
<PARAM NAME="currentPosition" VALUE="0">
<PARAM NAME="defaultFrame" VALUE="">
<PARAM NAME="playCount" VALUE="1">
<PARAM NAME="autoStart" VALUE="-1">
<PARAM NAME="currentMarker" VALUE="0">
<PARAM NAME="invokeURLs" VALUE="-1">
<PARAM NAME="baseURL" VALUE="">
<PARAM NAME="volume" VALUE="50">
<PARAM NAME="mute" VALUE="0">
<PARAM NAME="uiMode" VALUE="full">
<PARAM NAME="stretchToFit" VALUE="0">
<PARAM NAME="windowlessVideo" VALUE="0">
<PARAM NAME="enabled" VALUE="-1">
<PARAM NAME="enableContextMenu" VALUE="-1">
<PARAM NAME="fullScreen" VALUE="-1">
<PARAM NAME="SAMIStyle" VALUE="">
<PARAM NAME="SAMILang" VALUE="">
<PARAM NAME="SAMIFilename" VALUE="">
<PARAM NAME="captioningID" VALUE="">
<PARAM NAME="enableErrorDialogs" VALUE="0">
<PARAM NAME="_cx" VALUE="26">
<PARAM NAME="_cy" VALUE="26">
</OBJECT>
</form>
<INPUT id="POSITION" type="hidden" name="POS" runat="server"> <INPUT
id="MMSURL" type="hidden" name="URL" runat="server">
</body>
</HTML>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top