Просмотр исходного кода

3dDisplayEngine myVideo.js 李欣儒 commit at 2020-10-16

李欣儒 4 лет назад
Родитель
Сommit
99a113a99b
1 измененных файлов с 55 добавлено и 0 удалено
  1. 55 0
      3dDisplayEngine/buildingJs/myVideo.js

+ 55 - 0
3dDisplayEngine/buildingJs/myVideo.js

@@ -0,0 +1,55 @@
+/**
+ * myVideo.js
+ */
+var maxHeight = 10000;
+var maxWidth = 10000;
+var basePath, videoId;
+
+var body_resize = function(){
+	maxHeight =  document.documentElement.clientHeight;
+	maxWidth = document.documentElement.clientWidth;
+	$("#my-video").css('height',maxHeight+'px');
+	$("#my-video").css('width',maxWidth+'px');
+}
+
+var myload = function(){
+	var hasFlash = 0;         //是否安装了flash
+    var flashVersion = 0; //flash版本
+    var isIE = /*@cc_on!@*/0;      //是否IE浏览器
+    if (isIE) {
+        var swf = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
+        if (swf) {
+            hasFlash = 1;
+            VSwf = swf.GetVariable("$version");
+            flashVersion = parseInt(VSwf.split(" ")[1].split(",")[0]);
+        }
+    } else {
+        if (navigator.plugins && navigator.plugins.length > 0) {
+            var swf = navigator.plugins["Shockwave Flash"];
+            if (swf) {
+                hasFlash = 1;
+                var words = swf.description.split(" ");
+                for (var i = 0; i < words.length; ++i) {
+                    if (isNaN(parseInt(words[i]))) continue;
+                    flashVersion = parseInt(words[i]);
+                }
+            }
+        }
+    }
+	basePath = document.getElementById('basePath').value;
+	videoId = document.getElementById('videoId').value;
+	$("#openFlash").css('display','none');
+	var my_video = document.getElementById('my-video');
+	var source = document.createElement('source');
+	source.setAttribute('src','rtmp://47.103.74.123:1935/live/'+videoId);
+	source.setAttribute('type','rtmp/flv');
+	my_video.appendChild(source);
+	$(window).resize(function(){
+    	body_resize();
+    });
+	body_resize();
+	if(hasFlash){
+		videojs('my-video').play();
+    }
+	$(".openFlashTips").css('display','none');
+}