Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 11-24-2005, 01:15 AM   #1
grahama
Registered User
 
Join Date: Oct 2005
Posts: 39
Question 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
grahama is offline   Reply With Quote
Old 11-24-2005, 01:46 AM   #2
Flash Gordon
rather be programming
 
Flash Gordon's Avatar
 
Join Date: Feb 2005
Location: City of Angels
Posts: 10,140
Default

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.
Flash Gordon is offline   Reply With Quote
Old 11-24-2005, 01:46 AM   #3
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
Default

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...
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 11-26-2005, 02:43 AM   #4
spamtheman
Member
 
Join Date: Feb 2002
Posts: 42
Default

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
spamtheman is offline   Reply With Quote
Old 11-29-2005, 12:05 AM   #5
Rossman
Senior Member
 
Rossman's Avatar
 
Join Date: Feb 2004
Location: Toronto, Ontario
Posts: 1,301
Send a message via ICQ to Rossman
Default

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
Rossman is offline   Reply With Quote
Old 12-02-2005, 04:43 PM   #6
Nein Numb
Registered User
 
Nein Numb's Avatar
 
Join Date: Dec 2005
Posts: 2
Default

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
Nein Numb is offline   Reply With Quote
Old 12-02-2005, 05:45 PM   #7
Rossman
Senior Member
 
Rossman's Avatar
 
Join Date: Feb 2004
Location: Toronto, Ontario
Posts: 1,301
Send a message via ICQ to Rossman
Default

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
Rossman is offline   Reply With Quote
Old 12-02-2005, 06:58 PM   #8
Nein Numb
Registered User
 
Nein Numb's Avatar
 
Join Date: Dec 2005
Posts: 2
Default

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.
Nein Numb is offline   Reply With Quote
Old 12-19-2005, 04:59 PM   #9
themaster
Registered User
 
Join Date: Dec 2005
Posts: 5
Unhappy

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 ?
themaster is offline   Reply With Quote
Old 12-20-2005, 03:48 AM   #10
Rossman
Senior Member
 
Rossman's Avatar
 
Join Date: Feb 2004
Location: Toronto, Ontario
Posts: 1,301
Send a message via ICQ to Rossman
Default

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
Rossman is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Developing a flash site, Part1: Some thoughts Bloom22 Other Flash General Questions 6 09-29-2006 02:10 AM
CyanBlue's 5000th Post - Useful Threads List CyanBlue Projectors and CDs 104 02-25-2005 01:13 PM
scrollBar on Flash Exchange cdeg Components 5 05-03-2004 07:13 PM
Streaming Flash Player 6 simail Other Flash General Questions 7 04-03-2002 11:14 AM
Using 'Media Player 2' with 'VideoRenderer' application types from within flash? Caramoon ActionScript 1.0 (and below) 3 06-12-2001 03:37 AM


All times are GMT. The time now is 09:39 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.