By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,742 Members | 773 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,742 IT Pros & Developers. It's quick & easy.

Creating customs controls for a embeded video

P: n/a
How do I create custom controls for an embeded video. I need stop,
play, pause, etc. Any thoughts?

Sep 6 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Can anyone tell me why the stop function below does not work:

<html>
<head>
<title>Video Page</title>
<script type="text/javascript">
function stopVideo()
{
ourVideo.controls.stop();
}
</script>
</head>
<body bgcolor="#999999">
<OBJECT ID="ourVideo" WIDTH=320 HEIGHT=240
CLASSID="CLSID:05589FA1-C356-11CE-BF01-00AA0055595A">
<PARAM NAME="FileName" VALUE="crabs.avi">
</OBJECT>
<form name="myVideo">
<input type="button" value="Stop" onClick="stopVideo()">
</form>
</body>
</html>

Sep 7 '05 #2

P: n/a
je*********@hotmail.com schrieb:
Can anyone tell me why the stop function below does not work:

<html>
<head>
<title>Video Page</title>
<script type="text/javascript">
function stopVideo()
{
ourVideo.controls.stop();
Try
ourVideo.stop();
or
document.getElementById("ourVideo").stop();
something like this should work.
}
</script>
</head>
<body bgcolor="#999999">
<OBJECT ID="ourVideo" WIDTH=320 HEIGHT=240
CLASSID="CLSID:05589FA1-C356-11CE-BF01-00AA0055595A">
<PARAM NAME="FileName" VALUE="crabs.avi">


It isn't a very good idea to embed an avi-file. Better use WindowsMedia-,
RealMedia- or Quicktime-files. You can get free versions at least from
WindowsMedia Encoder and RealMedia-Encoder (aka helix producer) bei microsoft
and real, these free tools are limited in functionality but that's still much
better than embedding an avi.

And one other little thing to remember: When requesting help in a newsgroup,
please give a description of the problem, in this case, asking for help in
creating custom controls for *Windows Media Player" would bring up more answers
then first just asking a very general question and then pasting some code where
the people first have to search for the special problem (there's more then one
player that can get embedded!).

greetz

martin
Sep 8 '05 #3

P: n/a

je*********@hotmail.com wrote:
Can anyone tell me why the stop function below does not work:

<html>
<head>
<title>Video Page</title>
<script type="text/javascript">
function stopVideo()
{
ourVideo.controls.stop();
}
</script>
</head>
<body bgcolor="#999999">
<OBJECT ID="ourVideo" WIDTH=320 HEIGHT=240
CLASSID="CLSID:05589FA1-C356-11CE-BF01-00AA0055595A">
<PARAM NAME="FileName" VALUE="crabs.avi">
</OBJECT>
<form name="myVideo">
<input type="button" value="Stop" onClick="stopVideo()">
</form>
</body>
</html>


See how I do it at http://www.cwdjr.info/media/playersRoot.php . You do
not need any javascript for the controls you want, as more powerful
code is built into either the WMP or Real player - both of which are
about 3 tomes the size of a small browser such as Firefox or Opera. If
you use only one media type I suggest .wmv with the corresponding .wax
redirector file as the WMP is the most common player. You can in
addition add a Real .rm video file with the corresponding .ram
redirector file if you want to be seen by the few who have only the
Real player. If no players are installed, the video controls will not
appear and the user of the browser will not even know that there is a
video on the page unless you give a statement to this effect.

The code you were attempting to use depends on an ActiveX object for
the WMP as indicated by the unique hex id for the WMP. Thus your video
could not be seen on a browser that does not have ActiveX installed for
the WMP, for example. Only IE browsers and the most recent Netscape
browsers come with ActiveX installed for the WMP. There are WMP ActiveX
plugins for some of the other browsers, but you can not count on their
being installed. Installing some of these requires a good bit of
effort, sometimes requiring changes in the registry. This perhaps is
more than you can expect casual computer users to do.

You also need to consider your audience. You can handle only about 30
kbps for streaming on dialup, and the image must be kept very small. If
you use a DSL or cable streaming bit rate, the video quality is much
better, but the buffering time for playing on dialup is very excessive
- often many minutes. Many commercial sites offer a choice of 2 or 3
streaming rates to overcome this problem.

The general object method I use works on recent versions of IE and
close relatives of it such as MSN9, Avant, and MyIE2. It also works on
recent versions of Mozilla, Firefox, Netscape, and Opera. If you use
the simple WMP method such as in the case of my WMP link on the page
quoted, you also have the advantage that the video likely will show
even with javascript turned off, as no script is used in the code. You
will have to allow enough height in the object for the video above the
control bar as I note on my page.

