1var videoPlug_s = {� 2 main: false,� 3 flash: false� 4};� 5� 6(function (videoPlug_s) {� 7 _watch(videoPlug_s, "main");� 8 _watch(videoPlug_s, "flash");� 9 var urlProtocol=document.location.protocol� 10 if (typeof Promise == 'undefined') {� 11 var scriptObj = document.createElement('script');� 12 scriptObj.type = "text/javascript";� 13 scriptObj.src = "https://cdn.bootcdn.net/ajax/libs/es6-promise/4.1.1/es6-promise.auto.min.js";� 14 var headObj = document.getElementsByTagName('head')[0];� 15 headObj.appendChild(scriptObj);� 16 scriptObj.onload = function () {� 17 hwwVideoPlugin();� 18 }� 19 } else {� 20 hwwVideoPlugin();� 21 }� 22 function hwwVideoPlugin() {� 23 _include_css(urlProtocol+'//statics.haiwainet.cn/tpl2020/2020-05-14/videojs/css/video-js.min.css');� 24 _include_js(urlProtocol+'//statics.haiwainet.cn/tpl2020/2020-05-14/videojs/script/videojs/video.min.js').then(function (response) {� 25 _include_js(urlProtocol+'//statics.haiwainet.cn/tpl2020/2020-05-14/videojs/script/videojs/videojs-ie8.min.js').then(function (response) {� 26 });� 27 // handle success � 28 videoPlug_s.setAttr("main", true);� 29 _include_js(urlProtocol+'//statics.haiwainet.cn/tpl2020/2020-05-14/videojs/script/videojs/videojs-flash.js').then(function (response) {� 30 videoPlug_s.setAttr("flash", true);� 31 });� 32 console.log("æä»¶å¼å ¥æå");� 33 }).catch(function (error) {� 34 // handle error� 35 console.log("videojså¼å ¥å¤±è´¥:", error);� 36 })� 37 // .finally(function () {� 38� 39 // console.log("æä»¶å¼å ¥å®æ¯");� 40� 41 // });� 42 }� 43 function _include_js(path) {� 44 return new Promise(function (resolve, reject) {� 45 var sobj = document.createElement('script');� 46 sobj.type = "text/javascript";� 47 sobj.src = path;� 48 var headobj = document.getElementsByTagName('head')[0];� 49 headobj.appendChild(sobj);� 50 sobj.onload = function () {� 51 resolve();� 52 }� 53 })� 54 }� 55� 56 function _include_css(path) {� 57 return new Promise(function (resolve, reject) {� 58 var fileref = document.createElement("link")� 59 fileref.rel = "stylesheet";� 60 fileref.type = "text/css";� 61 fileref.href = path;� 62 var headobj = document.getElementsByTagName('head')[0];� 63 headobj.appendChild(fileref);� 64 });� 65 }� 66})(videoPlug_s);� 67� 68//æ£å¼� 69function createVideo(videos) {� 70 this.videosOptions = videos;� 71 var urlProtocol=document.location.protocol;� 72 //å¯å¨� 73 if (!videoPlug_s.main) {� 74� 75 _watch(videoPlug_s, "main", function (obj) {� 76 if (obj.main == true) {� 77 init(videos);� 78 }� 79 });� 80 } else {� 81 init();� 82 }� 83 //å¯å¨å½æ°� 84 function init() {� 85 var _self = this;� 86 for (var i = 0; i < this.videosOptions.length; i++) {� 87 var videoUrl=_self.videosOptions[i].videoSrc.split("//");� 88 if(videoUrl[0]!=urlProtocol){� 89 _self.videosOptions[i].videoSrc=urlProtocol+"//"+videoUrl[1];� 90 � 91 }� 92 switch (true) {� 93 //vmsä¸è·åmp4èµæº� 94 case _self.videosOptions[i].type == "vms" && _self.videosOptions[i].sourceType == "video/mp4":� 95 vmsGetMP4(_self.videosOptions[i].videoSrc, i);� 96 _watch(_self.videosOptions[i], "videoSrc", mp4VMS);� 97 break;� 98 case _self.videosOptions[i].type == "rtmp" && videoPlug_s.flash == false:� 99 var t = i;� 100 _watch(videoPlug_s, "flash", function () { _self.videosOptions[t].videoPlayer = creatDom(_self.videosOptions[t]) });� 101 break;� 102 default: this.videosOptions[i].videoPlayer = creatDom(_self.videosOptions[i]);� 103 }� 104 }� 105 }� 106 //vms mp4 è·ååðå°ååå¤ç� 107 function mp4VMS(obj) {� 108 switch (true) {� 109 case obj.videoSrc.indexOf(".mp4") != -1: obj.videoPlayer = creatDom(obj);� 110 break;� 111 case obj.videoSrc.indexOf(".mov") != -1: obj.sourceType = "video/flv"; obj.videoPlayer = creatDom(obj);� 112 break;� 113 }� 114 // if (obj.videoSrc.indexOf(".mp4") != -1) {� 115 // obj.videoPlayer = creatDom(obj);� 116 // } else {� 117 // //è·åèµæºé误å¤ç� 118 // }� 119 }� 120 //æ£æµæµè§å¨å±æ§� 121 function evCheck() {� 122 var ev = {};� 123 var browser = {� 124 versions: function () {� 125 var u = navigator.userAgent, app = navigator.appVersion;� 126 return {//ç§»å¨ç»ç«¯æµè§å¨çæ¬ä¿¡æ¯� 127 trident: u.indexOf('Trident') > -1, //IEå æ ¸� 128 presto: u.indexOf('Presto') > -1, //operaå æ ¸� 129 webKit: u.indexOf('AppleWebKit') > -1, //è¹æãè°·æå æ ¸� 130 gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //ç«çå æ ¸�
131 mobile: !!u.match(/AppleWebKit.*Mobile.*/) || !!u.match(/AppleWebKit/), //æ¯å¦ä¸ºç§»å¨ç»ç«¯� 132 ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //iosç»ç«¯� 133 android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //androidç»ç«¯æè ucæµè§å¨� 134 iPhone: u.indexOf('iPhone') > -1, //æ¯å¦ä¸ºiPhoneæè QQHDæµè§å¨� 135 iPad: u.indexOf('iPad') > -1, //æ¯å¦iPad� 136 webApp: u.indexOf('Safari') == -1 //æ¯å¦webåºè¯¥ç¨åºï¼æ²¡æå¤´é¨ä¸åºé¨� 137 };� 138 }(),� 139 language: (navigator.browserLanguage || navigator.language).toLowerCase()� 140 }� 141 if (browser.versions.iPhone || browser.versions.iPad || browser.versions.android) {� 142 ev.terminal = "wap";� 143 } else {� 144 ev.terminal = "PC"� 145 }� 146 browser.versions.iPhone ? ev.iPhone = true : ev.iPhone = false;� 147 return ev;� 148 }� 149 //ä»vmsç³»ç»è·åmp4� 150 function vmsGetMP4(id, i) {� 151 _jsonp(urlProtocol+"//tvplayer.people.com.cn/getXMLForHW.php?path=" + id)� 152 .then(function (response) {� 153 // handle success� 154 this.videosOptions[i].setAttr("videoSrc", response);� 155 })� 156 .catch(function (error) {� 157 // handle error� 158 console.log("vmsèµæºåºé,è¯·æ ¸å®ðæ¯å¦çæã", error);� 159 })� 160 // .finally(function () {� 161 // console.log("vms è¿æ´»çï¼");� 162 // });� 163 }� 164� 165 //creat video Dom� 166 function creatDom(opt) {� 167 var ev = evCheck();� 168 var video = document.createElement("VIDEO");� 169 var videoBox = document.getElementById(opt.el);� 170 // var size =� 171 // "width:" +� 172 // videoBox.clientWidth +� 173 // "px; height : " +� 174 // videoBox.clientHeight +� 175 // "px ;";� 176 var size = "width:100%; height : 100%;";� 177 var flash=false;� 178 video.className = "hwwvideo video-js vjs-big-play-centered";� 179 if (document.getElementById(opt.el + "_video")) {� 180 return;� 181 } else {� 182 videoBox.appendChild(video);� 183 }� 184� 185� 186 // åç§å±æ§ç䏿¹ � 187 video.setAttribute("id", opt.el + "_video");� 188 video.setAttribute("style", size);� 189 if (ev.iPhone) {� 190 video.setAttribute("webkit-playsinline", true);� 191 video.setAttribute("playsinline", true);� 192 }� 193 if (opt.type == "rtmp" || opt.videoSrc.indexOf(".mov") != -1){� 194 flash=true;� 195 }� 196 var finalOption = {� 197 techOrder: flash? ["flash","html5"] : ["html5"],� 198 autoplay: opt.type == "hls"? true:false,� 199 controls: true,� 200 language: 'zh-CN',� 201 poster: opt.poster,� 202 muted: (ev.terminal == "wap") ? true : false,� 203 sources: [ // è§é¢æº� 204 {� 205 src: opt.videoSrc,� 206 type: opt.sourceType,� 207 // poster: opt.poster� 208 }� 209 ],� 210 controlBar: { // 设置æ§å¶æ¡ç»ä»¶� 211 /* 设置æ§å¶æ¡éé¢ç»ä»¶çç¸å ³å±æ§åæ¾ç¤ºä¸å¦*/� 212 'currentTimeDisplay': true,� 213 'timeDivider': true,� 214 'durationDisplay': true,� 215 'remainingTimeDisplay': false,� 216 volumePanel: {� 217 inline: false,� 218 CurrentTimeDisplay: true� 219 },� 220 /* 使ç¨childrençå½¢å¼å¯ä»¥æ§å¶æ¯ä¸ä¸ªæ§ä»¶çä½ç½®ï¼ä»¥åæ¾ç¤ºä¸å¦ */� 221 // children: [� 222 // {name: 'progressControl'}, // ææ¾è¿åº¦æ¡� 223 // {name: 'playToggle'}, // ææ¾æé®� 224 // {name: 'currentTimeDisplay'}, // å½åå·²ææ¾æ¶é´� 225 // {name:'timeDivider'},� 226 // {name: 'durationDisplay'}, // æ»æ¶é´� 227 // {� 228 // name: 'volumePanel', // é³éæ§å¶� 229 // inline: false, // ä¸ä½¿ç¨æ°´å¹³æ¹å¼� 230 // },� 231 // {name: 'FullscreenToggle'} // å ¨å±�
232 // ]� 233 },� 234 };� 235 var videoObj = videojs(opt.el + "_video", finalOption, function () {� 236 var _self = this;� 237 console.log(this);� 238 this.on('error', function () {� 239 _self.errorDisplay.close(); //å°é误信æ¯ä¸æ¾ç¤º� 240 console.log(_self.error);� 241 });� 242 this.on('canplaythrough', function () {� 243 _self.muted(false);� 244 })� 245 this.on('touchstart', function (e) {� 246 console.log("ç¹æäº",e);� 247 _self.paused() ? _self.play() : _self.pause();� 248 })� 249 this.on('click', function () {� 250 console.log("é¼ æäº");� 251 })� 252 });� 253 return videoObj� 254 }� 255 //get jsonp æ¹æ³� 256 function _jsonp(url) {� 257 if (!url) {� 258 console.error("Axios.JSONP è³å°éè¦ä¸ä¸ªurlåæ°!");� 259 return;� 260 }� 261 return new Promise(function (resolve, reject) {� 262 var str =� 263 "haiwai_jsonp_" +� 264 Math.floor(Math.random() * 100) +� 265 new Date().getTime();� 266� 267 window[str] = function (result) {� 268 resolve(result);� 269 };� 270 var JSONP = document.createElement("script");� 271 JSONP.type = "text/javascript";� 272 JSONP.src = url + "&callback=" + str;� 273 document.getElementsByTagName("head")[0].appendChild(JSONP);� 274 });� 275 }� 276� 277� 278}� 279//çå¬å±æ§åå� 280function _watch(obj, attr, callback) {� 281 if (typeof obj.defaultValues == "undefined") {� 282 obj.defaultValues = {};� 283 for (var p in obj) {� 284 if (typeof obj[p] !== "object") obj.defaultValues[p] = obj[p];� 285 }� 286 }� 287 if (typeof obj.setAttr != "undefined") {� 288 delete obj.setAttr� 289 }� 290 obj.setAttr = function (attr, value) {� 291 if (this[attr] != value) {� 292 this.defaultValues[attr] = this[attr];� 293 this[attr] = value;� 294 if (typeof callback === "function") {� 295 return callback(this);� 296 }� 297 }� 298 return this;� 299 };� 300}� 301� 302�
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.