在Web浏览器控件中播放视频(使用JavaScript添加)会导致" error #2148 try loosening flash security setting"


I have to add videos using javascript

我正在创建WPF应用程序并读取html文件,我在文件中添加了一些javascript函数,以便能够添加多媒体文件,图像和音频的添加效果很好,但不适用于视频,这里是添加视频的函数:

function uiWebview_AddVideo()
{
    //var xpathh=uiWebview_storeSelection();
    var xpathh="/HTML[1]/BODY[1]/DIV[1]/P[1]/text()[1]|12|/HTML[1]/BODY[1]/DIV[1]/P[1]/text()[1]|22";
    var videopath="C:\Users\Administrateur\Desktop\movie.mp4";
    var index =1;
    var annotguid="annotguid";
    var annversion="annversion";
    var auteursurname="auteursurname";
    var foruserid=3;
    var selectionDetails = xpathh;
    selectionDetails = selectionDetails.split(/|/g);
    var range = document.createRange();
    var selectionDetails0 = selectionDetails[0];
    selectionDetails0 = selectionDetails0.replace(///g,"/h:");
    selectionDetails0 = selectionDetails0.replace("h:t","t");
    var selectionDetails2 = selectionDetails[2];
    selectionDetails2 = selectionDetails2.replace(///g,"/h:");
    selectionDetails2 = selectionDetails2.replace("h:t","t");
    range.setStart(document.evaluate(selectionDetails0, document, nsResolver, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue, Number(selectionDetails[1]));
    range.setEnd(document.evaluate(selectionDetails2, document, nsResolver, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue, Number(selectionDetails[3]));

    //we create a SPAN element for every parts of matched keywords
    var span = document.createElement("span");
    var etoile = "*";
    var text1 = document.createTextNode(auteursurname);
    span.appendChild(text1);
    //we create a p element for every parts of matched keywords
    var p = document.createElement("aside");
    p.setAttribute("class","video");
    p.setAttribute("id",annotguid);
    p.setAttribute("style","display:block;");
    //*********** Video Tag ***********
    var video = document.createElement("video");
    video.innerHTML ="<video class="video-js" width="640" height="264" controls preload poster="http://video-js.zencoder.com/oceans-clip.png"><source src="C:\Users\Administrateur\Desktop\movie.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' /><source src="C:\Users\Administrateur\Desktop\movie.webm" type='video/webm; codecs="vp8, vorbis"' /><source src="C:\Users\Administrateur\Desktop\movie.ogv" type='video/ogg; codecs="theora, vorbis"' /><object class="vjs-flash-fallback" width="640" height="264" type="application/x-shockwave-flash"data="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf"><param name="movie" value="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf" /><param name="allowfullscreen" value="true" /><param name="flashvars" value='config={"playlist":["http://video-js.zencoder.com/oceans-clip.png", {"url": "C:\Users\Administrateur\Desktop\movie.mp4","autoPlay":false,"autoBuffering":true}]}' /></object></video>";

    //video.appendChild(object);
    //***********************

    p.appendChild(span);
    var br = document.createElement("br");
    p.appendChild(br);
    p.appendChild(video);
    var d = document.createElement("d");
    d.appendChild(p);
    //p.setAttribute("class","bubble speech");
    var obj = range.startContainer; 
    while (obj.nodeName.toLowerCase() != 'p' && obj.nodeName.toLowerCase() != 'table'
    && obj.nodeName.toLowerCase() != 'p' && obj.nodeName.toLowerCase() != 'address' 
    && obj.nodeName.toLowerCase() != 'body' && obj.nodeName.toLowerCase() != 'body') {
        obj = obj.parentNode;
    }
    if (obj.nodeName.toLowerCase() == 'p' || obj.nodeName.toLowerCase() == 'table'
    || obj.nodeName.toLowerCase() == 'p' || obj.nodeName.toLowerCase() == 'address'
    || obj.nodeName.toLowerCase() == 'p' || obj.nodeName.toLowerCase() == 'p') {
        obj.parentNode.insertBefore(d, obj);
    }
    else {
        obj = range.commonAncestorContainer;
        obj.parentNode.insertBefore(d, obj);
    }
    //we create a A element for every parts of matched keywords
    var a = document.createElement("a");
    var etoile = "*";
    var text2 = document.createTextNode(etoile.concat(index).concat(" "));
    a.appendChild(text2);
    var chaine1="javascript:changestyledisplayblock('";
    var chaine2="')";
    var hre=(chaine1.concat(annotguid)).concat(chaine2);
    a.setAttribute("class", "marker");
    a.setAttribute("href", hre);
    a.setAttribute("style", "color:#004080;text-decoration:underline");
    range.insertNode(a);
    return;
}

我发现了许多其他的flash播放器,但似乎他们不工作在我的浏览器(IE7)我正在寻找指示,以一个球员,将保证增加视频或者解决显示flash"201无法加载流或剪辑文件"的错误,请尝试放松flash安全设置错误#2148。谢谢

您可以通过拖放来使用媒体播放器控件(Winforms解决方案)http://msdn.microsoft.com/en-us/library/bb383953 (v =应用程序). aspx

或者添加一个包含视频/音频的新标签,也使用Media player

    var embed = document.createElement("embed");
    embed.setAttribute("type", "application/x-mplayer2");
    embed.setAttribute("pluginspage", "http://www.microsoft.com/Windows/MediaPlayer");
    embed.setAttribute("src", videoSource);

最新更新