PageSourceSearch

https://www.sxnu.edu.cn/system/resource/js/news/mp4video.js

js sxnu.edu.cn collected 2026-10-02 17:08:28 UTC 7,099 bytes, 181 lines download raw bytes

1//正文中输出mp4播放代码 
2//浏览器支持flash时,使用flowplayer播放器,否则支持html5时使用html5的video标签播放
3function showVsbVideo(vurl,vheight,vwidth,align,style,vautoplay,mid)
4{
5	if(vurl=="")
6	{
7	    return;   
8	}
9	var outputHTML="";
10    if (hasPlayHtml5Vedio())
11    {
12        outputHTML = outPutHTML5Video(vurl, vheight, vwidth, vautoplay, align, style, mid);
13    } else {
14        outputHTML = outPutFlashVideo(vurl, vheight, vwidth, vautoplay, align, style, mid);
15    }
16	document.write(outputHTML);      
17}
18
19function hasPlayHtml5Vedio()
20{
21	var a=document.createElement("video"),	c=!!a.canPlayType;
22	if(c)
23	{
24		c=new Boolean(c),
25		c.ogg=a.canPlayType('video/ogg; codecs="theora"');
26		var d='video/mp4; codecs="avc1.42E01E';
27		c.h264=a.canPlayType(d+'"')||a.canPlayType(d+', mp4a.40.2"'),c.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"')
28	}
29	return c;			
30}
31function outPutFlashVideo(videoUrl,wHeight,wWidth,bautoPlay,align,style,mid)
32{
33		if(!mid||mid=="")
34		{
35		    mid="id=_vsb_player";
36		}
37        var flashUrl = "";
38		var hasLoadPlayer = false;
39		try{
40		    //判断是否引用了flowplayer 的相关JS   内容组件是不引用的
41            var tmpplayer = flowplayer;
42            hasLoadPlayer = true;
43        }catch (e){
44        }
45
46		if(hasLoadPlayer){
47            var realmid = mid.replace("id=","").replace(/\\/g,"").replace(/"/g,"");
48            var realwidth = wWidth.replace("width=","").replace(/\\/g,"").replace(/"/g,"");
49            var realheight = wHeight.replace("height=","").replace(/\\/g,"").replace(/"/g,"");
50            flashUrl = '<a href="'+videoUrl+'" style="display:block;width:'+realwidth+'px;height:'+realheight+'px;" '+mid+'></a><script>flowplayer(\"'+realmid+'\", \"/system/resource/swf/flowplayer.commercial.swf\", {clip:{autoPlay:"+bautoPlay+",autoBuffering:true}});</script>';
51        }else{
52            flashUrl='<object '+mid+' align="'+align+'" style="'+style+'" type="application/x-shockwave-flash" data="/system/resource/swf/flowplayer.commercial.swf"  '+wWidth+'  '+wHeight+'>';
53            var configstr='&quot;playlist&quot;:[{&quot;url&quot;:&quot;'+videoUrl+'&quot;,&quot;scaling&quot;:&quot;fit&quot;,&quot;autoPlay&quot;:'+bautoPlay+',&quot;autoBuffering&quot;:&quot;false&quot;}]';
54            flashUrl=flashUrl+'<param name="flashvars" value="config={'+configstr+'}">';
55            flashUrl=flashUrl+'<param name="allowfullscreen" value="true"><param name="allowscriptaccess" value="sameDomain"><param name="quality" value="high"><param name="cachebusting" value="false"><param name="bgcolor" value="#000000"><param name="src" value="/system/resource/swf/flowplayer.commercial.swf">';
56            flashUrl=flashUrl+'</object>';
57        }
58		return flashUrl;
59}
60
61function outPutHTML5Video(videoUrl,wHeight,wWidth,bautoPlay,align,style,mid)
62{
63		if(!mid||mid=="")
64		{
65		    mid="id=_vsb_player";
66		}
67		//var res='<video controlsList="nodownload" controls '+mid+' style="background-color:#474747;'+style+'" align="'+align+'" '+wWidth+'  '+wHeight;
68        var res='<video controls '+mid+' style="background-color:#474747;'+style+'" align="'+align+'" '+wWidth+'  '+wHeight;
69		if(bautoPlay && bautoPlay=="true")
70		{
71		    res+=' autoplay="autoplay" ';
72		}
73		res +='><source src="'+videoUrl+'" type="video/mp4" /></video> ';
74		return  res;
75}	
76
77function outVideoForMobile(vurl,vheight,vwidth,vautoplay)
78{
79        //手机显示时,视频宽度为设备宽度
80        if(hasPlayHtml5Vedio())
81        {
82		    var res='<video controls="controls" controlsList="nodownload" width="'+document.body.clientWidth+'"';
83    		if(vautoplay&&vautoplay=="true")
84    		{
85    		    res+=' autoplay="autoplay" ';
86    		}
87    		res +='><source src="'+vurl+'" type="video/mp4" /></video> ';
88		
89    		document.write(res);    
90		}    
91		else
92		    alert("不支持");        
93}
94//文章内容组件其实是不需要的  因为newscontent.js里面已经包含了这个方法,加到这里只要是为了简介组件使用
95//正文中输出mp3播放代码
96function showVsbAudio(aurl,vheight,vwidth,align,styles,vautoplay)
97{
98    if(aurl=="")
99    {
100        return;
101    }
102    var playersrc = "/system/resource/images/ueditor/musicFlash/player_mp3_maxi.swf";
103    var flashvars = "mp3="+aurl+"&showstop=1&showvolume=1&bgcolor1=eeeeee&bgcolor2=a0a0a0";
104    var autoplayStr = "";
105    if(vautoplay=="true")
106    {
107        autoplayStr = "autoplay = 'true'";
108        flashvars +="&autoplay=1";
109    }
110    var outputHTML="";
111    outputHTML +='<audio src="'+aurl+'" width="'+vwidth+'" height="'+vheight+'"  '+autoplayStr+' align="'+align+'" style="'+styles+'"  controls="controls" loop="true"><embed align="'+align+'" style="'+styles+'" width="'+vwidth+'" height="'+vheight+'" src="'+playersrc+'" flashvars="'+flashvars+'" /></audio>';
112    document.write(outputHTML);
113}
114
115
116/**
117 * 正文中显示PDF
118 * @param path
119 * @param width
120 * @param heigth
121 * @param imagenum
122 * @param style
123 * @param imagedata
124 */
125function showVsbpdfIframe(path,width,heigth,imagenum,style,imagedata){
126    if(path=="")
127    {
128        return;
129    }
130    var outputHTML="";
131
132    //判断浏览器版本
133    if(isSupportPddfjs()){
134        //pdfjs
135        outputHTML = "<iframe src=\"/system/resource/pdfjs/viewer.html?file="+encodeURIComponent(path)+"\" width=\""+width+"\" height=\""+heigth+"\" style='"+style+"'></iframe>";
136    }else{
137        //图片
138        if(imagedata && imagedata.length >0){
139            var imageStr = "";
140            imageStr = "<div style='"+style+";overflow-y: auto;overflow-x:hidden;text-indent: 0;width: "+(width.indexOf("%") != -1?width:width+"px")+";height: "+(heigth.indexOf("%") != -1?heigth:heigth+"px")+"; '>";
141            for(var i=0;i<imagedata.length ;i++){
142                var tmpimgpath = imagedata[i];
143                imageStr += "<img src='"+tmpimgpath+"' width='100%' class='img_vsb_content'>";
144                imageStr += "<div style=\"height:32px;line-height:32px;font-size:14px; width:100%;background-color:#3D3D3D;text-align:center;color:#ececec;\">第 "+(i+1)+" 页</div>";
145            }
146            imageStr += "</div>";
147            outputHTML = imageStr;
148        }else{
149            outputHTML = "<iframe src=\""+path+"\" width=\""+width+"\" height=\""+heigth+"\" style='"+style+"'></iframe>";
150        }
151    }
152    document.write(outputHTML);
153}
154
155/**
156 * 判断浏览器是否支持pdf.jsz`
157 * @returns {boolean}
158 */
159function isSupportPddfjs(){
160    var agent = navigator.userAgent.toLowerCase();
161    var isIe = /(msie\s|trident.*rv:)([\w.]+)/.test(agent);
162    if(isIe){
163        return false;
164    }
165
166    var safari;
167    if(/(\d+\.\d)?(?:\.\d)?\s+safari\/?(\d+\.\d+)?/i.test(agent) && !/chrome/i.test(agent)){
168        safari = + (RegExp['\x241'] || RegExp['\x242']);
169    }
170
171    if(safari && safari < 11){
172        return false;
173    }
174
175    var mobile = agent.match(/applewebkit.*mobile.*/);
176    if(mobile){
177        return false;
178    }
179
180    return true;
181}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.