empirecmsplayer.js 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. //show
  2. function EmpireCMSPlayVideo(vtype,furl,width,height,autostart,baseurl){
  3. var filetype;
  4. var cfiletype;
  5. var playstr='';
  6. var filetypeflash='|.swf|';
  7. var filetypeflv='|.flv|';
  8. var filetypemediaplayer='|.wmv|.asf|.wma|.mp3|.asx|.mid|.midi|';
  9. var filetyperealplayer='|.rm|.ra|.rmvb|.mp4|.mov|.avi|.wav|.ram|.mpg|.mpeg|';
  10. var filetypejwplayer='|.flv|.mp4|';
  11. var filetypehtml5video='|.ogg|.mp4|.webm|';
  12. var filetypehtml5audio='|.ogg|.mp3|.wav|';
  13. if(vtype=='auto'||vtype=='')
  14. {
  15. filetype=EmpireCMSPlayerGetFiletype(furl);
  16. cfiletype='|'+filetype+'|';
  17. if(filetypejwplayer.indexOf(cfiletype)!=-1)//jwplayer
  18. {
  19. playstr=EmpireCMSShowJwplayer(furl,width,height,autostart,baseurl);
  20. }
  21. else if(filetypehtml5video.indexOf(cfiletype)!=-1)//html5video
  22. {
  23. playstr=EmpireCMSShowHtml5video(furl,width,height,autostart,baseurl);
  24. }
  25. else if(filetypehtml5audio.indexOf(cfiletype)!=-1)//html5audio
  26. {
  27. playstr=EmpireCMSShowHtml5audio(furl,width,height,autostart,baseurl);
  28. }
  29. else if(filetypeflv.indexOf(cfiletype)!=-1)//flv
  30. {
  31. playstr=EmpireCMSShowFlv(furl,width,height,autostart,baseurl);
  32. }
  33. else if(filetypeflash.indexOf(cfiletype)!=-1)//flash
  34. {
  35. playstr=EmpireCMSShowFlash(furl,width,height,autostart,baseurl);
  36. }
  37. else if(filetyperealplayer.indexOf(cfiletype)!=-1)//realplayer
  38. {
  39. playstr=EmpireCMSShowRealPlayer(furl,width,height,autostart,baseurl);
  40. }
  41. else//mediaplayer
  42. {
  43. playstr=EmpireCMSShowMediaPlayer(furl,width,height,autostart,baseurl);
  44. }
  45. }
  46. else
  47. {
  48. if(vtype=='jwplayer')//jwplayer
  49. {
  50. playstr=EmpireCMSShowJwplayer(furl,width,height,autostart,baseurl);
  51. }
  52. else if(vtype=='html5video')//html5video
  53. {
  54. playstr=EmpireCMSShowHtml5video(furl,width,height,autostart,baseurl);
  55. }
  56. else if(vtype=='html5audio')//html5audio
  57. {
  58. playstr=EmpireCMSShowHtml5audio(furl,width,height,autostart,baseurl);
  59. }
  60. else if(vtype=='flv')//flv
  61. {
  62. playstr=EmpireCMSShowFlv(furl,width,height,autostart,baseurl);
  63. }
  64. else if(vtype=='flash')//flash
  65. {
  66. playstr=EmpireCMSShowFlash(furl,width,height,autostart,baseurl);
  67. }
  68. else if(vtype=='realplayer')//realplayer
  69. {
  70. playstr=EmpireCMSShowRealPlayer(furl,width,height,autostart,baseurl);
  71. }
  72. else//mediaplayer
  73. {
  74. playstr=EmpireCMSShowMediaPlayer(furl,width,height,autostart,baseurl);
  75. }
  76. }
  77. document.write(playstr);
  78. }
  79. //filetype
  80. function EmpireCMSPlayerGetFiletype(sfile){
  81. var filetype,s;
  82. s=sfile.lastIndexOf(".");
  83. filetype=sfile.substring(s+1).toLowerCase();
  84. return '.'+filetype;
  85. }
  86. //flash
  87. function EmpireCMSShowFlash(furl,width,height,autostart,baseurl){
  88. var str='';
  89. str='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+width+'" height="'+height+'"><param name="movie" value="'+furl+'"><param name="quality" value="high"><embed src="'+furl+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'" autostart="'+autostart+'"></embed></object>';
  90. return str;
  91. }
  92. //flv
  93. function EmpireCMSShowFlv(furl,width,height,autostart,baseurl){
  94. var str='';
  95. var fname='';
  96. str='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+width+'" height="'+height+'"><param name="movie" value="'+baseurl+'e/data/modadd/moreplayer/flv/flvplayer.swf?vcastr_file='+furl+'&vcastr_title='+fname+'&BarColor=0xFF6600&BarPosition=1&IsAutoPlay='+autostart+'"><param name="quality" value="high"><param name="allowFullScreen" value="true" /><embed src="flv/flvplayer.swf?vcastr_file='+furl+'&vcastr_title='+fname+'&BarColor=0xFF6600&BarPosition=1&IsAutoPlay='+autostart+'" allowFullScreen="true" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"></embed></object>';
  97. return str;
  98. }
  99. //mediaplayer
  100. function EmpireCMSShowMediaPlayer(furl,width,height,autostart,baseurl){
  101. var str='';
  102. str='<object align="middle" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" class="OBJECT" id="MediaPlayer" width="'+width+'" height="'+height+'"><PARAM NAME="AUTOSTART" VALUE="'+autostart+'"><param name="ShowStatusBar" value="-1"><param name="Filename" value="'+furl+'"><embed type="application/x-oleobject codebase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" flename="mp" src="'+furl+'" width="'+width+'" height="'+height+'"></embed></object>';
  103. return str;
  104. }
  105. //realplayer
  106. function EmpireCMSShowRealPlayer(furl,width,height,autostart,baseurl){
  107. var str='';
  108. str='<object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" HEIGHT="'+height+'" ID="Player" WIDTH="'+width+'" VIEWASTEXT><param NAME="_ExtentX" VALUE="12726"><param NAME="_ExtentY" VALUE="8520"><param NAME="AUTOSTART" VALUE="'+autostart+'"><param NAME="SHUFFLE" VALUE="0"><param NAME="PREFETCH" VALUE="0"><param NAME="NOLABELS" VALUE=0><param NAME=CONTROLS VALUE=ImageWindow><param NAME=CONSOLE VALUE=_master><param NAME=LOOP VALUE=0><param NAME=NUMLOOP VALUE=0><param NAME=CENTER VALUE=0><param NAME=MAINTAINASPECT VALUE="'+furl+'"><param NAME=BACKGROUNDCOLOR VALUE="#000000"></object><br><object CLASSID="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" HEIGHT=32 ID="Player" WIDTH="'+width+'" VIEWASTEXT><param NAME=_ExtentX VALUE=18256><param NAME=_ExtentY VALUE=794><param NAME=AUTOSTART VALUE="'+autostart+'"><param NAME=SHUFFLE VALUE=0><param NAME=PREFETCH VALUE=0><param NAME=NOLABELS VALUE=0><param NAME=CONTROLS VALUE=controlpanel><param NAME=CONSOLE VALUE=_master><param NAME=LOOP VALUE=0><param NAME=NUMLOOP VALUE=0><param NAME=CENTER VALUE=0><param NAME=MAINTAINASPECT VALUE=0><param NAME=BACKGROUNDCOLOR VALUE="#000000"><param NAME=SRC VALUE="'+furl+'"></object>';
  109. return str;
  110. }
  111. //jwplayer
  112. function EmpireCMSShowJwplayer(furl,width,height,autostart,baseurl){
  113. var str='';
  114. str='<scri'+'pt type="text/javascript" src="'+baseurl+'e/data/modadd/moreplayer/jwplayer/jwplayer.js"></scri'+'pt><div id="EmpireCMSmyElement">Loading the player...</div><scri'+'pt type="text/javascript">jwplayer("EmpireCMSmyElement").setup({ autostart:'+autostart+',file: "'+furl+'",height:'+height+',width:'+width+' });</scri'+'pt>';
  115. return str;
  116. }
  117. //html5video
  118. function EmpireCMSShowHtml5video(furl,width,height,autostart,baseurl){
  119. var str='';
  120. var addauto='';
  121. if(autostart==1)
  122. {
  123. addauto=' autoplay="autoplay"';
  124. }
  125. str='<video id="ecmsvideoid" width="'+width+'" height="'+height+'" controls="controls"'+addauto+'><source src="'+furl+'"></source> Your browser is not supported </video>';
  126. return str;
  127. }
  128. //audio
  129. function EmpireCMSShowHtml5audio(furl,width,height,autostart,baseurl){
  130. var str='';
  131. var addauto='';
  132. if(autostart==1)
  133. {
  134. addauto=' autoplay="autoplay"';
  135. }
  136. str='<audio id="ecmsaudioid" src="'+furl+'" controls="controls"'+addauto+'> Your browser is not supported </audio>';
  137. return str;
  138. }