论坛交流
首页办公自动化| 网页制作| 平面设计| 动画制作| 数据库开发| 程序设计| 全部视频教程
应用视频: Windows | Word2007 | Excel2007 | PowerPoint2007 | Dreamweaver 8 | Fireworks 8 | Flash 8 | Photoshop cs | CorelDraw 12
编程视频: C语言视频教程 | HTML | Div+Css布局 | Javascript | Access数据库 | Asp | Sql Server数据库Asp.net  | Flash AS
当前位置 > 文字教程 > Javascript教程
Tag:验证,特效,入门,实例,验证,表单,特效,正则表达式,跑马灯,document,函数,代码,getElementByID,菜单,图片,视频教程

Javascript教程_FLV播放代码改成OBJ格式

文章类别:Javascript | 发表日期:2010-5-4 8:41:20

1.原格式:在FF下出现蹦溃问题!帮看下杂回事?

<object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="206" height="129">
    <param name="movie" value="flvplayer.swf" />
    <param name="quality" value="high" />
    <param name="allowFullScreen" value="true" />
    <param name="FlashVars" value="vcastr_file=video.flv&BufferTime=3&IsAutoPlay=0" />
    <embed src="flvplayer.swf" allowfullscreen="true" flashvars="vcastr_file=video.flv&IsAutoPlay=0" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="206" height="129"></embed>
  </object>
2.改成这种方式,又无法播放?(swfobject.js)
<script type="text/javascript">
   var fo = new FlashObject("flvplayer.swf", "mymovie", "278", "251", "7", "#336699");
   fo.addParam("quality", "low");
   fo.addParam("wmode", "transparent");
   fo.addParam("salign", "t");
   fo.addParam("scale", "scale");
   fo.addParam("loop", "false");
   fo.addParam("flashvars","file=video.flv&image=preview.jpg");
   fo.write("flashcontent");
</script>
3.这个却能播放
<div id="flashcontent" style="width: 278px; height: 251px"></div>
<script type="text/javascript">
   var fo = new FlashObject("player.swf", "mymovie", "278", "251px", "7", "#336699");
   fo.addParam("quality", "low");
   fo.addParam("wmode", "transparent");
   fo.addParam("salign", "t");
   fo.addParam("scale", "scale");
   fo.addParam("loop", "false");
   fo.addParam("flashvars","file=video.flv&image=preview.jpg");
   fo.write("flashcontent");
</script>
可以参考下AC_RunActiveContent.js:
貌似IE下要刷新下?
<html><head><title>A Sample Of SWF Object</title><script src="http://www.kozisgreat.com/js/AC_RunActiveContent.js" type="text/javascript"></script>
</head><body><script type="text/javascript">
AC_FL_RunContent(
 "codebase",
 "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0",
 "width",
 "900",
 "height",
 "600",
 "src",
 "http://www.ibm.com/images/icp/T147059A31886O57/infra-labs-swg",
 "quality",
 "high",
 "pluginspage",
 "http://www.macromedia.com/go/getflashplayer",
 "movie",
 "http://www.ibm.com/images/icp/T147059A31886O57/infra-labs-swg" ,
 "menu",
 "false",
 "z-index",
 "-1",
 "wmode",
 "transparent"
); //end AC code
</script>
</body>
</html>
代码:
//v1.0
//Copyright 2006 Adobe Systems, Inc. All rights reserved.
function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?');
  else
    return src + ext;
}
function AC_Generateobj(objAttrs, params, embedAttrs)
{
  var str = '<object ';
  for (var i in objAttrs)
    str += i + '="' + objAttrs[i] + '" ';
  str += '>';
  for (var i in params)
    str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  str += '<embed ';
  for (var i in embedAttrs)
    str += i + '="' + embedAttrs[i] + '" ';
  str += ' ></embed></object>';
  document.write(str);
}
function AC_FL_RunContent(){
  var ret =
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}
function AC_SW_RunContent(){
  var ret =
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}
function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();   
    switch (currArg){    
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":    
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace":
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "id":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}
视频教程列表
文章教程搜索
 
Javascript推荐教程
Javascript热门教程
看全部视频教程
购买方式/价格
购买视频教程: 咨询客服
tel:15972130058