myVideo.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /**
  2. * myVideo.js
  3. */
  4. var maxHeight = 10000;
  5. var maxWidth = 10000;
  6. var basePath, videoId;
  7. var body_resize = function(){
  8. maxHeight = document.documentElement.clientHeight;
  9. maxWidth = document.documentElement.clientWidth;
  10. $("#my-video").css('height',maxHeight+'px');
  11. $("#my-video").css('width',maxWidth+'px');
  12. }
  13. var myload = function(){
  14. var hasFlash = 0; //是否安装了flash
  15. var flashVersion = 0; //flash版本
  16. var isIE = /*@cc_on!@*/0; //是否IE浏览器
  17. if (isIE) {
  18. var swf = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
  19. if (swf) {
  20. hasFlash = 1;
  21. VSwf = swf.GetVariable("$version");
  22. flashVersion = parseInt(VSwf.split(" ")[1].split(",")[0]);
  23. }
  24. } else {
  25. if (navigator.plugins && navigator.plugins.length > 0) {
  26. var swf = navigator.plugins["Shockwave Flash"];
  27. if (swf) {
  28. hasFlash = 1;
  29. var words = swf.description.split(" ");
  30. for (var i = 0; i < words.length; ++i) {
  31. if (isNaN(parseInt(words[i]))) continue;
  32. flashVersion = parseInt(words[i]);
  33. }
  34. }
  35. }
  36. }
  37. basePath = document.getElementById('basePath').value;
  38. videoId = document.getElementById('videoId').value;
  39. $("#openFlash").css('display','none');
  40. var my_video = document.getElementById('my-video');
  41. var source = document.createElement('source');
  42. source.setAttribute('src','rtmp://47.103.74.123:1935/live/'+videoId);
  43. source.setAttribute('type','rtmp/flv');
  44. my_video.appendChild(source);
  45. $(window).resize(function(){
  46. body_resize();
  47. });
  48. body_resize();
  49. if(hasFlash){
  50. videojs('my-video').play();
  51. }
  52. $(".openFlashTips").css('display','none');
  53. }