11-24-2005, 01:15 AM
|
#1
|
|
Registered User
Join Date: Oct 2005
Posts: 39
|
Controlling Windows Media with a Flash Interface
Is it possible to control a Windows Media File with a Flash interface.
Is there a tutorial out there that does this. My company is stuck on the whole Windows DRM thing...sigh
I was hoping that I could build the controls into Flash and treat Windows Media as a controllable embed
has this /can this be done ?
g
|
|
|
11-24-2005, 01:46 AM
|
#2
|
|
rather be programming
Join Date: Feb 2005
Location: City of Angels
Posts: 10,141
|
there is an answer in the tutorials here.
EDIT: i can't find the link right now, sorry.
EDIT2: opps, i was thinking audio not video. Couldn't you always load it into flash and control and build a custom interface like that.
__________________
trace("Good bye Flash.") Log.i(TAG, "Hello Droid");
Last edited by Flash Gordon; 11-24-2005 at 01:51 AM.
|
|
|
11-24-2005, 01:46 AM
|
#3
|
|
Super Moderator
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
|
Howdy...
I probably won't be able to give you much help but this is what I know...
Flash cannot directly control something that is outside of the Flash, ie WMP in this case...
What you need to figure out is to see if you can control WMP via JavaScript...
Once you figure that out, create that to be the JavaScript function and call that function from Flash via getURL() function call...
If you cannot figure out how to control WMP via JavaScript, you probably cannot do what you are looking for...
|
|
|
11-26-2005, 02:43 AM
|
#4
|
|
Member
Join Date: Feb 2002
Posts: 42
|
You can control it by javascript & getURL very simply
I use fscommand to control it becasue if you pause the play in getURL it restarts the file
So you need to add a VBScript to control the fscommand as follow:
Code:
<SCRIPT LANGUAGE="VBScript">
<!--
// Catch the fscommand in ie with vbscript, and pass
// it on to JavaScript.
Sub control_FSCommand(ByVal command, ByVal args)
call control_DoFSCommand(command, args)
end sub
//-->
</SCRIPT>
then add a js function as follows:
Code:
function control_DoFSCommand(command, args) {
if (command == "changeVol") {
Player.settings.volume = args;
}
if (command == "playVid") {
Player.controls.play();
}
if (command == "pauseVid") {
Player.controls.pause();
}
if (command == "stopVid") {
Player.controls.stop();
}
if (command == "ffVid") {
Player.controls.fastForward();
}
if (command == "rewVid") {
Player.controls.fastReverse();
}
if (command == "fsVid") {
Player.fullScreen = true;
}
}
then in your actionscript call it by the fscommand for example:
Code:
fscommand("playVid",null);
to see what you can control in the object model have a look at this link
Object Model reference
Cheers
Andy
|
|
|
11-29-2005, 12:05 AM
|
#5
|
|
Senior Member
Join Date: Feb 2004
Location: Toronto, Ontario
Posts: 1,301
|
Sure, yes you can do this, like Cyan says. I just recently finished a project that will be doing this exact thing for the same reasons (read: DRM).
You just need to use fscommand/geturl to call javascript functions that control the windows media player object/activex control. Be advised that controlling the player is limited on browsers other than IE+Windows, so have a contingency for that.
__________________
the beers just sit there, silently staring, and mocking the mistakes my animal mind makes sometimes - Spyre
|
|
|
12-02-2005, 04:43 PM
|
#6
|
|
Registered User
Join Date: Dec 2005
Posts: 2
|
Do I need to include the VB script in a seperate asp or can I include in the html file? I'm confused as to what code goes where, (except for the actionscript obviously). Also where do I refer to the specific activeX component.... if my component had a id of "mp" would my java look like this?
if (command == "playVid") {
mp.controls.play();
thanks
|
|
|
12-02-2005, 05:45 PM
|
#7
|
|
Senior Member
Join Date: Feb 2004
Location: Toronto, Ontario
Posts: 1,301
|
I have no idea why you'd need VBScript, you can do it all with just Javascript which is supported on more browsers.
Basically you create a series of javascript functions in the >head< tags of the html page that holds your flash applet. Then, you can use geturl or fscommand to call those JS functions, which will then control your embedded Media Player ActiveX control.
You can also pass feedback on the state of the media player back into flash which can be handy (ie. so your flash movie will know, is the media player playing, buffering, stopped, etc).
__________________
the beers just sit there, silently staring, and mocking the mistakes my animal mind makes sometimes - Spyre
|
|
|
12-02-2005, 06:58 PM
|
#8
|
|
Registered User
Join Date: Dec 2005
Posts: 2
|
Here's what I got... it no worky though... I followed the steps as best as i could. I am intriuged by using just java but macromedia refers to it as neccesary here:
http://www.macromedia.com/cfusion/kn...fm?id=tn_04160
Code:
<head>
<SCRIPT LANGUAGE="VBScript">
<!--
// Catch the fscommand in ie with vbscript, and pass
// it on to JavaScript.
Sub controls_FSCommand(ByVal command, ByVal args)
call controls_DoFSCommand(command, args)
end sub
//-->
</SCRIPT>
<script language="JavaScript">
function controls_DoFSCommand(command, args) {
if (command == "changeVol") {
mp.settings.volume = args;
}
if (command == "playVid") {
mp.controls.play();
}
if (command == "pauseVid") {
mp.controls.pause();
}
if (command == "stopVid") {
mp.controls.stop();
}
if (command == "ffVid") {
mp.controls.fastForward();
}
if (command == "rewVid") {
mp.controls.fastReverse();
}
if (command == "fsVid") {
mp.fullScreen = true;
}
}
</script>
</head>
<body>
<object
classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"
type="application/x-oleobject" name="mp"
width="240" height="282"
standby="Loading Microsoft® Windows® Media Player components..." id="mp">
<!-- PUT THE URL OF THE VIDEO HERE! =================================================== -->
<param name="FileName" value="file.asx">
<!-- ================================================================================== -->
<param name="SAMIFileName" value="media/ford.smi">
<param name="ShowCaptioning" value="0">
<param name="AutoStart" value="0">
<param name="ShowControls" value="0">
<param name="ShowStatusBar" value="0">
<param name="AnimationAtStart" value="0">
<param name="TransparentAtStart" value="1">
<param name="ShowGotoBar" value="0">
<param name="EnableContextMenu" value="0">
<param name="DisplayForeColor" value="16777215">
<param name="DisplayBackColor" value="0">
<param name="VideoBorderColor" value="500000">
</object>
</p>
<p>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" name="controls" width="240" height="80" id="controls">
<param name="movie" value="controsl.swf">
<param name="quality" value="high">
<embed name="controls"></embed>
<embed src="controsl.swf" width="240" height="80" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="controls"></embed>
</object>
</p>
</body>
Last edited by Nein Numb; 12-06-2005 at 02:27 AM.
|
|
|
12-19-2005, 04:59 PM
|
#9
|
|
Registered User
Join Date: Dec 2005
Posts: 5
|
i wanna know if u found a solution Nein Numb ?
Im highly interested with this but i aint a genius so i tried on my side but no luck still
anybody can help ?
|
|
|
12-20-2005, 03:48 AM
|
#10
|
|
Senior Member
Join Date: Feb 2004
Location: Toronto, Ontario
Posts: 1,301
|
Quote:
|
Originally Posted by themaster
i wanna know if u found a solution Nein Numb ?
Im highly interested with this but i aint a genius so i tried on my side but no luck still
anybody can help ?
|
Well today I was reading about the ExternalInterface class in Flash8 and it looks to provide excellent integration with javascript which would control the media player...so, yeah, check it out
__________________
the beers just sit there, silently staring, and mocking the mistakes my animal mind makes sometimes - Spyre
|
|
|
| Thread Tools |
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT. The time now is 06:03 AM.
///
|
|