1

我正在尝试使用 javascript 创建视频 Flash 文件。我正在使用 DOM 来动态创建 flash 文件。我正在使用的代码在 Chrome 中运行,但是当我尝试在 IE 中运行它时,它说它无法加载文件。这是我的代码。

function create(){

var videoFile = "file.mp4";

var flashVideo = document.createElement("object");

    flashVideo.setAttribute("id","videoFlash"); 
    flashVideo.setAttribute("type","application/x-shockwave-flash");    
    flashVideo.setAttribute("data","http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf");  
    flashVideo.setAttribute("width","640"); 
    flashVideo.setAttribute("height","360");

var paramM = document.createElement("param");

    paramM.setAttribute("name", "movie");
    paramM.setAttribute("value", "http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf");

var paramA = document.createElement("param");

    paramA.setAttribute("name", "allowFullScreen");
    paramA.setAttribute("value", "true");

var paramW = document.createElement("param");

    paramW.setAttribute("name", "wmode");
    paramW.setAttribute("value", "transparent");

var paramF = document.createElement("param");

    paramF.setAttribute("name", "flashVars");
    paramF.setAttribute("value", "config={'playlist':[{'url':'" + videoFile + "','autoPlay':true}]}");

flashVideo.appendChild(paramM);
flashVideo.appendChild(paramA);
flashVideo.appendChild(paramW);
flashVideo.appendChild(paramF);

document.getElementById("videoPlayer").appendChild(flashVideo);
4

0 回答 0