Re: Help! - Controlling Embedded Video



On 19 Oct 2006 20:12:55 -0700, janefield2002@xxxxxxxxx wrote:

Hi All,

I have an embedded video in an HTML page with no controls (but the user
can right click on the video for options such as pause play etc.).

That can be disabled by setting the player param :
<param name="enableContextMenu" value="false" />

Or by setting it in script using
player.enableContextMenu = false;


In all discussion below, please acquire a handle to the player object
in the following way : Let's say WMP is a "global" object in your
script tags, i.e. it's set *outside* any functions in javascript -


var player = new Object();

function Page_Onload() {
player = document.getElementById("MediaPlayer");
}


Here we've created a global javascript variable, then called the
Page_Onload function using the HTML onload event handler or better
using a proper cross browser addEvent script (look that up ;-)

If you stick to using that, most examples will work without assuming
IE's proprietary model which makes any ActiveX controls automatically
available with their ID name (which is basically an error anyway)


1. Rewind, but NOT fast forward.


With access to a Streaming Media server, you can set these options on
the server side. Do you have access to such a service ?

If not the user experience is going to be very limited, because you
have no control over the ff/rw process, specifically that the user
gets to re-download the file again if they have to rewind.

So this is an infrastructure question rather than a couple of lines of
script question.


2. Pause and Play.
3. Mute


Looking at your embedding code below, it's about 10 years out of date
and written for WMP6.4 (released with IE5 on Win95). You really want
to update that to be correct for WMP7 and later, because the
compatiblity layer is not guaranteed to be supported indefinitely.

With the correct embedding code, your script would then call (on a
button click)

player.controls.pause();
player.controls.play();

and

player.settings.mute = true / false;

[Note that Mute is a property of the Settings object, not a method of
the Controls object ;-)]

You can also query the player in script by asking for

player.controls.isAvailable('pause')

which will return true or false for pause, fastForward, fastReverse
capability, and so on. This is documented in the WM SDK online at MSDN
http://msdn.microsoft.com/library/en-us/wmplay10/mmp_sdk/controlsplay.asp?frame=true
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmplay10/mmp_sdk/controlsplay.asp


4. Zoom (I want to know how to control this - i.e. allow *only* full
screen, dont allow any zoom or allow 50%, 100%, 200% AND Full screen
and Maybe even restrict full screen view for some users)


Seems a very vague requirement, why is this important to you ?


If I cannot do the above without controls, then please advise on the
HTML to allow the above features. My source code is at the end of this
message.

I'd consider swapping that for something more like this :


<object id="MediaPlayer"
classid="clsid:6bf52a52-394a-11d3-b153-00c04f79faa6"
type="video/x-ms-wma" width="352" height="348">
<param name="enableContextMenu" value="false" />
<param name="windowlessvideo" value="true" />
<param name="autostart" value="true" />
<param name="showFrame" value="true" />
<param name="invokeURLs" value="false" />
<param name="stretchtofit" value="false" />
<param name="url" value="http://path/to/stream.wmv"; />
<param name="uimode" value="mini" />
<!--[if !IE]> <-->
<object id="MediaPlayer2" type="video/x-ms-wma" width="352"
height="348" data="http://path/to/stream.wmv";>
<param name="filename"
value="http://path/to/stream.wmv"; />
<param name="showcontrols" value="0" />
<param name="animationatstart" value="0" />
<param name="transparentatstart" value="1" />
<param name="showaudiocontrols" value="1" />
<param name="showtracker" value="0" />
<param name="showdisplay" value="0" />
<param name="showstatusbar" value="1" />
</object>
<!--> <![endif]-->
</object>


#2 How can I prevent a user from accessing a file directly from Windows
Media Player, forcing him to look at it in an embedded HTML page?


You can't really *force* anybody to do anything.

If you mean "how can I hide my stream URL" ? Don't bother is my
advice. It's trivial to extract the stream URL using a wide range of
freely avaiable tools. If you mean instead "how can I place a web page
with my player, *inside* WMP's now playing are - take a look at the
HTMLView documentation, which should still be supported in WMP11 :

http://www.microsoft.com/windows/windowsmedia/howto/articles/htmlviewsupport.aspx
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmpsdk11/mmp_sdk/displayingwebpagesinwindowsmediaplayer.asp


HTH
Cheers - Neil


Thanks!


HTML SOURCE

========================================================

<OBJECT ID="MediaPlayer"
classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"

CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715";
standby="Loading Microsoft Windows Media Player components..."

TYPE="application/x-oleobject" width="320" height="240">

<PARAM NAME="FileName" VALUE="mms://myip/tvshows/show1.wmv">
<PARAM NAME="AnimationatStart" VALUE="true">
<PARAM NAME="TransparentatStart" VALUE="true">
<PARAM NAME="AutoStart" VALUE="true">
<PARAM NAME="ShowControls" VALUE="false">
<PARAM NAME="ShowPositionControls" VALUE="0">
<PARAM NAME="StretchToFit" VALUE="true">

<Embed TYPE="application/x-mplayer2"

pluginspage="http://www.microsoft.com/isapi/redir.dll?prd=windows&sbp=mediaplayer&ar=Media&sba=Plugin&";
SRC="mms://myip/tvshows/show1.wmv"
------------------------------------------------
Digital Media MVP : 2004-2006
http://mvp.support.microsoft.com/mvpfaqs
.