FLV Player not works in IE Browser? - html

I have the following piece of code which play the flv file,
<embed align="middle" width="185" height="121"
pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" allowfullscreen="true"
allowscriptaccess="sameDomain"
name="vidplayer" bgcolor="#eae7db" quality="high" f
lashvars="file=<?= $vUrl; ?>" src="scripts/flvplayer.swf" />
Above code which works only in FF,chrome not in IE Browser.
Also i refered link How to embed a SWF file in an HTML page? changed the above code like below,
<object width="185" height="121">
<param name="movie" value="<?php echo BASE_URL; ?>scripts/flvplayer.swf">
<embed align="middle" width="185" height="121"
pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" allowfullscreen="true"
allowscriptaccess="sameDomain" name="vidplayer" bgcolor="#eae7db"
quality="high" flashvars="file=<?= $vUrl; ?>"
src="scripts/flvplayer.swf" >
</embed>
</object>
This above code works only in FF not in Chrome and IE.
How can i play my flv file in all browsers ?

Try this way.
<script type="text/javascript">
var flashvars = {};
var params = {};
var attributes = {};
flashvars.mp3="mast.mp3";
var so = new swfobject.embedSWF("player.swf", "myContent", "300", "120", "9.0.0",true, flashvars, params, attributes);
so.write("myContent");
</script>
and have a look at this Documentation.

Related

actionscript full screen not allowed

This is my code to add the button onto stage
private function add_fullScreenBtn(height:Number):void
{
button_fullScr = new Sprite();
button_fullScr.useHandCursor = true;
button_fullScr.buttonMode = true;
button_fullScr.mouseChildren = false;
button_fullScr.x = height;
button_fullScr.y = btn_y;
var fullScr_Btn:Bitmap = new fullScreenImage();
button_fullScr.addChild(fullScr_Btn);
button_fullScr.addEventListener(MouseEvent.CLICK, fullScreenHandler);
addChild(button_fullScr);
}
This is the code for handling the event when the user clicks on fullscreen button
private function fullScreenHandler(event:MouseEvent):void
{
trace("Here");
// stage.displayState = StageDisplayState.FULL_SCREEN
if (this.stage.displayState== StageDisplayState.NORMAL) {
//stage.displayState="fullScreen";
this.stage.displayState=StageDisplayState.FULL_SCREEN_INTERACTIVE;
stage.scaleMode = StageScaleMode.NO_SCALE;
} else {
//stage.displayState="normal";
this.stage.displayState=StageDisplayState.NORMAL;
}
}
This is the code of html page
<html>
<head>This is the Test Page
</head>
<body>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://.../swflash.cab#version=9,0,0,0"
width="550" height="400" id="sample" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="true" />
<param name="movie" value="sample.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#333333" />
<embed src="sample.swf" quality="high" bgcolor="#333333"
width="550" height="400"
name="sample" align="middle"
allowscriptaccess="sameDomain"
type="application/x-shockwave-flash"
allowFullScreen="true"
pluginspage="http://www.macromedia.com/go/getflashplayer" />
</embed>
</object>
</body>
</html>
When I am running this page I am getting error that full screen mode is not allowed. security exception. When I am tracing it on console its printing "here"
can anyone suggest how can i solve the error
I had to add the line to scale the image i.e i added the following line
stage.scaleMode = StageScaleMode.NO_SCALE;
before
stage.displayState = StageDisplayState.FULL_SCREEN;
and it worked

Flash redirect SWF file

Is there a way to get click event then redirect on swf embedded object?
Below is the code I have at the moment but it doesn't seem to be working
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="560" height="80" id="ad_cat" align="">
<param name="movie" value="http://roadsonline.com.au/assets/ads/COA0460_560x80.swf?clickTAG=catredir.php">
<param name="wmode" value="transparent" />
<embed src="http://roadsonline.com.au/assets/ads/COA0460_560x80.swf?clickTAG=catredir.php" quality="high" width="560" height="80" name="movie" wmode="transparent" align="" type="application/x-shockwave-flash" plugins page="http://www.macromedia.com/go/getflashplayer">
</object>
There are two parts, HTML and the clickTAG in the SWF.
I believe your html should work - although i recommend a hardlink like http://yoursite.com/redirect.php. So lets talk Flash shall we?
I wrote a tutorial for click tags for my employees a while back which explains what you need to do in flash. This is AS2:
http://ryanhollingsworth.com/index.php/banner-ad-tutorials/item/34-actionscript-20-basic-clicktag-and-fundamentals
AS3 ClickTAG:
import flash.display.MovieClip;
var hit = new MovieClip();
hit.graphics.beginFill(0xFFFFFF);
hit.graphics.drawRect(0,0,stage.stageWidth,stage.stageHeight);
var clicky = new SimpleButton(null,null,null,hit);
this.addChild(clicky);
clicky.addEventListener(MouseEvent.CLICK, function(e){
if(root.loaderInfo.parameters.clickTAG) navigateToURL(new URLRequest(root.loaderInfo.parameters.clickTAG), "_blank");
e.stopPropagation();
});
further reading:
http://helpx.adobe.com/flash/kb/pass-variables-swfs-flashvars.html