Sep 8 '05 #4

P: n/a

cw******@yahoo.com wrote:
je*********@hotmail.com wrote:
Can anyone tell me why the stop function below does not work:

<html>
<head>
<title>Video Page</title>
<script type="text/javascript">
function stopVideo()
{
ourVideo.controls.stop();
}
</script>
</head>
<body bgcolor="#999999">
<OBJECT ID="ourVideo" WIDTH=320 HEIGHT=240
CLASSID="CLSID:05589FA1-C356-11CE-BF01-00AA0055595A">
<PARAM NAME="FileName" VALUE="crabs.avi">
</OBJECT>
<form name="myVideo">
<input type="button" value="Stop" onClick="stopVideo()">
</form>
</body>
</html>


See how I do it at http://www.cwdjr.info/media/playersRoot.php . You do
not need any javascript for the controls you want, as more powerful
code is built into either the WMP or Real player - both of which are
about 3 tomes the size of a small browser such as Firefox or Opera. If
you use only one media type I suggest .wmv with the corresponding .wax
redirector file as the WMP is the most common player. You can in
addition add a Real .rm video file with the corresponding .ram
redirector file if you want to be seen by the few who have only the
Real player. If no players are installed, the video controls will not
appear and the user of the browser will not even know that there is a
video on the page unless you give a statement to this effect.

The code you were attempting to use depends on an ActiveX object for
the WMP as indicated by the unique hex id for the WMP. Thus your video
could not be seen on a browser that does not have ActiveX installed for
the WMP, for example. Only IE browsers and the most recent Netscape
browsers come with ActiveX installed for the WMP. There are WMP ActiveX
plugins for some of the other browsers, but you can not count on their
being installed. Installing some of these requires a good bit of
effort, sometimes requiring changes in the registry. This perhaps is
more than you can expect casual computer users to do.

You also need to consider your audience. You can handle only about 30
kbps for streaming on dialup, and the image must be kept very small. If
you use a DSL or cable streaming bit rate, the video quality is much
better, but the buffering time for playing on dialup is very excessive
- often many minutes. Many commercial sites offer a choice of 2 or 3
streaming rates to overcome this problem.

The general object method I use works on recent versions of IE and
close relatives of it such as MSN9, Avant, and MyIE2. It also works on
recent versions of Mozilla, Firefox, Netscape, and Opera. If you use
the simple WMP method such as in the case of my WMP link on the page
quoted, you also have the advantage that the video likely will show
even with javascript turned off, as no script is used in the code. You
will have to allow enough height in the object for the video above the
control bar as I note on my page.


Here is a simple demo for you at
http://www.cwdjr.info/media/streamVideoWMP.html . It is an awful
quality experimental clip from an old silent film, but it will do for a
demo. I streamed it at a very low rate so that most on dialup can view
it without undue buffering time, and this is part of the reason for the
poor quality. This is just the bare bones object code that you can see
by right clicking. I just used html 4.01 strict for this demo. The page
I quoted in my last post shows you how to write the .wax redirector
file that points to the .wmv file that contains the video.

Although I used no javascript, I find that the video and control bar do
not show when script is turned off on Firefox, and likely all other
browsers. My guess is that the WMP is using script within the WMP
program, and Microsoft likely would use their Jscript.

That WMP player is huge, and in many respects it is more like a browser
than an add-on program. I even find that I get records of visits from
the WMP and Real players at my domain rather than visits for the
browser being used at the time.

Sep 8 '05 #5

P: n/a

cw******@yahoo.com wrote:
Although I used no javascript, I find that the video and control bar do
not show when script is turned off on Firefox, and likely all other
browsers. My guess is that the WMP is using script within the WMP
program, and Microsoft likely would use their Jscript.


The situation is completely different when you use the Real player
rather than the WMP. If you turn off javascript for the browser, the
Real player still pops up and plays normally using either the classic
ram files or using SMIL. Unlike the WMP, the Real player apparently
does not use internal script that depends on the settings of the
browser.

The Real player will play many more file types than the WMP also,
including the Windows audio and video files as well as support most of
W3C SMIL2. The unfortunate thing is that many more computers have the
WMP installed than have the Real player installed. However there is
nothing to prevent you from offering both Windows and Real versions of
audio and video files on a web page.

The Real player does act strange in one respect. It will play both
Windows audio and video files locally on the computer. However, when
you stream the media from a server, the audio files are played
normally, but only the audio portion of a Windows video file is played.
I so far have not been able to find out what is causing this strange
action. Of course you can overcome this problem by providing a Real
video file for the Real player.

Sep 9 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.