PageSourceSearch

https://www.drpkhalder.com/system/resource/js/news/mp4video.js

js drpkhalder.com collected 2026-10-06 16:59:35 UTC 4,034 bytes, 119 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	//浏览器类型
11	var browserName= getBrowsers();
12	
13	//先判断是否是ie,几率大一些
14	if(browserName=="msie")
15	{
16			outputHTML=outPutHTML5Video(vurl,vheight,vwidth,vautoplay,align,style,mid);
17	}else if(browserName=="chrome")
18	{
19	        outputHTML=outPutHTML5Video(vurl,vheight,vwidth,vautoplay,align,style,mid);
20	}else if(browserName=="firefox")
21	{
22			outputHTML=outPutHTML5Video(vurl,vheight,vwidth,vautoplay,align,style,mid);
23	}else if(browserName=="android")
24	{
25		if(hasPlayHtml5Vedio())
26		{
27			  outputHTML=outPutHTML5Video(vurl,vheight,vwidth,vautoplay,align,style,mid);
28		}else
29		{
30			  outputHTML=outPutHTML5Video(vurl,vheight,vwidth,vautoplay,align,style,mid);
31		}
32	}else if(browserName=="safari")
33	{
34		if(hasPlayHtml5Vedio())
35		{
36			outputHTML=outPutHTML5Video(vurl,vheight,vwidth,vautoplay,align,style,mid);
37		}else
38		{
39			outputHTML=outPutHTML5Video(vurl,vheight,vwidth,vautoplay,align,style,mid);
40		}
41	}else 
42	{
43			outputHTML=outPutHTML5Video(vurl,vheight,vwidth,vautoplay,align,style,mid);
44	}	
45	document.write(outputHTML);      
46}
47
48function hasPlayHtml5Vedio()
49{
50	var a=document.createElement("video"),	c=!!a.canPlayType;
51	if(c)
52	{
53		c=new Boolean(c),
54		c.ogg=a.canPlayType('video/ogg; codecs="theora"');
55		var d='video/mp4; codecs="avc1.42E01E';
56		c.h264=a.canPlayType(d+'"')||a.canPlayType(d+', mp4a.40.2"'),c.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"')
57	}
58	return c;			
59}
60function outPutFlashVideo(videoUrl,wHeight,wWidth,bautoPlay,align,style,mid)
61{
62		if(!mid||mid=="")
63		{
64		    mid="id=_vsb_player";
65		}
66		var flashUrl='<object '+mid+' align="'+align+'" style="'+style+'" type="application/x-shockwave-flash" data="/system/resource/swf/flowplayer.commercial.swf"  '+wWidth+'  '+wHeight+'>';
67		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;}]';
68		flashUrl=flashUrl+'<param name="flashvars" value="config={'+configstr+'}">';
69		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">';
70		flashUrl=flashUrl+'</object>';
71		return flashUrl;
72		
73}
74
75function outPutHTML5Video(videoUrl,wHeight,wWidth,bautoPlay,align,style)
76{
77		var res='<video controls style="background-color:#474747;'+style+'" align="'+align+'" '+wWidth+'  '+wHeight;
78		if(bautoPlay&&bautoPlay=="true")
79		{
80		    res+=' autoplay="autoplay" ';
81		}
82		res +='><source src="'+videoUrl+'" type="video/mp4" /></video> ';
83		return  res;
84}	
85
86
87//获得浏览器类别名称
88function getBrowsers()
89{
90	var userinfo = navigator.userAgent.toLowerCase();
91	var arrayBrowser = new Array("msie", "firefox", "android","chrome","safari", "opera", "netscape");
92	for(var i = 0; i < arrayBrowser.length; i ++)
93	{
94		if(userinfo.indexOf(arrayBrowser[i]) != -1)
95		{
96			return arrayBrowser[i];
97		}
98		if(/(msie\s|trident.*rv:)([\w.]+)/.test(userinfo)) return "msie";
99	}
100	return "other";
101}
102
103function outVideoForMobile(vurl,vheight,vwidth,vautoplay)
104{
105        //手机显示时,视频宽度为设备宽度
106        if(hasPlayHtml5Vedio())
107        {
108		    var res='<video controls="controls"  width="'+document.body.clientWidth+'"';
109    		if(bautoPlay&&bautoPlay=="true")
110    		{
111    		    res+=' autoplay="autoplay" ';
112    		}
113    		res +='><source src="'+vurl+'" type="video/mp4" /></video> ';
114		
115    		document.write(res);    
116		}    
117		else
118		    alert("不支持");        
119}

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.