<!-- first try native HTML5 video playback --> <video width="640" height="360" controls="controls" autoplay="true"> <source src="__MY_VIDEO__.mp4" type="video/mp4" /> <source src="__MY_VIDEO__.ogv" type="video/ogg" /> <!-- fall back to Flash *do not* include 'classid' so as to be compatible with non-IE browsers --> <object width="640" height="380" type="application/x-shockwave-flash" data="__FLASH_PLAYER__.swf" flashvars="autostart=true&file=__MY_VIDEO__.mp4" > <!-- IE compatibility for the above --> <param name="movie" value="__FLASH_PLAYER__.swf" /> <param name="flashvars" value="autostart=true&file=__MY_VIDEO__.mp4" /> <!-- no Flash? fall back to a QuickTime object iPhone OSv2 will use this file. ensure your MP4 is compatible: <tinyurl.com/qmmss6> IE6 does not allow object-within-object, Flash is the only option. this object tag (with classid) is hidden from non-IE browsers, as it causes a plugin-install prompt to occur even if the plugin is not needed because it's been superseded by HTML5 video --> <!--[if gt IE 6]> <object width="640" height="375" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"> <param name="src" value="__MY_VIDEO__.mp4" /> <param name="autoplay" value="true" /><! [endif]--><!-- the odd line-break above is *required* or QuickTime fallback fails --> <!--[if gt IE 6]><!--> <!-- that self-closing comment after the conditional tag is the only way to reveal the conditional comment to other browsers that is compatible with serving as XHTML (application/xhtml+xml). a normal closing comment marker would be visible in IE7, and other workarounds cause an XML parser error (comment-in-comment) --> <!-- QuickTime height is height+15 to leave room for the controls --> <object width="640" height="375" autoplay="true" type="video/quicktime" data="__MY_VIDEO__.mp4" > <!-- params for Safari/Chrome compatibility (they ignore the attributes above) --> <param name="src" value="__MY_VIDEO__.mp4" /> <param name="autoplay" value="true" /> <!--<![endif]--> <!-- finally, if all else fails, fall back to a warning message: *always* tell the user *what* it is they can't see; give a title or description --> <h3>Video: __TITLE_OF_MY_VIDEO__</h3> <p> <strong>No video playback capabilities detected.</strong> Why not try to download the file instead?<br /> <a href="__MY_VIDEO__.mp4">MPEG4 / H.264 .mp4 (Windows / Mac)</a> | <a href="__MY_VIDEO__.ogv">Ogg Theora & Vorbis .ogv (Linux)</a> </p> <!-- and try to give them genuinely helpful information to rectify the problem --> <p> To play the video here in the webpage, please do one of the following: </p><ul> <li>Upgrade to the latest version of <a href="http://getfirefox.com">Firefox</a>, or <a href="http://apple.com/safari">Safari</a></li> <li>Install <a href="http://get.adobe.com/flashplayer/">Adobe Flash Player</a></li> <li>Install <a href="http://apple.com/quicktime/download/">Apple QuickTime</a></li> </ul> <!--[if gt IE 6]><!--></object><!--<![endif]--> <!--[if gt IE 6]></object><![endif]--> </object> </video>
Tag Archive for flash
Video For Everybody
Search Displaylist for Bitmap (or any type of DisplayObject)
var bitmap:Bitmap;
for (var i:int = 0; i < this.numChildren; i++)
{
bitmap = this.getChildAt(i) as Bitmap;
if (bitmap) break;
}
IE6 Image Flicker
html {
filter: expression(document.execCommand("BackgroundImageCache", false, true));
}
Javascript window sizing for swf
function setFlashSize(flashWidth,flashHeight){
var size = [0,0];
if( typeof( window.innerWidth ) == 'number' ) {
size = [window.innerWidth, window.innerHeight];
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
size = [document.documentElement.clientWidth, document.documentElement.clientHeight];
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
size = [document.body.clientWidth, document.body.clientHeight];
}
window.onresize = function() {
document.getElementById("flashContainer").style.minWidth = flashWidth+"px";
document.getElementById("flashContainer").style.minHeight = flashHeight+"px";
document.getElementById("flashContainer").style.width = size[0] < flashWidth ? flashWidth+"px" : "100%";
document.getElementById("flashContainer").style.height = size[1] < flashHeight ? flashHeight+"px" : "100%";
};
window.onload = function(){
window.onresize();
}
}
SWFObject.embedSWF("example.swf", "flashMovie", "100%", "100%", "6.0.0","expressInstall.swf");
setFlashSize(600,400);
loaderinfo variables
var keyStr:String;
var valueStr:String;
var theVars:Array = new Array();
try {
var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;
for (keyStr in paramObj) {
valueStr = String(paramObj[keyStr]);
theVars.push({key:keyStr, val:valueStr});
}
init();
} catch (error:Error) {
trace(error.toString());
}
actionscript – trace actions to get info about cuepoints in FLV video
/* ||||||||||||||||| CUEPOINT TRACES ||||||||||||||||||||
these trace actions are handy for returning the info that flash has about any cuepoints it encounters, embedded in an FLV [flash video] file. put these traces inside a cuepoint listener function to test whether flash is picking up the cuepoints in the first place, before you add any more complicated code. these traces will display:
- the 'event' the listener has detected [ie. a cuepoint]
- the name of the cuepoint
- the type of the cuepoint [ie. 'event' or 'navigation']
- the time the cuepoint sits at in the video
[note: this code assumes your FLV video file has an instance name of 'vid'. if you change the instance name change the "this.vid.playheadTime" part of the code accordingly]
||||||||||||||||||||||||||||||||||||||||||| */
// begin traces
trace("listener detected: "+eventObject.type);
trace("cuepoint is called: "+eventObject.info.name);
trace("cuepoint is of type: "+eventObject.info.type);
trace("vid playhead time: "+vid.playheadTime);
trace("------
");
// end traces
Flash Preloader as3 code like apple style.
package net.stevensacks.preloaders
{
import flash.events.TimerEvent;
import flash.events.Event;
import flash.display.Sprite;
import flash.display.Shape;
import flash.utils.Timer;
public class CircleSlicePreloader extends Sprite
{
private var timer:Timer;
private var slices:int;
private var radius:int;
public function CircleSlicePreloader(slices:int = 12, radius:int = 6)
{
super();
this.slices = slices;
this.radius = radius;
draw();
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
}
private function onAddedToStage(event:Event):void
{
removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
addEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);
timer = new Timer(65);
timer.addEventListener(TimerEvent.TIMER, onTimer, false, 0, true);
timer.start();
}
private function onRemovedFromStage(event:Event):void
{
removeEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
timer.reset();
timer.removeEventListener(TimerEvent.TIMER, onTimer);
timer = null;
}
private function onTimer(event:TimerEvent):void
{
rotation = (rotation + (360 / slices)) % 360;
}
private function draw():void
{
var i:int = slices;
var degrees:int = 360 / slices;
while (i--)
{
var slice:Shape = getSlice();
slice.alpha = Math.max(0.2, 1 - (0.1 * i));
var radianAngle:Number = (degrees * i) * Math.PI / 180;
slice.rotation = -degrees * i;
slice.x = Math.sin(radianAngle) * radius;
slice.y = Math.cos(radianAngle) * radius;
addChild(slice);
}
}
private function getSlice():Shape
{
var slice:Shape = new Shape();
slice.graphics.beginFill(0x666666);
slice.graphics.drawRoundRect(-1, 0, 2, 6, 12, 12);
slice.graphics.endFill();
return slice;
}
}
}
actionscript3 – seek to cuepoint in FLV flash video clip
// send FLV "vid" [inside movieclip "videoholderMC"] to the navigation cuepoint "middle"
this.videoholderMC.vid.seekToNavCuePoint("middle");