browser - play videos(added using javascript) inside webbrowser control cause " error #2148 try loosening flash security setting" -
i have add videos using javascript i'm creating wpf application , reading html files, added javascript functions files able add multimedia files, add of images amd audio works great not videos, here function add video:
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 span element every parts of matched keywords var span = document.createelement("span"); var etoile = "*"; var text1 = document.createtextnode(auteursurname); span.appendchild(text1); //we create p element 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 element every parts of matched keywords var = 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; } i found many other flash players seems don't work in webbrowser (ie7) i'm looking indication player garantie add of video or alternative resolve error display flash "201 unable load stream or clip file try loosening flash security setting error #2148" ,
you can use media player controle drag , drop (winforms solution) http://msdn.microsoft.com/en-us/library/bb383953(v=vs.90).aspx
or adding new tag embed wich contains video/audio using 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); this solution worked me ;)
Comments
Post a Comment