Re: Custom control

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Ok to answer your questions ,i had done all that you suggested except using
the web developer extension of Fire fox. After exploring that i found out
that the object nodes where in the document. The funny thing is that my fast
forward, play and volume controls work but my pause and stop buttons don't.
They simply stop play and return false for controls.isAvailable('Pause') /
controls.isAvailable('Stop'). I don't really care about stop but the pause
functioanltiy is key. Anyway, thanx for your help. I will explore this
further on my own. I will let you know what happens...

--Papanii


"Neil Smith [MVP Digital Media]" <neil@xxxxxxxxxx> wrote in message
news:491p02taq4m1tihjghfgkg56lra27n1666@xxxxxxxxxx
Don't think so, that form might be runat server, but if you View ->
Source of the resuilting webpage, you'll still have the Object tags
output, right ?

I'd load the page in Firefox, get the Web Developer Extension and view
the DOM nodes to assure yourself that the object nodes are in the
document. Broken DOMs (malformed XHTML) can also cause this effect.

Are you sure you're running the script to attach to the object DOM
node by using a body onload() handler ? That object can only be
interrogated when the entire DOM has been loaded and parsed.

One last thing to check, make sure you haven't set the CSS
class="videoSection" to be display:none, or it's contents are removed
from the DOM entirely at runtime.

Cheers - Neil

On Sun, 5 Mar 2006 21:24:01 -0800, "Papanii Okai" <papanii@xxxxxxxxxx>
wrote:

Could it have something to do with the fact that the object tag is inside
a
table that is inside the <form id="form1" runat="server"> tag?

--Papanii


"Papanii Okai" <papanii@xxxxxxxxxx> wrote in message
news:O3QpSENQGHA.2828@xxxxxxxxxxxxxxxxxxxxxxx
There seems to be something fishy goign on. below is my embedding media
player code..

<td class="videoSection">
<object id='MediaPlayer' name="MediaPlayer" width="280" height="200"
classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"
standby="Loading Windows Media Player components...">
<param name="autostart" value="false"/>
<param name="uiMode" value="none" />
<param name="enabled" value="true" />
<param name="CanPause" value="Yes" />
<param name="volume" value="50" />
</object>
</td>

var player = document.getElementById(MediaPlayer);
i get teh error MediaPlayer is not defined...

Any ideas?
--Papanii




"Papanii Okai" <papanii@xxxxxxxxxx> wrote in message
news:OtaHSqMQGHA.3672@xxxxxxxxxxxxxxxxxxxxxxx
yes i did remove the play() method from the volume function. It is
still
not working. Below is my pause method...

function pause()
{
if(document.MediaPlayer.controls.isAvailable('pause'))
{
if(paused == true)
{
alert("paused");
document.MediaPlayer.controls.play();
paused = false;
}
else
{
document.MediaPlayer.controls.pause();
alert(document.MediaPlayer.playState);
paused = true;
}
}
else
{
alert("Not Available");
}
}


i even checked the playstate at the end of the pause and it returns 1.
the alert "Not available" is fired. Is there a way to set or make
certain controls like play, pause, stop available? Like a property or
something?

Thanx..

i still get the result
"Neil Smith [MVP Digital Media]" <neil@xxxxxxxxxx> wrote in message
news:iuul02hc3kau5ip812dkgtvmfu1ghji0a6@xxxxxxxxxx
Did you remove the play() function from the volume code yet ?

The other thing to do is to set the return state of your javascript.

By default, the browser will try to "navigate" to a URL when clicking
a link. By default, the player will stop when it receives a
"navigating" event. The key is to return false; after your javascript
href code, thus cancelling the default navigate event in the browser.

HTH
Cheers - Neil

On Fri, 3 Mar 2006 11:24:09 -0800, "Papanii Okai" <papanii@xxxxxxxxxx>
wrote:

Ok, so i understand about the stop. With respect to the pause and the
volume
controls,whenver i press either button, play stops. Below shows how i
iimplemented the volume control button.

--Code

<td>
<a href="javascript:volumeUp()">
<img src="images/volumeButtonUpOver.gif" alt="volumeUp" id="volumeU"
name="volumeU"
onmouseover="document.volumeU.src='images/volumeButtonUp.gif'"
onmouseout="document.volumeU.src='images/volumeButtonUpOver.gif'" />
</a>
</td>
--End Code
Any ideas...

Thanx
--Papanii


"Neil Smith [MVP Digital Media]" <neil@xxxxxxxxxx> wrote in message
news:j32h02tq2ovm7toidtvk8dfjbfdogescup@xxxxxxxxxx
On Thu, 2 Mar 2006 10:50:47 -0800, "Papanii Okai"
<papanii@xxxxxxxxxx>
wrote:

Hi Guys,
i have two little bugs i can't seem to figure out.
Firstly,
I
have
a custom web interface for my media player. Now i have implemented
certain
player events such as play(), stop(), next() etc. Now for some
reason,
some
of my events misbehave when executed. For example below is a snippet
of
code...

//code snippet begins...
function play()
{

document.MediaPlayer.url ="sample.mp3";
if(document.MediaPlayer.controls.isAvailable('Play'))
{
document.MediaPlayer.controls.play();
}
else
{
alert("Not Available");
}
}
function stop()
{
if(document.MediaPlayer.controls.isAvailable('stop'))
{
document.MediaPlayer.controls.stop();
}
else
{
alert("Not Available");
}
}


//code ends...


each time I press the stop button, the alert is fired. Which meas
isAvailable is returning false. Why??? The same thing happens for
pause(),
and next(). Any suggestions or ideas?


The player isn't necessarilty going to fire events in a synchronous
order. So it may still be in a "play" or other state a few moments
after you fire the button handler. Personally I wouldn't worry too
much about if stop() is available or not, it shouldn't fire any
error
(and it's trappable if it does)


The second problem I am having is for my volume control, whenever I
press
the custom volume increase or decrease button, the music file starts
from
the beginning.
below is the code for increase volume...

//code

function volumeUp()
{
var vol = document.MediaPlayer.settings.volume;
vol += 15;
document.MediaPlayer.settings.volume = vol;
document.MediaPlayer.controls.play();
}
//end code.
Any ideas...?


Because document.MediaPlayer.controls.play(); ?

Why are you calling playm, when the player is according to your
description, already playing ? I'd trim that for a start, setting
volume has no relation to the clip transport control.

Cheers - Neil








.


Quantcast