myVideo.js 1.9 KB

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