flash as3 player in IE

I am trying to create a simple audio flash player, that calls a js function on click, it works perfectly in all browsers, except IE. i cant figure out what seems to be the problem!
here is html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>player</title>
</head>
<body >
<![if !IE]>
<object type="application/x-shockwave-flash" classid="bla" width="18" height="30" id="myFlashMovie">
<param name="wmode" value="opaque" />
<param name="FlashVars" value="mp3.mp3" />
<embed type="application/x-shockwave-flash" width="18" height="30" src="player%2Eswf" id="flashObj" FlashVars="audioTrackPath=mp3%2Emp3" />
</object>
<![endif]>
<!--[if IE]>
<object type="application/x-shockwave-flash" classid="clsid:d27cdb6e-ae6d-11cf- 96b8-444553540000" width="18" height="30" id="movie" allowScriptAccess="sameDomain" >
<PARAM NAME="movie" id="movie" value="player%2Eswf?audioTrackPath=mp3%2Emp3"/>
<PARAM NAME="FlashVars" value="mp3%2Emp3" />
<PARAM NAME="allowScriptAccess" value="always" />
<![endif]-->
<script type="text/javascript">
alert("Hello World");
</script>
<noscript>Sorry, your browser does not support JavaScript!</noscript>
<script type="text/javascript">
function countdown() {
alert("countdown");
}
</script>
</body>
</html>
and here is as:
import flash.media.Sound;
import flash.media.SoundLoaderContext;
import flash.net.URLRequest;
flash.system.Security.allowDomain("http://localhost");
var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;
var audioTrackPath:String = String(paramObj['audioTrackPath']);
stop();
play_btn.addEventListener(MouseEvent.CLICK, playSound);
function playSound (e:MouseEvent):void{
try {
ExternalInterface.call("countdown");
} catch(e:Error) {
trace(e)
}
//ExternalInterface.call("countdown");
gotoAndStop(2);
var soundClip:Sound;
var soundChannel:SoundChannel = new SoundChannel();
function init() {
soundClip = new Sound();
soundClip.addEventListener(ProgressEvent.PROGRESS, soundLoading);
soundClip.addEventListener(Event.COMPLETE, soundLoaded);
var req:URLRequest = new URLRequest(audioTrackPath);
var context:SoundLoaderContext = new SoundLoaderContext(1000, true);
soundClip.load(req,context);
//soundChannel = soundClip.play();
}
init();
function soundLoaded(e:Event) {
soundChannel = soundClip.play();
}
function soundLoading(e:ProgressEvent) {
// preloader information goes here
trace(String(int(100*e.bytesLoaded / e.bytesTotal))+"%");
}
stop_btn.addEventListener(MouseEvent.CLICK, stopSound);
function stopSound (e:MouseEvent):void{
gotoAndStop(1);
soundChannel.stop();
}
}
I have been Googling for 3 days now, but I can't seem to find an answer...
You should have stated that the issue is ExternalInterface.call() not working in the first place.
Build a simple project with just external interface call like
if(ExterlInterface.available){
ExternalInterface.call('alert','ExterlInterface.available');
}
on the first frame (if you are using flash) and publish it
it will give you following html
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>ei</title>
</head>
<body bgcolor="#ffffff">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="550" height="400" id="ei" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="false" />
<param name="movie" value="ei.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /> <embed src="ei.swf" quality="high" bgcolor="#ffffff" width="550" height="400" name="ei" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" />
</object>
</body>
</html>
If that fails, then it's your browser causing trouble, works fine for me.
If it is working then your html is bad.
Seems like you are missing movie parameter in object definition. Different browsers use different tags from which they pick up flash information - some use embed, some use object.
try this html
<object type="application/x-shockwave-flash" classid="bla" width="18" height="30" id="myFlashMovie">
<param name="movie" value="player.swf">
<param name="wmode" value="opaque" />
<param name="FlashVars" value="mp3.mp3" />
<embed type="application/x-shockwave-flash" width="18" height="30" src="player.swf" id="flashObj" FlashVars="audioTrackPath=mp3.mp3" />
</object>
i would also put the file reference directly in to the url
<param name="movie" value="player.swf?audioTrackPath=mp3.mp3">
Replace this:
<param name="FlashVars" value="mp3.mp3" />
With this:
<param name="FlashVars" value="audioTrackPath=mp3.mp3" />
FlashVars are name-value pairs.
Ognjen, don't take this the wrong way, but as an advice, instead of "googleing for 3 days", next time you could put some of that effort into proofreading the code.
looks like you should change your classid from bla to clsid:d27cdb6e-ae6d-11cf-96b8-444553540000
also check my similar opensource project (which, however doesn't work in IE 6, but fine in newer versions)

startimage for swf video

Hi I am trying to show startimage before my swf video starts playing, I am using flashVars to do this but for some reasons its not working, below is my code:
<object id="M97012085" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="1440" height="900" style="overflow: auto; align:middle;" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0">
<param name="movie" value="path_to_swf" />
<param name="loop" value="false" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="wmode" value="transparent" />
<param name="play" value="true" />
<param name="flashVars" value="image=path_to_png" />
<embed bgcolor="#ffffff" align="middle" name="M97012085" loop="false" src="path_to_swf" width="1440" height="900" flashVars="image=path_to_png" style="overflow: auto; align:middle;" play="true" wmode="transparent" quality="high" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
Could you please point out what I am doing wrong ? Is it possible to have a image which user can click to start the video ? Thanks
Ravi, please use a swfobject to embed your flash files:
<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript">
var flashvars = { 'image' : 'path-to.png' };
var params = { 'allowFullScreen' : 'true', 'wmode' : 'window' };
var attributes = { };
swfobject.embedSWF( 'index.swf, 'flashIndex', '100%', '100%', '10.1.0', 'swf/expressInstall.swf', flashvars, params, attributes );
</script>
More info: http://code.google.com/p/swfobject/
Then if you are using AS3.
before you initialize the video player, load image which was parsed to you by flashvars:
imageLoader = new Loader ();
imageLoader.contentLoaderInfo.addEventListener ( Event.COMPLETE, placeImageOnStage )
imageLoader.load ( new URLRequest ( loaderinfo.parameters.image ) ); // the flashvar parameter
after it is beeing loaded initialize your video.
function placeImageOnStage ( e : Event ) : void
{
addChild ( imageLoader.content ) // add your image to stage
enableVideoControls ();
prepearVideo ();
// or something else
}
What is the flash player you are using? Are you certain that startimage is a parameter that your specific player uses?
if your video is or can be an FLV file have a look at flowplayer. Specifically this page with a splash image example.

Passing variables to Class from HTML

I want to pass some image names and numbers as string to my flash, so in html file I have :
src="imgvid-00.swf?imageData=image00/00.gif,3,image00/01.gif,6,image00/02.gif,10"
in flash swf I have a class like this:
package src{
import flash.display.*;
import flash....
public class imgvid extends MovieClip {
public var dataBANK:Array = new Array();
public function imgvid():void {
//put all var in Array dataBANK
}
}
}
How I do this?
I try :
public var paramObj = this.loaderInfo.parameters;
but that does not work ...
You need to pass paramters in as flashvars. query parameters are not passed into flash in the way you have in your example. Read up about flashvars here:
http://kb2.adobe.com/cps/164/tn_16417.html
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="550" height="400" id="myFlashMovie" align="middle">
<param name="movie" value="myFlashMovie.swf" />
<param name=FlashVars value="myVariable=Hello%20World&mySecondVariable=Goodbye">
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="myFlashMovie.swf" width="550" height="400">
<param name="movie" value="myFlashMovie.swf" />
<param name=FlashVars value="myVariable=Hello%20World&mySecondVariable=Goodbye">
<!--<![endif]-->
<a href="http://www.adobe.com/go/getflash">
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
</a>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
using swf object to do all this makes it easier than doing it manually as above
http://code.google.com/p/swfobject/