//正文中输出mp4播放代码 //浏览器支持flash时,使用flowplayer播放器,否则支持html5时使用html5的video标签播放 function showvsbvideo(vurl,vheight,vwidth,align,style,vautoplay,mid) { if(vurl=="") { return; } var outputhtml=""; if (hasplayhtml5vedio()) { outputhtml = outputhtml5video(vurl, vheight, vwidth, vautoplay, align, style, mid); } else { outputhtml = outputflashvideo(vurl, vheight, vwidth, vautoplay, align, style, mid); } document.write(outputhtml); } function hasplayhtml5vedio() { var a=document.createelement("video"), c=!!a.canplaytype; if(c) { c=new boolean(c), c.ogg=a.canplaytype('video/ogg; codecs="theora"'); var d='video/mp4; codecs="avc1.42e01e'; c.h264=a.canplaytype(d+'"')||a.canplaytype(d+', mp4a.40.2"'),c.webm=a.canplaytype('video/webm; codecs="vp8, vorbis"') } return c; } function outputflashvideo(videourl,wheight,wwidth,bautoplay,align,style,mid) { if(!mid||mid=="") { mid="id=_vsb_player"; } var flashurl = ""; var hasloadplayer = false; try{ //判断是否引用了flowplayer 的相关js 内容组件是不引用的 var tmpplayer = flowplayer; hasloadplayer = true; }catch (e){ } if(hasloadplayer){ var realmid = mid.replace("id=","").replace(/\\/g,"").replace(/"/g,""); var realwidth = wwidth.replace("width=","").replace(/\\/g,"").replace(/"/g,""); var realheight = wheight.replace("height=","").replace(/\\/g,"").replace(/"/g,""); flashurl = ''; }else{ flashurl=''; } return flashurl; } function outputhtml5video(videourl,wheight,wwidth,bautoplay,align,style,mid) { if(!mid||mid=="") { mid="id=_vsb_player"; } var res=' '; return res; } function outvideoformobile(vurl,vheight,vwidth,vautoplay) { //手机显示时,视频宽度为设备宽度 if(hasplayhtml5vedio()) { var res=' '; document.write(res); } else alert("不支持"); } //文章内容组件其实是不需要的 因为newscontent.js里面已经包含了这个方法,加到这里只要是为了简介组件使用 //正文中输出mp3播放代码 function showvsbaudio(aurl,vheight,vwidth,align,styles,vautoplay) { if(aurl=="") { return; } var playersrc = "/system/resource/images/ueditor/musicflash/player_mp3_maxi.swf"; var flashvars = "mp3="+aurl+"&showstop=1&showvolume=1&bgcolor1=eeeeee&bgcolor2=a0a0a0"; var autoplaystr = ""; if(vautoplay=="true") { autoplaystr = "autoplay = 'true'"; flashvars +="&autoplay=1"; } var outputhtml=""; outputhtml +=''; document.write(outputhtml); } /** * 正文中显示pdf * @param path * @param width * @param heigth * @param imagenum * @param style * @param imagedata */ function showvsbpdfiframe(path,width,heigth,imagenum,style,imagedata){ if(path=="") { return; } var outputhtml=""; //判断浏览器版本 if(issupportpddfjs()){ //pdfjs outputhtml = ""; }else{ //图片 if(imagedata && imagedata.length >0){ var imagestr = ""; imagestr = "
"; outputhtml = imagestr; }else{ outputhtml = ""; } } document.write(outputhtml); } /** * 判断浏览器是否支持pdf.jsz` * @returns {boolean} */ function issupportpddfjs(){ var agent = navigator.useragent.tolowercase(); var isie = /(msie\s|trident.*rv:)([\w.]+)/.test(agent); if(isie){ return false; } var safari; if(/(\d+\.\d)?(?:\.\d)?\s+safari\/?(\d+\.\d+)?/i.test(agent) && !/chrome/i.test(agent)){ safari = + (regexp['\x241'] || regexp['\x242']); } if(safari && safari < 11){ return false; } var mobile = agent.match(/applewebkit.*mobile.*/); if(mobile){ return false; } return true; }