JS技术

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

字号+ 作者:H5之家 来源:H5之家 2015-09-27 12:00 我要评论( )

Javascript教程_FLV播放代码改成OBJ格式,学习Javascript教程_FLV播放代码改成OBJ格式,Javascript教程_FLV播放代码改成OBJ格式,查看Javascript教程_FLV播放代码改

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

<object classid="clsid

27CDB6E-AE6D-11cf-96B8-444553540000" codebase="#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="" 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="" type="text/javascript"></script>
</head><body><script type="text/javascript">
AC_FL_RunContent(
 "codebase",
 "#version=8,0,0,0",
 "width",
 "900",
 "height",
 "600",
 "src",
 "",
 "quality",
 "high",
 "pluginspage",
 "",
 "movie",
 "" ,
 "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;
}

 

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

相关文章
  • js事件与处理_Javascript教程

    js事件与处理_Javascript教程

    2015-10-10 15:06

  • js对象属性及方法_Javascript教程

    js对象属性及方法_Javascript教程

    2015-10-10 15:04

  • js语句及语法_Javascript教程

    js语句及语法_Javascript教程

    2015-10-10 15:02

  • js数据类型与变量_Javascript教程

    js数据类型与变量_Javascript教程

    2015-10-10 15:00

网友点评