liveSDK1.js 80 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. ! function(e) { var t = {};
  2. function i(n) { if (t[n]) return t[n].exports; var o = t[n] = { i: n, l: !1, exports: {} }; return e[n].call(o.exports, o, o.exports, i), o.l = !0, o.exports }
  3. i.m = e, i.c = t, i.d = function(e, t, n) { i.o(e, t) || Object.defineProperty(e, t, { enumerable: !0, get: n }) }, i.r = function(e) { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e, "__esModule", { value: !0 }) }, i.t = function(e, t) { if (1 & t && (e = i(e)), 8 & t) return e; if (4 & t && "object" == typeof e && e && e.__esModule) return e; var n = Object.create(null); if (i.r(n), Object.defineProperty(n, "default", { enumerable: !0, value: e }), 2 & t && "string" != typeof e)
  4. for (var o in e) i.d(n, o, function(t) { return e[t] }.bind(null, o)); return n }, i.n = function(e) { var t = e && e.__esModule ? function() { return e.default } : function() { return e }; return i.d(t, "a", t), t }, i.o = function(e, t) { return Object.prototype.hasOwnProperty.call(e, t) }, i.p = "", i(i.s = 0) }([function(e, t) {! function e() { var t = "3.7.0",
  5. i = function() { return !!(window.ActiveXObject || "ActiveXObject" in window) },
  6. n = function() { var e = new Date; return e.getMonth() + "_" + e.getDay() + "_" + e.getHours() + "_" + e.getMinutes() + "_" + e.getSeconds() },
  7. o = function() { return 0 == h.delay };! function() {
  8. function e(e) { console.log && console.log(e) }
  9. function i(e) { console.warn && console.warn(e) }
  10. function n(e, t) { for (var i = e.split("."), n = t.split("."), o = 0, a = i.length, r = !1; o < a - 1;) { var s = parseInt(i[o]),
  11. c = parseInt(n[o]); if (s > c) { r = !0; break } if (s < c) { r = !1; break }
  12. o++ } return r } var o = "//view.csslcloud.net/version/version.json?v=" + (new Date).getTime(),
  13. a = null; try { window.XMLHttpRequest ? a = new XMLHttpRequest : window.ActiveXObject && (a = new ActiveXObject("Microsoft.XMLHTTP")), a && (a.open("GET", o, !0), a.onreadystatechange = function() { if (4 === a.readyState && 200 === a.status) { var o = JSON.parse(a.responseText);
  14. o && function(o) { var a = o.h5 ? o.h5 : {}; if (a.lowyerVersion && n(a.lowyerVersion.v, t)) { a.lowyerVersion.expiration; var r = a.errorMsg; if (e(r), Error) throw new Error(r);
  15. i(r) } else if (a.latestVersion && n(a.latestVersion.v, t)) i(a.notify) }(o) } }, a.send()) } catch (t) { e("璁块棶鐗堟湰淇℃伅澶辫触") } }(); var a = { retry: 0, isFrist: !0, ccTrackTimer: null, ccTrackCount: 0, catonDuration: 0, isCaton: !1, catonCount: 0, HEART_BEAT: 6e4, isEnd: !1, ccTrackTiming: 0, init: function() { ccTrack.init({ business: "2001", roleid: c.viewerid, userid: c.viewerid, roomid: c.roomid, platform: A.isMobile() ? "h5-pc" : "h5-m", is_low_delay: o(), scene_type: 0, event_ver: "2.1", appVer: t, appid: c.userid, livestarttime: c.liveCountdown ? 0 : (new Date).getTime() + 1e3 * c.liveCountdown }), this.join() }, join: function() { try { var e = { event: "join", code: 200, rid: (new Date).getTime() };
  16. ccTrack.tragger(e) } catch (e) {} }, pusherSucces: function() { try { var e = { event: "pusher", code: 200, rid: (new Date).getTime() };
  17. ccTrack.tragger(e) } catch (e) {} }, pusherReconnect: function() { this.retry++; try { var e = { event: "pusher", code: 201, rid: (new Date).getTime(), retry: this.retry };
  18. ccTrack.tragger(e) } catch (e) {} }, pusherReconnecting: function() { try { var e = { event: "pusher", code: 402, rid: (new Date).getTime() };
  19. ccTrack.tragger(e) } catch (e) {} }, pusherFailed: function() { try { var e = { event: "pusher", code: 401, rid: (new Date).getTime() };
  20. ccTrack.tragger(e) } catch (e) {} }, pusherDisconnect: function() { try { var e = { event: "pusher", code: 400, rid: (new Date).getTime() };
  21. ccTrack.tragger(e) } catch (e) {} }, ccTrackTimerFoo() { var e = this;
  22. e.ccTrackTimer && (clearInterval(e.ccTrackTimer), e.ccTrackTimer = null), e.ccTrackTimer = setInterval(function() { if (e.isEnd) return clearInterval(e.ccTrackTimer), void(e.ccTrackTimer = null); try { e.ccTrackCount = e.ccTrackCount + 1, e.isCaton && (e.catonDuration = e.catonDuration + ((new Date).getTime() - e.catonTime)), e.catonDuration >= 6e4 && (e.isCaton = !1); var t = { event: "heartbeat", code: 200, blocktimes: e.catonCount, blockduration: e.catonDuration >= 6e4 ? 0 : e.catonDuration, rid: (new Date).getTime(), num: e.ccTrackCount, heartinter: 60, cdn: e.ccTrackCDN };
  23. e.catonCount = 0, e.catonDuration = 0, e.ccTrackTiming = (new Date).getTime(), ccTrack.tragger(t) } catch (e) { console.log("ccTrackTimer:", e) } }, e.HEART_BEAT) }, setUrl(e) { this.ccTrackCDN = /^http(s)?:\/\/(.*?)\//.exec(e)[2] }, endLive() { this.isEnd = !0, this.isFrist = !0 }, bindVideoEvent: function(e) { var t = this;
  24. this.isEnd = !1; var i = e; try { i.removeEventListener("waiting", function() {}), i.removeEventListener("play", function() {}), i.removeEventListener("canplay", function() {}), i.removeEventListener("ended", function() {}) } catch (e) {}
  25. i.addEventListener("canplay", function() { t.startPlayTime = (new Date).getTime(), t.isCaton && (t.isCaton = !1, 0 === t.catonCount ? (t.catonCount = t.catonCount + 1, t.catonDuration = t.catonDuration + ((new Date).getTime() - t.ccTrackTiming)) : t.catonDuration = t.catonDuration + ((new Date).getTime() - t.catonTime)) }), i.addEventListener("play", function() { var e = (new Date).getTime(); if (t.isFrist) { t.ccTrackTimerFoo(), t.isFrist = !1; try { var i = { event: "play", et: e - t.startPlayTime, code: 200, rid: (new Date).getTime(), cdn: t.ccTrackCDN };
  26. ccTrack.tragger(i) } catch (e) {} } }), i.addEventListener("waiting", function() { t.isSeeking || (t.catonCount = t.catonCount + 1, t.isCaton = !0, t.catonTime = (new Date).getTime()) }), i.addEventListener("playing", function() {}), i.addEventListener("seeking", function() { t.isSeeking = !0 }, !1), i.addEventListener("seeked", function() { t.isSeeking = !1 }, !1), i.addEventListener("ended", function() {}, !1), i.onerror = function() { try { var e = { event: "play", code: 400, rid: (new Date).getTime() };
  27. ccTrack.tragger(e) } catch (e) {} } } },
  28. r = function(e, t, i) { $.ajax({ url: e, type: "GET", dataType: "jsonp", data: t, xhrFields: { withCredentials: !0 }, success: function(e) { "function" == typeof i ? i && i(e) : console.log && console.log("onQuestionnairePublish is undefined") }, error: function(e) { "function" == typeof i ? i({ errorCode: 1, msg: "request error", result: e }) : console.log && console.log("onQuestionnairePublish is undefined") } }) },
  29. s = { DocModeType: { NormalMode: 0, FreeMode: 1 }, isDPReady: !1, dpc: {}, fastMode: !0, init: function() { this.dpc = new Dpc({ roomId: c.roomid, acountId: c.userid, token: l.options.key, type: 1, isOpenWaterMark: parseInt(c.fileProcess, 10) }), $("#drawPanel").css({ height: "100%", width: "100%" }) }, appendDrawPanel: function() { var e = '<iframe id="dpa" allow-scripts allowfullscreen allowusermedia frameborder="0" style="width: 100%;height:100%;"></iframe>'; "isMobile" == A.isMobile() && (e = '<iframe id="dpa" allow-scripts allowfullscreen allowusermedia frameborder="0" style="width: 100%;height:100%;pointer-events: none;"></iframe>'), $("#drawPanel").append(e), "function" == typeof window.on_cc_live_db_flip && window.on_cc_live_db_flip() }, destroy: function() { this.dpc && this.dpc.dispose && this.dpc.dispose(), $("#dpa").remove() }, pageChange: function(e) { this.isDPReady && this.fastMode && this.dpc.pageChange(e) }, animationChange: function(e) { this.isDPReady && this.fastMode && this.dpc.animationChange(e) }, history: function(e) { this.isDPReady && this.fastMode && this.dpc.history(e) }, draw: function(e) { this.isDPReady && this.fastMode && this.dpc.draw(e) }, clear: function() { this.isDPReady && this.fastMode && this.dpc.clear() }, reload: function() { this.isDPReady && this.fastMode && this.dpc.reload() }, setDocMode: function(e) { this.isDPReady && this.fastMode && this.dpc.setFreeDocMode(e) }, getDocs: function(e) { this.isDPReady && this.fastMode && this.dpc.getDocs(c.roomid, c.userid, e) }, changePageTo: function(e, t) { this.isDPReady && this.fastMode && this.dpc.changePageTo(e, t) }, showMarquee: function(e) { this.isDPReady && this.fastMode && this.dpc.openMarquee(e) }, closeMarquee: function() { this.isDPReady && this.fastMode && this.dpc.closeMarquee() }, openBarrage: function(e) { this.isDPReady && this.fastMode && this.dpc.openBarrage() }, insertBarrage: function(e) { if (this.isDPReady && this.fastMode) { var t; try { t = JSON.parse(e) } catch (i) { t = { type: "text", content: e } }
  30. this.dpc.insertBarrage(t) } }, closeBarrage: function() { this.isDPReady && this.fastMode && this.dpc.closeBarrage() }, docAdapt: function(e) { if (this.isDPReady && this.fastMode) { var t = e ? "1" : "2";
  31. this.dpc.setDisplayMode(t) } } };
  32. window.isRequesting = !1; var c = { DocModeType: { NormalMode: 0, FreeMode: 1 }, MediaScaleMode: { scale43: "4:3", scale169: "16:9", scaleFull: "full", scaleNormal: "normal" }, init: function(e) { var t, i, n, o;
  33. void 0 === e && (e = {}), this.userid = $.trim(e.userid), this.roomid = $.trim(e.roomid), this.groupid = $.trim(e.groupid), this.viewername = $.trim(e.viewername), this.viewertoken = $.trim(e.viewertoken), this.forcibly = $.trim(e.forcibly), this.viewercustomua = $.trim(e.viewercustomua), this.language = $.trim(e.language), this.viewercustominfo = $.trim(e.viewercustominfo), this.ua = $.trim(e.ua), this.viewerid = $.trim(e.viewerid), this.upid = $.trim(e.upid), this.isPCH5Live = !1, e.pcH5Live && (this.isPCH5Live = "true" === $.trim(e.pcH5Live.toString())), t = "lang", i = this.language, n = 1e5, (o = new Date).setDate(o.getDate() + n), document.cookie = t + "=" + i + "; expires=" + o.toDateString(), "string" == typeof e.fastMode ? "false" === e.fastMode ? this.fastMode = !1 : this.fastMode = !0 : "boolean" == typeof e.fastMode ? this.fastMode = e.fastMode : this.fastMode = !0, s.fastMode = this.fastMode, this.forceNew = !1, "boolean" == typeof e.forceNew && (this.forceNew = e.forceNew); var a = this,
  34. r = ["//static.csslcloud.net/js/socket.io.js", "//static.csslcloud.net/js/report.js", "//class.csslcloud.net/cctrack/ccTrack.js", "//view.csslcloud.net/js/aliyun-rts-sdk.js"];
  35. navigator.appVersion.indexOf("MSIE") >= 0 || "isMobile" == A.isMobile() || r.push("//static.csslcloud.net/js/AgoraRTCSDK-2.7.1.js"); var u = document.getElementById("drawPanel"); if (s.fastMode && u && r.push("//image.csslcloud.net/live/1.0.4/web/js/dpc.js?v=" + (new Date).getTime()), "isMobile" == A.isMobile()) $("#drawPanel").length > 0 && (s.fastMode || r.push("//static.csslcloud.net/js/module/drawingBoard-2.0.0.js"));
  36. else { if (! function() { var e = !0; if (navigator.appVersion.indexOf("MSIE") >= 0) try { new ActiveXObject("ShockwaveFlash.ShockwaveFlash") } catch (t) { e = !1 } else navigator.plugins["Shockwave Flash"] || (e = !1); return e }() && ("function" == typeof c.onNotSupportFlash && c.onNotSupportFlash(), "18452D400D6B81D5" == this.userid)) { var d = $("#" + h.id).parent().height(),
  37. l = $("#" + h.id).parent().width();
  38. $("#" + h.id).append('<div style="z-index: 999999;"><p style="color: #0e0e0e; width: 260px;">鎮ㄨ繕娌℃湁瀹夎flash鎾斁鍣�,璇风偣鍑�<a href="http://www.adobe.com/go/getflash" style="color: red;" target="_blank">杩欓噷</a>瀹夎</p></div>').parent().css("z-index", "999999"); var f = $($("#" + h.id + " div p")[0]).height(),
  39. p = $($("#" + h.id + " div p")[0]).width();
  40. $("#" + h.id + " div").css({ "margin-left": (l - p - 60) / 2 + "px", "margin-top": (d - f) / 2 + "px" }), setInterval(function() { $("#" + h.id).parent().show() }, 3e3) }
  41. r.push("//static.csslcloud.net/js/swfobject.js", "//static.csslcloud.net/js/json3.min.js") }
  42. a.loadScript(r, function() { if (a.login(function() { a.history = new y }), $("#drawPanel").css({ height: "100%", width: "100%" }), "isMobile" == A.isMobile() && $.DrawingBoard) { $("#drawPanel").append('<canvas id="drawPanel" width="1200" height="1200" style="position: absolute;z-index:2;top:0;left: 0"></canvas><iframe id="dpa" src="" frameborder="0" style="position: absolute;top:0;left: 0"></iframe>'), $("div#drawPanel").remove(), $.DrawingBoard.config() } }) }, login: function(e) { $.ajax({ url: "//view.csslcloud.net/api/room/login", type: "GET", dataType: "jsonp", data: { roomid: this.roomid, userid: this.userid, groupid: this.groupid, viewername: this.viewername, viewertoken: this.viewertoken, forcibly: this.forcibly, viewercustomua: this.viewercustomua, viewercustominfo: this.viewercustominfo, version: t, service: 2, client: 4 }, success: function(t) { if (t.success) { var i = "https:" === window.location.protocol,
  43. n = t.datas.pusherNode.primary; if (i && n && n.indexOf(":")) { var o = n.split(":"); if (2 == o.length) { var r = parseInt(o[1]); if (!isNaN(r)) { var d = r + 400;
  44. n = o[0] + ":" + d } } } var f = document.location.protocol + "//" + n + "/" + t.datas.pusher.nsp,
  45. g = t.datas.viewer.key;
  46. l.options.pusherUrl = f, l.options.key = g, c.viewerid = t.datas.viewer.id, c.sessionId = t.datas.viewer.key, c.viewername = t.datas.viewer.name, c.isBan = t.datas.room.isBan, c.liveId = t.datas.liveId, c.upid = t.datas.upId, c.multiQuality = t.datas.room.multiQuality, c.documentDisplayMode = t.datas.room.documentDisplayMode, c.isBarrage = t.datas.room.barrage, c.liveCountdown = t.datas.room.liveCountdown, c.groupId = t.datas.viewer.groupId, c.fileProcess = t.datas.fileProcess, c.rtsFlag = t.datas.room.rtsFlag; var v = document.getElementById("drawPanel");
  47. s.fastMode && v && ($("#documentDisplayMode").length <= 0 && $("body").append("<input id='documentDisplayMode' type='hidden' value=''>"), $("#documentDisplayMode").val(c.documentDisplayMode), s.isDPReady = !0, s.appendDrawPanel(), s.init(), window.on_hdLive_drawPanel_complete && window.on_hdLive_drawPanel_complete()), e(); var m = t.datas.room.delayTime,
  48. w = t.datas.room.foreignPublish;
  49. h.delay = m, m <= 0 && 5e3, h.foreignPublish = w, h.openHostMode = t.datas.room.openHostMode, h.dvr = t.datas.room.dvr, h.barrageData = t.datas.room.barrage, h.warmVideoId = t.datas.room.encryptWarmVideoId, h.viewerid = t.datas.viewer.id; var y = t.datas.room.playerBackgroundImageUri; if (y)(i = "https:" === window.location.protocol) && (y = y.replace(/http:/g, "https:"));
  50. else y = "";
  51. h.backgroundImageUri = y, "function" == typeof c.playerBackgroundImageUri && c.playerBackgroundImageUri(y); var _ = t.datas.room.playerBackgroundHint;
  52. _ || (_ = ""), h.backgroundHint = _, "function" == typeof c.playerBackgroundHint && c.playerBackgroundHint(_); var b = t.datas.announcement; "function" == typeof c.onAnnouncementShow && b && c.onAnnouncementShow(b); var T = t.datas.room.desc; "function" == typeof c.onLiveDesc && c.onLiveDesc(T); var k = t.datas.room.showUserCount; "function" == typeof c.showUserCount && c.showUserCount(k); var P = t.datas.viewer.marquee; if ("function" == typeof c.getMarquee && c.getMarquee(P), "function" == typeof c.onLoginSuccess) { var M = { desc: t.datas.template.desc, type: t.datas.template.type, name: t.datas.template.name, id: t.datas.template.id },
  53. L = { id: t.datas.viewer.id, groupId: t.datas.viewer.groupId, name: t.datas.viewer.name },
  54. C = { live: t.datas.live, template: M, viewer: L };
  55. c.onLoginSuccess(C) } var R = t.datas.live; switch ("function" == typeof c.onLiveTime && c.onLiveTime(R), l.init(), a.init(), u.init(), "isMobile" == A.isMobile() ? A.init() : h.init(), t.datas.template.type) {
  56. case 6:
  57. I.init(), c.sendPublicChatMsg = c.sendPrivateChatMsg = function() { return !1 }; break;
  58. case 5:
  59. S.init(), I.init(), p.init(); break;
  60. case 4:
  61. S.init(), p.init(), c.sendQuestionMsg = function() { return !1 }; break;
  62. case 3:
  63. S.init(), c.sendQuestionMsg = function() { return !1 }; break;
  64. case 2:
  65. S.init(), I.init(); break;
  66. default:
  67. S.init(), I.init(), p.init() } } else "function" == typeof c.onLoginError && c.onLoginError(t) } }) }, logout: function(e) { e && ($.ajax({ url: "//view.csslcloud.net/api/live/logout", type: "GET", dataType: "jsonp", timeout: 5e3, xhrFields: { withCredentials: !0 }, success: function(t) { "function" == typeof e.success && e.success(t) }, error: function(t, i, n) { "function" == typeof e.error && e.error({ errorcode: "100", msg: "閫€鍑哄け璐�", info: n }) } }), l.socket && l.socket.disconnect()) }, getScript: function(e, t) { var i = !1,
  68. n = document.createElement("script");
  69. n.src = e, n.onload = n.onreadystatechange = function() { i || this.readyState && "loaded" != this.readyState && "complete" != this.readyState || (i = !0, t && t()) }, document.body.appendChild(n) }, loadScript: function(e, t) { if ("string" == typeof e) { var i = e;
  70. (e = []).push(i) } var n = this,
  71. o = function(e, t) { n.getScript(e.shift(), function() { e.length ? o(e, t) : t && t() }) };
  72. o(e, t) }, changeNickname: function(e) { if (!e || "string" != typeof e || e.length > 20) return !1;
  73. l.socket.emit("change_nickname", e) }, destroy: function() { s && s.destroy(), l && l.destroy(), _.interaction && _.interaction.disconnectInteraction(d.viewerId), h && h.isReady && h.destroy(), window.live && window.live.interaction && (window.live.interaction.hangupInteraction && window.live.interaction.hangupInteraction(), window.live.interaction.leaveAgoraRTC()), e(window) }, sendPublicChatMsg: function(e) {!e || e.length > 300 || l.socket.emit("chat_message", e) }, sendPrivateChatMsg: function(e, t, i) { var n = (new Date).getHours(),
  74. o = (new Date).getMinutes(),
  75. a = (new Date).getSeconds();
  76. o = o > 9 ? o : "0" + o, a = a > 9 ? a : "0" + a; var r = { fromuserid: this.viewerid, fromusername: this.viewername, touserid: e, tousername: t, msg: $.trim(i), time: n + ":" + o + ":" + a };
  77. l.socket.emit("private_chat", JSON.stringify(r)) }, sendQuestionMsg: function(e) { if (e && !(e.length > 300)) { var t = { action: "question", value: { userId: this.viewerid, userName: this.viewername, content: e } }; try { l.socket.emit("question", JSON.stringify(t)) } catch (e) {} } }, barrage: function(e, t) { if ("isMobile" != A.isMobile()) { var i = $.trim(e);
  78. i && (i = e.replace(/\[em2?_([0-9]*)\]/g, ""), h.barrage({ txt: i, color: null == t ? 16777215 : t })) } }, getLine: function() { return "isMobile" == A.isMobile() ? A.getLine() : h.getLine() }, getCurrentLine: function() { return "isMobile" == A.isMobile() ? A.getCurrentLine() : h.getCurrentLine() }, changeQuality: function(e, t) { return "isMobile" == A.isMobile() ? A.changeQuality(e, t) : h.changeQuality(e, t) }, getQualityIndex: function() { return "isMobile" == A.isMobile() ? A.getQualityIndex() : h.getQualityIndex() }, changeLine: function(e) { "isMobile" == A.isMobile() ? A.changeLine(e) : h.changeLine(e) }, onlyAudio: function() { "isMobile" == A.isMobile() ? A.onlyAudio() : h.onlyAudio() }, play: function() { "isMobile" == A.isMobile() && A.play() }, changeVideoScale: function(e) { "isMobile" != A.isMobile() && h.changeVideoScale(e) }, setSound: function(e) { "isMobile" != A.isMobile() && h.setSound(e) }, answerRollcall: function(e, t) { var i = { rollcallId: e, userId: this.viewerid, userName: this.viewername, publisherId: t };
  79. l.socket.emit("answer_rollcall", JSON.stringify(i)) }, replyVote: function(e, t, i) { var n = { voteId: e, voteOption: t, publisherId: i };
  80. l.socket.emit("reply_vote", JSON.stringify(n)) }, docBarrage: function(e, t) { $.trim(e) && p.barrage({ txt: e, color: null == t ? 16777215 : t }) }, openBarrage: function(e) { h.openBarrage(e) }, openDocBarrage: function(e) { "isMobile" != A.isMobile() && s.fastMode && s.openBarrage(e) }, insertDocBarrage: function(e) { "isMobile" != A.isMobile() && s.fastMode && s.insertBarrage(e) }, closeDocBarrage: function() { "isMobile" != A.isMobile() && s.fastMode && s.closeBarrage() }, showControl: function(e) { "isMobile" == A.isMobile() ? A.showControl(e) : h.showControl(e) }, switchFullScreen: function(e) { "isMobile" == A.isMobile() ? A.switchFullScreen(e) : h.switchFullScreen(e) }, livePlayerInit: function() { h.init() }, openSound: function() { "isMobile" == A.isMobile() ? A.setMuted(!1) : h.openSound() }, closeSound: function() { "isMobile" == A.isMobile() ? A.setMuted(!0) : h.closeSound() }, docAdapt: function(e) { s.fastMode ? s.docAdapt(e) : _.adapt = e }, requestInteraction: function(e) { window.isRequesting || (window.isRequesting = !0, navigator.appVersion.indexOf("MSIE") >= 0 || _.interaction.requestInteraction(e)) }, hangupInteraction: function() { _.interaction.hangupInteraction() }, enterInteractionRoom: function(e) { var t = void 0; try { l.socket.emit("speak_enter") } catch (e) { t = e } finally { "function" == typeof e && e(t) } }, sendInteractionMessage: function(e, t, i, n, o) { var a = "audio";
  81. e.video && (a = "audiovideo"); var r = { type: a, fromname: this.viewername, fromid: this.viewerid, fromrole: "student", toid: t, event: i, data: JSON.stringify(n) },
  82. s = void 0; try { l.socket.emit("speak_message", JSON.stringify(r)) } catch (e) { s = e } finally { "function" == typeof o && o(s) } }, showMarquee: function(e) { h.showMarquee(e) }, closeMarquee: function() { h.closeMarquee() }, showMarqueeDoc: function(e) { s.fastMode ? s.showMarquee(e) : p.showMarquee(e) }, closeMarqueeDoc: function() { s.fastMode && s.closeMarquee() }, setDocMode: function(e) { s.fastMode && s.setDocMode(e) }, getDocs: function(e) { s.fastMode && s.getDocs(e) }, changePageTo: function(e, t) { s.fastMode && s.changePageTo(e, t) }, submitQuestionnaire: function(e, t) { if (e) { var i = { questionnaireid: e.questionnaireId, answers: JSON.stringify({ subjectsAnswer: e.subjectsAnswer }) };
  83. $.ajax({ url: "//eva.csslcloud.net/api/questionnaire/submit", type: "GET", dataType: "jsonp", timeout: 5e3, data: i, xhrFields: { withCredentials: !0 }, success: function(e) { t ? t(e) : console.log && console.log("no callback") }, error: function(e, i, n) { t && t({ errorCode: 1, msg: "request was aborted", result: n }) } }) } }, commitLottery: function(e, t) { u.commitLottery(e, t) }, getPublishingQuestionnaire: function() { r("//eva.csslcloud.net/api/questionnaire/info", {}, c.onQuestionnairePublish) }, getPracticeInfo: function(e, t) { var i = { practiceId: e, sessionId: l.options.key };
  84. r("//eva.csslcloud.net/api/practice/info", i, t) }, getPracticeInfomation: function(e, t) { var i = { practiceId: e, sessionId: l.options.key, mark: 1 };
  85. r("//eva.csslcloud.net/api/practice/info", i, t) }, submitPracticeInfo: function(e, t, i) { var n = { practiceId: e, options: t, sessionId: l.options.key };
  86. r("//eva.csslcloud.net/api/practice/submit", n, i) }, getPracticeStatisInfo: function(e, t) { var i = { practiceId: e, sessionId: l.options.key };
  87. r("//eva.csslcloud.net/api/practice/statis", i, t) }, getPracticeRanking: function(e, t) { var i = { practiceId: e, sessionId: l.options.key };
  88. r("//eva.csslcloud.net/api/practice/ranking", i, t) }, getHdInquirePunchInformation: function(e) { this.httpRequest({ url: "//view.csslcloud.net/servlet/punch/viewer", data: { sessionId: l.options.key }, success: function(t) { "function" == typeof e && e(t) }, error: function(t) { e && e(t) } }) }, hdCommitPunch: function(e, t) { this.httpRequest({ url: "//view.csslcloud.net/servlet/punch/commit", data: { punchId: e, sessionId: l.options.key }, success: function(e) { t && t(e) }, error: function(e) { t && t(e) } }) }, httpRequest: function(e) { $.ajax({ url: e.url || "", data: e.data || {}, type: e.type || "GET", dataType: e.dataType || "json", timeout: e.timeout || 5e3, success: function(t) { "function" == typeof e.success && e.success(t) }, error: function(t) { "function" == typeof e.error && e.error(t) }, fail: function(t) { "function" == typeof e.fail && e.fail(t) } }) }, clipVideoImage: function() { if (this.isPCH5Live || A.isMobile()) { var e = document.createElement("canvas"),
  89. t = e.getContext("2d"),
  90. i = document.querySelector("#" + h.id + " video"); return i ? (e.width = i.videoWidth, e.height = i.videoHeight, t.drawImage(i, 0, 0, i.videoWidth, i.videoHeight), e.toDataURL()) : "" } } },
  91. u = { init: function() { this.queryLotteryStatus() }, create() { this.queryLotteryStatus() }, cancel() { c.onLottery({ lotteryStatus: 1, haveLottery: !0 }) }, complete() { this.queryLotteryUserInfo() }, queryLotteryStatus() { var e = this;
  92. b("/api/lottery/student/status", { accountId: c.userid, roomId: c.roomid }, function(t) { if (t.success && t.data.haveLottery) { var i = t.data; if ("function" == typeof c.onLottery) { e.lotteryId = t.data.lotteryId, e.lotteryType = i.lotteryType; var n = { lotteryId: i.lotteryId, lotteryStatus: i.lotteryStatus, haveLottery: !0, lotteryType: i.lotteryType };
  93. c.onLottery(n) } } else "function" == typeof c.onLottery && c.onLottery({ haveLottery: !1 }) }) }, queryLotteryUserInfo() { var e = this;
  94. b("/api/lottery/query/own", { accountId: c.userid, roomId: c.roomid, lotteryId: e.lotteryId }, function(t) { if (t.success) { var i = t.data;
  95. e.isWinner = i.isWinner, e.collectTemplateInfo = i.isWinner ? i.collectTemplate : []; var n = { lotteryId: e.lotteryId, haveLottery: !0, lotteryStatus: 2, lotteryType: e.lotteryType, LotteryWinInfo: { LotteryCollectTemplate: i.collectTemplate || [], isWinner: i.isWinner, ownUserInfo: { userAvatar: i.isWinner ? i.ownUserInfo.userAvatar : "", userName: i.isWinner ? i.ownUserInfo.userName : "", userId: i.isWinner ? i.ownUserInfo.userId : "", prizeCode: i.isWinner ? i.ownUserInfo.prizeCode : "" }, LotteryPrize: i.prize, LotteryUserInfo: i.userInfos } };
  96. c.onLottery(n) } }) }, commitLottery: function(e, t) { var i = e.collectInfos.find(function(e) { return 1 === e.index }); if ("" !== i.value && " " !== i.value) { var n = e.collectInfos.find(function(e) { return 2 === e.index });!n || /^[1][3,4,5,7,8,9][0-9]{9}$/.test(n.value) ? T("/api/lottery/collect?accountId=" + c.userid + "&roomId=" + c.roomid, e, function(e) { e.success ? t && t.onSuccess && t.onSuccess("鎻愪氦鎴愬姛") : t && t.onError && t.onError("鎻愪氦澶辫触") }) : t && t.onError && t.onError("璇疯緭鍏ユ纭殑鐢佃瘽鍙风爜") } else t && t.onError && t.onError("濮撳悕涓嶈兘鏈┖") } },
  97. d = { init: function() { this.userId = c.userid, this.roomId = c.roomid, this.groupId = c.groupId, this.liveId = c.liveId, this.viewerId = c.viewerid, this.upId = c.upid } },
  98. l = { options: { pusherUrl: "", key: "", maxMessageCount: 300, userId: "", roomId: "", livePlayerId: "", drawPanel: "" }, drawjson: [], pagechangedata: [], publishStreamTimer: 0, endStreamTimer: 0, init: function() { var e = "isMobile" == A.isMobile() ? 1 : 0;
  99. this.timeIntervalID = -1, c.forceNew ? (this.socket = io.connect(this.options.pusherUrl + "?sessionid=" + l.options.key + "&platform=1&terminal=" + e, { forceNew: !0 }), x("forceNew: true")) : (this.socket = io.connect(this.options.pusherUrl, { query: { sessionid: l.options.key, platform: 1, terminal: e }, secure: !0, transports: ["websocket"] }), x("forceNew: false")), this.bind() }, destroy: function() { this.hangupInteraction(), this.cancelRequestInteraction(), this.socket && this.socket.disconnect(), -1 != this.timeIntervalID && clearInterval(this.timeIntervalID) }, bind: function() { var e = !1;
  100. this.socket.on("connect", function() { a.pusherSucces(), "function" == typeof window.onSocketConnect && window.onSocketConnect() }), this.socket.on("disconnect", function() { a.pusherDisconnect(), "function" == typeof window.onSocketDisconnect && window.onSocketDisconnect(), window.isRequesting = !1 }), this.socket.on("reconnect_failed", function() { a.pusherFailed() }), this.socket.on("reconnecting", function() { a.pusherReconnecting() }), this.socket.on("reconnect", function() { a.pusherReconnect() }), this.socket.on("page_change", function(e) { if (e && "string" == typeof e && l.pagechangedata.push(JSON.parse(e)), "function" == typeof window.on_cc_live_dw_page_change && window.on_cc_live_dw_page_change(e), "function" == typeof c.onPageChange) { var t = JSON.parse(e),
  101. i = { docId: t.value.docid, docName: t.value.fileName, docTotalPage: t.value.totalPage, pageNum: t.value.page };
  102. c.onPageChange(i) } }), this.socket.on("change_nickname", function(e) { c.viewername = e, "function" == typeof c.onChangeNickname && c.onChangeNickname(e) }), this.socket.on("animation_change", function(e) { "function" == typeof window.on_cc_live_dw_animation_change && window.on_cc_live_dw_animation_change(e) }), this.socket.on("draw", function(e) { e && "string" == typeof e && l.drawjson.push(JSON.parse(e)), "function" == typeof window.on_cc_live_dw_draw && window.on_cc_live_dw_draw(e) }), this.socket.on("room_user_count", function(e) { "function" == typeof c.onUserCountMessage && c.onUserCountMessage(e) }), this.socket.on("publish_stream", function(e) { this.publishStreamTimer && clearTimeout(this.publishStreamTimer), this.publishStreamTimer = setTimeout(function() { h && (h.isPublishing = 1), h && h.start && h.start(), "function" == typeof c.onLiveStart && c.onLiveStart(e) }, N()) }), this.socket.on("end_stream", function(e) { this.endStreamTimer && clearTimeout(this.endStreamTimer), this.endStreamTimer = setTimeout(function() { h && (h.isPublishing = 0), h && h.end && h.end(), p && p.clear && p.clear(), s.clear(), "function" == typeof c.onLiveEnd && c.onLiveEnd(e) }, N()) }), this.socket.on("kick_out", function(e) { l.socket.disconnect(), "function" == typeof c.onKickOut && c.onKickOut(e), "function" == typeof c.onKickOutMobile && c.onKickOutMobile(e), A.isIPad() || A.isIPhone() || A.isAndroid() || A.isWindowsPhone() || h.isH5Video() || h.getFlash()._kickOff && h.getFlash()._kickOff() }), this.socket.on("announcement", function(e) { "release" == (e = F(e)).action ? "function" == typeof c.onAnnouncementRelease && c.onAnnouncementRelease(e.announcement) : "remove" == e.action && "function" == typeof c.onAnnouncementRemove && c.onAnnouncementRemove(e) }), this.socket.on("ban_chat_broadcast", function(e) { e = F(e), "function" == typeof c.HDBanChatBroadcastWithData && c.HDBanChatBroadcastWithData(e) }), this.socket.on("in_remind", function(e) { var t = { userId: (e = F(e)).userId, userName: e.userName, userRole: e.userRole, groupId: e.groupId, clientType: e.clientType, prefixContent: e.prefixContent, suffixContent: e.suffixContent, remindAction: 1 }; "function" == typeof c.HDUserRemindWithAction && c.HDUserRemindWithAction(t) }), this.socket.on("out_remind", function(e) { var t = { userId: (e = F(e)).userId, userName: e.userName, userRole: e.userRole, groupId: e.groupId, clientType: e.clientType, prefixContent: e.prefixContent, suffixContent: e.suffixContent, remindAction: 0 }; "function" == typeof c.HDUserRemindWithAction && c.HDUserRemindWithAction(t) }), this.socket.on("start_rollcall", function(e) { e = F(e), "function" == typeof c.onStartRollCall && c.onStartRollCall(e) }), this.socket.on("start_punch", function(e) { e = F(e), "function" == typeof c.onHdLiveStartPunch && c.onHdLiveStartPunch(e) }), this.socket.on("stop_punch", function(e) { e = F(e), "function" == typeof c.onHdLiveStopPunch && c.onHdLiveStopPunch(e) }), this.socket.on("start_lottery", function(e) { e = F(e), "function" == typeof c.onStartLottery && c.onStartLottery(e) }), this.socket.on("win_lottery", function(e) { e = F(e), "function" == typeof c.onWinLottery && c.onWinLottery(e) }), this.socket.on("stop_lottery", function(e) { e = F(e), "function" == typeof c.onStopLottery && c.onStopLottery(e) }), this.socket.on("start_vote", function(e) { e = F(e), "function" == typeof c.onStartVote && c.onStartVote(e) }), this.socket.on("stop_vote", function(e) { e = F(e), "function" == typeof c.onStopVote && c.onStopVote(e) }), this.socket.on("vote_result", function(e) { e = F(e), "function" == typeof c.onVoteResult && c.onVoteResult(e) }), this.socket.on("ban_stream", function(e) { e = F(e), c.isBan = 1, "isMobile" == A.isMobile() ? A.ban() : h.banLive(), "function" == typeof c.onBanStream && c.onBanStream(e) }), this.socket.on("unban_stream", function(e) { e = F(e), c.isBan = 0, "isMobile" == A.isMobile() ? A.unban() : h.unbanLive(), "function" == typeof c.onUnBanStream && c.onUnBanStream(e) }), window.isSpeakThirdParty = !1, this.socket.on("room_setting", function(t) { if (t = F(t), "function" == typeof c.onRoomSetting && (window.allowSpeakThirdParty = t.allow_speak_third_party, "true" == t.allow_speak_interaction && (window.isSpeakThirdParty = !1), "true" == window.allowSpeakThirdParty.status && (window.isSpeakThirdParty = !0, t.allow_speak_interaction = "true"), window.isSpeakThirdParty, c.onRoomSetting(t)), t.layout_video_main != e) { var i = t.layout_video_main; "function" == typeof c.onSwitchVideoDoc && c.onSwitchVideoDoc(i), e = i } }), this.socket.on("silence_user_chat_message", function(e) { "function" == typeof c.onSilenceUserChatMessage && c.onSilenceUserChatMessage(F(e)) }), this.socket.on("ban_delete_chat", function(e) { "function" == typeof c.onBanDeleteChat && c.onBanDeleteChat(F(e)) }), this.socket.on("accept_speak", function(e) { "function" == typeof window.on_cc_live_accept_interaction && window.on_cc_live_accept_interaction(F(e)) }), this.socket.on("speak_message", function(e) { window.isSpeakThirdParty || "function" != typeof window.on_cc_live_interaction_message || window.on_cc_live_interaction_message(F(e)) }), this.socket.on("speak_peer_list", function(e) { "function" == typeof window.on_cc_live_interaction_chatusers && window.on_cc_live_interaction_chatusers(F(e)) }), this.socket.on("speak_disconnect", function(e) { "function" == typeof window.on_cc_live_interaction_disconnect_self && window.on_cc_live_interaction_disconnect_self(F(e)) }), this.socket.on("speak_disconnect_third_party", function(e) { "function" == typeof window.on_cc_live_interaction_disconnect_self && window.on_cc_live_interaction_disconnect_self(F(e)) }), this.socket.on("broadcast_msg", function(e) { "function" == typeof c.onBroadcastMsg && c.onBroadcastMsg(F(e).value) }), this.socket.on("broadcast_action", function(e) { "function" == typeof c.removeBroadcastMsg && c.removeBroadcastMsg(F(e)) }), this.socket.on("publish_question", function(e) { "function" == typeof c.onQaPublish && c.onQaPublish(F(e)) }), this.socket.on("questionnaire_publish", function(e) { e = F(e), "function" == typeof c.onQuestionnairePublish && c.onQuestionnairePublish(e) }), this.socket.on("questionnaire_publish_stop", function(e) { e = F(e), "function" == typeof c.onQuestionnairePublishStop && c.onQuestionnairePublishStop(e) }), this.socket.on("practice_publish", function(e) { e = F(e), "function" == typeof c.onPracticePublish && c.onPracticePublish(e) }), this.socket.on("practice_stop", function(e) { e = F(e), "function" == typeof c.onPracticePublishStop && c.onPracticePublishStop(e) }), this.socket.on("practice_close", function(e) { e = F(e), "function" == typeof c.onPracticeClose && c.onPracticeClose(e) }), this.socket.on("prize_send", function(e) { e = F(e), "function" == typeof c.onPrizeSend && c.onPrizeSend(e) }), this.socket.on("questionnaire_publish_statis", function(e) { e = F(e), "function" == typeof c.onQuestionnairePublishStatis && c.onQuestionnairePublishStatis(e) }), this.socket.on("lottery_create", function(e) { u.create(e) }), this.socket.on("lottery_cancel", function(e) { u.cancel(e) }), this.socket.on("lottery_complete", function(e) { u.complete(e) }), this.socket.on("room_teachers", function(e) { "function" == typeof c.onOnlineTeachers && c.onOnlineTeachers(F(e)) }), this.socket.on("external_questionnaire_publish", function(e) { "function" == typeof c.onExternalQuestionnairePublish && c.onExternalQuestionnairePublish(F(e)) }), this.socket.on("ban_chat", function(e) { "function" == typeof c.onBanChat && c.onBanChat(F(e)) }), this.socket.on("unban_chat", function(e) { "function" == typeof c.onUnBanChat && c.onUnBanChat(F(e)) }), this.socket.on("switch_source", function(e) { "function" == typeof c.onSwitchSource && c.onSwitchSource(e) }); var t = this;
  103. setTimeout(function() { try { t.socket.emit("room_user_count") } catch (e) {} try { t.socket.emit("room_teachers") } catch (e) {} }, 1500), this.timeIntervalID = setInterval(function() { try { t.socket.emit("room_user_count") } catch (e) {} try { t.socket.emit("room_teachers") } catch (e) {} }, 15e3) }, requestInteraction: function(e, t) { var i = "audio";
  104. e.video && (i += "video"); var n = { viewerId: c.viewerid, viewerName: c.viewername, type: i },
  105. o = void 0; try { this.socket.emit("request_speak", JSON.stringify(n)) } catch (e) { o = e } finally { "function" == typeof t && t(o) } }, cancelRequestInteraction: function(e, t) { var i = { viewerId: c.viewerid, viewerName: c.viewername, type: window.live.interaction.local.type };
  106. x("interaction", "鍙栨秷鐢宠锛�" + JSON.stringify(i)); var n = void 0; try { this.socket.emit("cancel_request_speak", JSON.stringify(i)) } catch (e) { n = e } finally { "function" == typeof t && t(n) } }, hangupInteraction: function(e, t) { var i = { viewerId: c.viewerid, viewerName: c.viewername, type: e };
  107. x("interaction", "鎸傛柇浜嬩欢锛�" + JSON.stringify(i)); var n = void 0; try { window.isSpeakThirdParty ? this.socket.emit("hangup_interaction_third_party", JSON.stringify(i)) : this.socket.emit("hangup_interaction", JSON.stringify(i)) } catch (e) { n = e } finally { "function" == typeof t && t(n) } } },
  108. f = function(e) { try { window.PeerConnection = window.PeerConnection || window.webkitPeerConnection00 || window.webkitRTCPeerConnection || window.mozRTCPeerConnection, window.URL = window.URL || window.webkitURL || window.msURL || window.oURL, window.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia, window.nativeRTCIceCandidate = window.mozRTCIceCandidate || window.RTCIceCandidate, window.nativeRTCSessionDescription = window.mozRTCSessionDescription || window.RTCSessionDescription } catch (e) {}
  109. this.usersPcs = { length: 0 }, this.local = { type: { video: !1, audio: !1 }, video: {}, audio: {} }, this.isRequesting = !1, this.client = null, this.localStream = null, this.initAgoraRTC = function(e) { if (AgoraRTC.checkSystemRequirements() || AgoraRTC.Logger.error("Your browser does not support WebRTC!"), AgoraRTC && AgoraRTC.Logger.setLogLevel(AgoraRTC.Logger.ERROR), window.atob) { var t = c.userid,
  110. i = c.roomid,
  111. n = c.sessionId,
  112. o = e.channelId,
  113. a = window.atob(this.hex2str(e.appId)),
  114. r = e.viewToken,
  115. s = e.videosize,
  116. u = { agora: { appId: a, viewToken: r, channelId: o, type: this.local.type, ui: 0, videoSize: s }, tokens: { accountId: t, roomId: i, sessionId: n, channelId: o, ui: 0 } };
  117. this.joinAgoraRTC(u) } }, this.hex2str = function(e) { var t, i = e.trim(),
  118. n = "0x" === i.substr(0, 2).toLowerCase() ? i.substr(2) : i,
  119. o = n.length; if (o % 2 != 0) return alert("Illegal Format ASCII Code!"), ""; for (var a = [], r = 0; r < o; r += 2) t = parseInt(n.substr(r, 2), 16), a.push(String.fromCharCode(t)); return a.join("") }, this.joinAgoraRTC = function(e) { AgoraRTC.checkSystemRequirements() || AgoraRTC.Logger.error("Your browser does not support WebRTC!"); var t = this;
  120. AgoraRTC.Logger.enableLogUpload(), t.client = AgoraRTC.createClient({ mode: "live", codec: "h264" }), t.client.init(e.agora.appId, function() { t.client.join(e.agora.viewToken, e.agora.channelId, e.agora.uid, function(i) { t.localStream = AgoraRTC.createStream({ streamID: i, video: e.agora.type.video, audio: e.agora.type.audio, cameraId: t.cameraId, microphoneId: t.microphoneId, screen: !1 }); var n = e.agora.videoSize.split("x");
  121. t.localStream.setVideoEncoderConfiguration({ resolution: { width: parseInt(n[0]), height: parseInt(n[1]) } }), t.localStream.on("accessAllowed", function() {}), t.localStream.on("accessDenied", function() {}), t.localStream.on("player-status-change", function(e) { "video" == e.mediaType && "aborted" == e.status && t.localStream.close() }), t.localStream.init(function() { $("#agora_local").length || $("#interactionLocalVideo").after('<div id="agora_local"></div>'), t.localStream.play("agora_local"), t.client.publish(t.localStream, function(e) {}), t.client.on("stream-published", function(e) {}) }, function(e) {}) }, function(e) {}) }, function(e) {}), t.client.on("stream-added", function(e) { var i = e.stream;
  122. t.client.subscribe(i, function(e) {}) }), t.client.on("stream-subscribed", function(e) { var t = e.stream;
  123. $("#videoInteractions").append('<div id="interactionRemoteVideo' + t.getId() + '" style="height: 100%; width: 100%;" autoplay></div>'), t.play("interactionRemoteVideo" + t.getId(), { fit: "contain" }) }), t.client.on("first-video-frame-decode", function(e) { "function" == typeof window.on_cc_live_interaction_remote_media && window.on_cc_live_interaction_remote_media(t.local.type), $("#agora_local").hide(), $("#livePlayer").hide(), window.isRequesting = !1 }) }, this.leaveAgoraRTC = function() { this.client && ($("#livePlayer").show(), h.openSound(), this.localStream && this.localStream.close(), this.client && (this.client.leave(function() { $("#videoInteractions").empty(), $("#audioInteractions").empty(), $("#interactionLocalVideo")[0].src = "", $("#agora_local").html("") }, function(e) {}), window.isRequesting = !1)) }, this.cameraId = "", this.microphoneId = "", this.getDevices = function() { var e = this;
  124. AgoraRTC.getDevices(function(t) { for (var i = 0; i !== t.length; ++i) { var n = t[i]; "audioinput" !== n.kind || e.microphoneId || (e.microphoneId = n.deviceId), "videoinput" !== n.kind || e.cameraId || (e.cameraId = n.deviceId) } }) }, this.requestInteraction = function(e, t) { x("Interaction", "璇锋眰浜掑姩"), window.isSpeakThirdParty && this.getDevices(), this.local.type = e, this.isRequesting = !0, this.setRequestTimeoutTimer(), this.createLocalMedia(function(i) { i ? "function" == typeof window.on_cc_live_interaction_error && window.on_cc_live_interaction_error(_.interaction.local.type, i, "鍒涘缓闊宠棰戜俊鎭嚭閿�") : l.requestInteraction(e, t) }) }, this.setCallingTimer = function() { _.interaction.interactionTime = 0, _.interaction.interactionTimeInterval = setInterval(function() { if (++_.interaction.interactionTime, "function" == typeof window.on_cc_live_interaction_interval) { var e = _.interaction.local.type,
  125. t = _.interaction.interactionTime;
  126. window.on_cc_live_interaction_interval(e, t) } }, 1e3) }, this.clearCallingTimer = function() { _.interaction.interactionTime = 0, clearInterval(_.interaction.interactionTimeInterval) }, this.setRequestTimeoutTimer = function() { _.interaction.REQUEST_INTERACTION_TIMEOUT = setTimeout(function() { _.interaction.REQUEST_INTERACTION_TIMEOUT = -1, _.interaction.hangupInteraction(c.viewerid), _.interaction.stopLocalStream(), _.interaction.isRequesting = !1, $("#interactionLocalVideo")[0] && ($("#interactionLocalVideo")[0].src = ""), "function" == typeof window.on_cc_live_interaction_request_timeout && window.on_cc_live_interaction_request_timeout(_.interaction.local.type) }, 6e4), window.isRequesting = !1 }, this.clearRequestTimeoutTimer = function() { _.interaction.REQUEST_INTERACTION_TIMEOUT > 0 && (clearTimeout(_.interaction.REQUEST_INTERACTION_TIMEOUT), _.interaction.REQUEST_INTERACTION_TIMEOUT = -1) }, this.stopLocalStream = function() { if (_.interaction.local.video.stream) try { _.interaction.local.video.stream.getTracks().forEach(function(e) { e.stop() }) } catch (e) {}
  127. if (_.interaction.local.audio.stream) try { _.interaction.local.audio.stream.getTracks().forEach(function(e) { e.stop() }) } catch (e) {} }, this.cancelInteraction = function() { _.interaction.isRequesting = !1, "function" == typeof window.on_cc_live_interaction_cancal && window.on_cc_live_interaction_cancal(_.interaction.local.type) }, this.disconnectInteraction = function(e) { c.openSound(), this.clearRequestTimeoutTimer(), e == c.viewerid ? $.each(_.interaction.usersPcs, function(e, t) { var i = t.pc; if (null == i) return !0; if (i.close(), i = null, _.interaction.usersPcs[e]) { delete _.interaction.usersPcs[e]; var n = _.interaction.usersPcs.length - 1;
  128. _.interaction.usersPcs.length = n < 0 ? 0 : n } }) : $.each(_.interaction.usersPcs, function(t, i) { var n = i.pc; if (!n) return !0; if (t != e) return !0; if (n.close(), n = null, _.interaction.usersPcs[t]) { delete _.interaction.usersPcs[t]; var o = _.interaction.usersPcs.length - 1;
  129. _.interaction.usersPcs.length = o < 0 ? 0 : o } }), 0 == _.interaction.usersPcs.length && this.stopLocalStream(), _.interaction.isInteractioning = !1, _.interaction.isRequesting = !1 }, this.createLocalAudioAndVideoMedia = function(e) { var t = this;
  130. getUserMedia.call(navigator, { video: !0, audio: !0 }, function(i) { t.local.video.stream = i, e && "function" == typeof e && e(i) }, function(t) { x("Interaction", "getUserMedia error: " + t), e && "function" == typeof e && e(t) }) }, this.createLocalAudioMedia = function(e) { var t = this;
  131. getUserMedia.call(navigator, { video: !1, audio: !0 }, function(i) { t.local.audio.stream = i, e && "function" == typeof e && e(i) }, function(t) { x("Interaction", "getUserMedia error: " + t), e && "function" == typeof e && e(t) }) }, this.createLocalMedia = function(e) { var t = this,
  132. i = t.local.type;
  133. getUserMedia.call(navigator, i, function(n) { i.video ? t.local.video.stream = n : t.local.audio.stream = n; var o = $("#interactionLocalVideo")[0];
  134. o && (o.srcObject = n, o.volume = 0), "function" == typeof window.on_cc_live_interaction_local_media && window.on_cc_live_interaction_local_media(i, n), e && "function" == typeof e && e() }, function(t) { x("Interaction", "getUserMedia error: " + t), e && "function" == typeof e && e(t) }) }, this.iceServers = { iceServers: [{ url: "stun:turn.csslcloud.net:3478", credential: "bokecc", username: "cc" }, { url: "turn:turn.csslcloud.net:3478", credential: "bokecc", username: "cc" }], offerExtmapAllowMixed: !1 }, this.createAnswerPeerConnection = function(e) { var t = new PeerConnection(this.iceServers); "audio" == e.type ? (_.interaction.local.audio.stream || this.createLocalAudioMedia(), t.addStream(_.interaction.local.audio.stream)) : (_.interaction.local.video.stream || this.createLocalAudioAndVideoMedia(), t.addStream(_.interaction.local.video.stream)), t.onaddstream = function(t) { "function" == typeof window.on_cc_live_interaction_remote_media_self && window.on_cc_live_interaction_remote_media_self(_.interaction.local.type, e, t.stream) }, t.createAnswer(function(i) { t.setLocalDescription(i), c.sendInteractionMessage(_.interaction.local.type, e.id, "answer", i) }, function(e) { x("Interaction", "Failure callback: " + e) }), t.onicecandidate = function(t) { null !== t.candidate && c.sendInteractionMessage(_.interaction.local.type, e.id, "", t.candidate) }, _.interaction.usersPcs[e.id] = { pc: t, user: e }, _.interaction.usersPcs.length += 1 }, this.createOfferPeerConnection = function(e) { var t = new PeerConnection(this.iceServers),
  135. i = _.interaction.local.type;
  136. i.video ? t.addStream(_.interaction.local.video.stream) : t.addStream(_.interaction.local.audio.stream), t.onaddstream = function(t) { "function" == typeof window.on_cc_live_interaction_remote_media_self && window.on_cc_live_interaction_remote_media_self(_.interaction.local.type, e, t.stream) }, t.oniceconnectionstatechange = function(e) { x("Interaction", "iceConnectionState ..." + t.iceConnectionState), "failed" == t.iceConnectionState && (x("Interaction", "iceConnectionState failed"), _.interaction.hangupInteraction(), "function" == typeof window.on_cc_live_interaction_disconnect_self && window.on_cc_live_interaction_disconnect_self({ disconnectid: c.viewerid })) }, t.createOffer(function(n) { t.setLocalDescription(n), c.sendInteractionMessage(i, e.id, "offer", n) }, function(e) { "function" == typeof window.on_cc_live_interaction_error && window.on_cc_live_interaction_error(_.interaction.local.type, e, "createOfferPeerConnection") }), t.onicecandidate = function(t) { null !== t.candidate && c.sendInteractionMessage(i, e.id, "", t.candidate) }, _.interaction.usersPcs[e.id] = { pc: t, user: e }, _.interaction.usersPcs.length += 1 }, this.id = e.interaction.id, this.isSupportInteraction = function() { return window.isSpeakThirdParty ? !!AgoraRTC.checkSystemRequirements() || (AgoraRTC.Logger.error("Your browser does not support WebRTC!"), !1) : "https:" === window.location.protocol && !!(PeerConnection && URL && getUserMedia && nativeRTCIceCandidate && nativeRTCSessionDescription) }, this.hangupInteraction = function(e) { this.isInteractioning ? l.hangupInteraction(this.type, e) : this.isRequesting ? (l.cancelRequestInteraction(this.type, e), this.stopLocalStream(), this.cancelInteraction()) : (this.stopLocalStream(), this.cancelInteraction()) } },
  137. h = { id: "livePlayer", swfUrl: "//zeus.csslcloud.net/flash/Player.swf", isReady: !1, isPublishing: 0, delay: "", foreignPublish: "", init: function() { var e = { userid: c.userid, roomid: c.roomid, foreignPublish: this.foreignPublish, warmvideoid: this.warmVideoId, openhostmode: this.openHostMode, dvr: this.dvr, barrage: this.barrageData, backgroundImageUri: this.backgroundImageUri, backgroundHint: this.backgroundHint, countDownTime: c.liveCountdown, openMultiQuality: c.multiQuality, language: c.language || "", type: "liveplayer", upid: c.upid, viewerid: this.viewerid, ua: 1 },
  138. t = this.delay;
  139. t > 0 && (e.buffer = t); var a = { allowFullscreen: "true", allowScriptAccess: "always", wmode: "transparent" }; if (c.isPCH5Live) { c.roomid, c.userid; if (i()) swfobject.embedSWF(this.swfUrl, this.id, "100%", "100%", "10.0.0", "/flash/expressInstall.swf", e, a), c.on_hd_live_player_type && c.on_hd_live_player_type("flash");
  140. else { var r = document.getElementById("livePlayer");
  141. $(".flashtip").remove(); var s = document.createElement("script");
  142. s.src = "//view.csslcloud.net/js/sdk/3.7.0/hdLivePlayer.js?v=" + n(), document.body.appendChild(s), s.onload = function() { if (hdPcLivePlayer.isSuppoted()) { var t = { roomid: e.roomid, userid: e.userid, element: r, backgroundHint: e.backgroundHint, countDownTime: e.countDownTime, bacgroundImageUri: e.backgroundImageUri, warmVideoId: e.warmvideoid, upid: e.upid, viewerid: e.viewerid, isLowDelay: o(), barrage: 1 == parseInt(e.barrage, 10), isBan: c.isBan, sessionid: c.sessionId };
  143. hdPcLivePlayer.config(t), window.UNKNOWSTATUSASKLX = !0, window._swfOk(), c.on_hd_live_player_type && c.on_hd_live_player_type("h5") } else swfobject.embedSWF(this.swfUrl, this.id, "100%", "100%", "10.0.0", "/flash/expressInstall.swf", e, a), c.on_hd_live_player_type && c.on_hd_live_player_type("flash") } }
  144. window.hd_h5Live_create_error = function() { hdH5LiveVideo = null, swfobject.embedSWF(this.swfUrl, this.id, "100%", "100%", "10.0.0", "/flash/expressInstall.swf", e, a), c.on_hd_live_player_type && c.on_hd_live_player_type("flash") }.bind(this), window.UNKNOWSTATUSASKLX = !1, c.isBan && "function" == typeof window.on_cc_live_room_ban && window.on_cc_live_room_ban(this.banReason) } else swfobject.embedSWF(this.swfUrl, this.id, "100%", "100%", "10.0.0", "/flash/expressInstall.swf", e, a), c.on_hd_live_player_type && c.on_hd_live_player_type("flash") }, getH5player: function() { return hdPcLivePlayer.player() }, getFlash: function() { if (this.isReady && swfobject && swfobject.getObjectById) return swfobject.getObjectById(this.id) }, getPlayerTime: function() { var e = parseInt("function" == typeof this.getFlash()._time ? this.getFlash()._time() : 0); return isNaN(e) || e < 0 ? 0 : e }, isH5Video: function() { return !this.getFlash() && "undefined" != typeof hdPcLivePlayer || ("undefined" == typeof hdPcLivePlayer && this.getFlash(), !1) }, start: function() { if ("isMobile" == A.isMobile()) { if (c.isBan) return $("#livePlayer").css({ "text-align": "center", color: "white", "font-size": "18px", "line-height": "232px" }), void $("#livePlayer").html("<p>鐩存挱宸插皝绂侊紝璇疯仈绯荤鐞嗗憳</p>");
  145. A.init() } else { if (this.isH5Video()) { if (c.isBan) return; return this.isPublishing = 1, void this.getH5player().startLive() } if (!this.getFlash()) return;
  146. this.isPublishing = 1, this.getFlash()._streamStart() } }, changeQuality(e, t) { this.isH5Video() && this.getH5player().changeStream(e, t) }, getQualityIndex() { if (this.isH5Video()) return this.getH5player().streamIndex }, end: function() { if ("isMobile" == A.isMobile()) A.end();
  147. else { if (this.isH5Video()) { if (c.isBan) return; return this.isPublishing = 0, void this.getH5player().endLive() } if (!this.getFlash()) return;
  148. this.isPublishing = 0, this.getFlash()._streamEnd && this.getFlash()._streamEnd() } }, barrage: function(e) { e && (this.isH5Video() ? this.getH5player().sendBarrage({ type: "text", content: e.txt, css: { font: "寰蒋闆呴粦", size: "14", color: e.color } }) : this.getFlash() && this.getFlash()._jsTOASbarrage && this.getFlash()._jsTOASbarrage(e)) }, destroy: function() { this.end(), $(this.id).remove() }, getCurrentLine: function() { if (this.isH5Video) return this.getH5player().hostIndex }, getLine: function() { if (this.isH5Video()) { for (var e = [], t = this.getH5player().lines.length, i = this.getH5player().hostIndex, n = 0; n < t; n++) { var o = { selected: i == n, name: "绾胯矾_" + (n + 1) };
  149. e.push(o) } return e } var a = this.getFlash().getLine ? this.getFlash().getLine() : 0; return a && (a = JSON.parse(a)), a }, changeLine: function(e) { if (this.isH5Video()) return this.getH5player().changeLines(e);
  150. this.getFlash().changeLine && this.getFlash().changeLine(e) }, changeVideoScale: function(e) { this.getFlash()._showScreenScale && this.getFlash()._showScreenScale(e) }, onlyAudio: function() { this.isH5Video() || this.getFlash()._onlyAudio && this.getFlash()._onlyAudio() }, setSound: function(e) { if (this.isH5Video()) return this.getH5player().setVolume(e);
  151. this.getFlash()._SetSound && this.getFlash()._SetSound(e) }, openSound: function() { this.isH5Video() ? this.getH5player().setMuted(!1) : this.getFlash() && this.getFlash && this.getFlash()._onSound() }, closeSound: function() { this.isH5Video() ? this.getH5player().setMuted(!0) : this.getFlash() && this.getFlash && this.getFlash()._unSound() }, openBarrage: function(e) { if (this.isH5Video()) return this.getH5player().openBarrage(e);
  152. this.getFlash() && this.getFlash()._barrage && this.getFlash()._barrage(e) }, showControl: function(e) { if (this.isH5Video()) return this.getH5player().showControl(e);
  153. this.getFlash() && this.getFlash()._ShowControl && this.getFlash()._ShowControl(e) }, switchFullScreen: function(e) { if (this.isH5Video()) return this.getH5player().switchFullScreen(e);
  154. this.getFlash() }, banLive: function() { c.isBan = !0, this.isH5Video() ? this.getH5player().banLive() : this.getFlash() && this.getFlash()._banLive && this.getFlash()._banLive() }, unbanLive: function() { c.isBan = !1, this.isH5Video() ? this.getH5player().unBanLive() : this.getFlash() && this.getFlash()._unbanLive && this.getFlash()._unbanLive() }, showMarquee: function(e) { if (e) return this.isH5Video() ? this.getH5player().openMarquee(JSON.parse(e)) : void(this.getFlash() && this.getFlash()._showMarqueePlugin && this.getFlash()._showMarqueePlugin(e)) }, closeMarquee: function() { if (this.isH5Video()) return this.getH5player().closeMarquee();
  155. this.getFlash() && this.getFlash()._closeMarqueePlugin && this.getFlash()._closeMarqueePlugin({ name: "PluginForMarquee" }) } };
  156. window._onStart = function() {}, window.cc_callback_onHDReceivedVideoQuality = function(e) { c.onHDReceivedVideoQuality && c.onHDReceivedVideoQuality(e) }; var p = { id: "drawPanel", isReady: !1, isProcessing: !1, getWidth: function() { return "100%" }, getHeight: function() { return "100%" }, swfUrl: "//zeus.csslcloud.net/flash/Player.swf", init: function() { A.isIPad() || A.isIPhone() || A.isAndroid() || A.isWindowsPhone() || s.fastMode || swfobject.embedSWF(this.swfUrl, this.id, this.getWidth(), this.getHeight(), "10.0.0", "/flash/expressInstall.swf", { type: "drawpanel" }, { allowFullscreen: "true", allowScriptAccess: "always", wmode: "transparent" }, {}) }, getSwf: function() { if (this.isReady) return swfobject.getObjectById(this.id) }, clear: function() { var e = this.getSwf();
  157. e && (e._streamEnd(), l.pagechangedata = [], l.drawjson = []) }, draw: function(e) { var t = this.getSwf();
  158. t && t.draw(e) }, draws: function(e) { var t, i = this.getSwf();
  159. i && (t = e, setTimeout(function() { i.drawList(t) })) }, filp: function(e) { var t = this.getSwf(); if (t) { var i = c.documentDisplayMode;
  160. this.displayMode = 1 == i ? "auto" : 2 == i ? "width" : "auto", void 0 !== _.adapt && (this.displayMode = _.adapt ? "auto" : "width"); var n = JSON.parse(e),
  161. o = n.url; "https:" === window.location.protocol && (n.url = o.replace(/http:/g, "https:")), t.filp(JSON.stringify(n), this.displayMode) } }, animationFilp: function(e) { var t = this.getSwf();
  162. t && t.animation(e) }, barrage: function(e) { e && this.getSwf() && this.getSwf()._jsTOASbarrage && this.getSwf()._jsTOASbarrage(e) }, showMarquee: function(e) { e && this.getSwf() && this.getSwf().showMarqueeLight(e) } },
  163. g = [],
  164. v = [],
  165. m = [],
  166. w = !1,
  167. y = function() { $.ajax({ url: "//view.csslcloud.net/api/view/info?userid=" + c.userid + "&roomid=" + c.roomid, type: "GET", dataType: "jsonp", success: function(e) { if (e.success && e.datas) { var t = e.datas.meta; if (t && (h.isPublishing = t.isPublishing, 1 == t.isPublishing)) { for (var i = t.answer ? t.answer : [], n = t.question ? t.question : [], o = t.broadcast ? t.broadcast : [], a = 0; a < i.length; a++)
  168. for (var r = i[a], u = 0; u < n.length; u++) {
  169. (d = n[u]).encryptId == r.encryptId && (r.questionUserId = d.questionUserId) }
  170. if (n && n.length)
  171. for (a = 0; a < n.length; a++) { var d = n[a]; "function" == typeof c.onQuestion && c.onQuestion(JSON.stringify({ action: "question", value: { id: d.encryptId, content: d.content, userId: d.questionUserId, groupId: d.groupId, userName: d.questionUserName, isPublish: d.isPublish, triggerTime: d.triggerTime, userAvatar: d.questionUserAvatar } })) }
  172. if (i && i.length)
  173. for (a = 0; a < i.length; a++) { r = i[a]; "function" == typeof c.onAnswer && c.onAnswer(JSON.stringify({ action: "answer", value: { questionId: r.encryptId, isPrivate: r.isPrivate, content: r.content, userId: r.answerUserId, groupId: r.groupId, userName: r.answerUserName, questionUserId: r.questionUserId, triggerTime: r.triggerTime, userAvatar: r.userAvatar } })) }
  174. if (o && o.length)
  175. for (a = 0; a < o.length; a++) { var l = o[a]; "function" == typeof c.onBroadcastMsg && c.onBroadcastMsg({ content: l.content, time: l.time, id: l.id }) }
  176. "isMobile" == A.isMobile() && $.DrawingBoard && $.DrawingBoard.history(t), s.history(t); var f = t.chatLog; if (f && f.length) { var p = []; for (a = 0; a < f.length; a++) { var y = f[a];
  177. p.push({ userid: y.userId, username: y.userName, userrole: y.userRole, useravatar: y.userAvatar, groupId: y.groupId, msg: y.content, time: y.time, chatId: y.chatId, status: y.status, usercustommark: y.userCustomMark }) } if ("function" == typeof c.onPublicChatMessage)
  178. for (var _ = 0; _ < p.length; _++) c.onPublicChatMessage(JSON.stringify(p[_])) } if (!s.fastMode) { var S = t.pageChange; if (S && S.length) { S.sort(function(e, t) { return parseInt(e.time) - parseInt(t.time) }); var I = S.pop();
  179. v.push(JSON.stringify({ fileName: I.docName, totalPage: I.docTotalPage, docid: I.encryptDocId, url: I.url, page: I.pageNum, time: I.time, useSDK: I.useSDK })) } var b = t.animation; if (b && b.length) { b.sort(function(e, t) { return parseInt(e.time) - parseInt(t.time) }); var T = b.pop();
  180. m.push(JSON.stringify({ fileName: T.docName, totalPage: T.docTotalPage, docid: T.encryptDocId, url: T.url, page: T.pageNum, time: T.time, step: T.step })) } var k = t.draw; if (k && k.length)
  181. for (a = 0; a < k.length; a++) g.push(k[a].data) }
  182. w = !0 } } } }) },
  183. _ = new function(e) { this.interaction = new f(e) }({ interaction: { id: "interactionPlayer", width: "100%", height: "100%" } });
  184. window.on_drampanel_ready = function() { p.isReady = !0, setTimeout(function() {! function e() { if (w) { if (!s.fastMode && (g.length && (p.draws(g), g = []), v.length)) { var t = v.pop(); if (!t) return; if (p.filp(t), m.length) { var i = m.pop(),
  185. n = F(i),
  186. o = F(t);
  187. o.docid == n.docid && o.time <= n.time && p.animationFilp(i) }
  188. v = [] } } else setTimeout(function() { e() }, 3e3) }() }, 1500) }, window.on_cc_live_dw_draw = function(e) { setTimeout(function() { s.draw(e) }, q()), setTimeout(function() { var t = F(e);
  189. p.draw(JSON.stringify(t.value.data)) }, q()), "isMobile" == A.isMobile() && setTimeout(function() { $.DrawingBoard && $.DrawingBoard.db(e) }, q()) }, window.on_cc_live_dw_page_change = function(e) { setTimeout(function() { s.pageChange(e) }, q()), setTimeout(function() { var t = F(e);
  190. p.filp(JSON.stringify(t.value)) }, q()), "isMobile" == A.isMobile() && setTimeout(function() { $.DrawingBoard && $.DrawingBoard.db(e) }, q()) }, window.on_cc_live_dw_animation_change = function(e) { setTimeout(function() { s.animationChange(e) }, q()), setTimeout(function() { var t = F(e);
  191. p.animationFilp(JSON.stringify(t.value)) }, q()), "isMobile" == A.isMobile() && setTimeout(function() { $.DrawingBoard && $.DrawingBoard.db(e) }, q()) }; var S = { init: function() { l.socket.on("chat_message", function(e) { "function" == typeof c.onPublicChatMessage && c.onPublicChatMessage(e) }), l.socket.on("chat_log_manage", function(e) { "function" == typeof c.onPublicChatLogManage && c.onPublicChatLogManage(e) }), l.socket.on("notification", function(e) { "function" == typeof c.onNotification && c.onNotification(e) }), l.socket.on("information", function(e) { "function" == typeof c.onInformation && c.onInformation(e) }), l.socket.on("private_chat_self", function(e) { "function" == typeof c.onPrivateChatMessage && c.onPrivateChatMessage(e) }), l.socket.on("private_chat", function(e) { "function" == typeof c.onPrivateAnswer && c.onPrivateAnswer(e) }), l.socket.on("room_context", function(e) {}), l.socket.on("custom_message", function(e) { "function" == typeof c.onCustomChatMessage && c.onCustomChatMessage(e) }) } },
  192. I = { init: function() { l.socket.on("question", function(e) { "function" == typeof c.onQuestion && c.onQuestion(e), "function" == typeof c.onQuestionSend && c.onQuestionSend(e) }), l.socket.on("answer", function(e) { "function" == typeof c.onAnswer && c.onAnswer(e), "function" == typeof c.onAnswerSend && c.onAnswerSend(e) }) } },
  193. b = function(e, t, i) { var n = "//view.csslcloud.net" + e;
  194. $.ajax({ url: n, url: n, type: "GET", dataType: "json", data: t, headers: { "X-HD-Token": c.sessionId }, success: function(e) { i && i(e) }, error: function(e) { console.log(e) } }) },
  195. T = function(e, t, i) { var n = "//view.csslcloud.net" + e;
  196. $.ajax({ url: n, url: n, headers: { "X-HD-Token": c.sessionId, "Content-Type": "application/json" }, data: JSON.stringify(t), type: "POST", dataType: "json", success: function(e) { i && i(e) }, error: function(e) { console.log(e) } }) },
  197. k = { code: 404, msg: "娓呮櫚搴︿笉瀛樺湪锝�" },
  198. P = { code: 404, msg: "绾胯矾涓嶅瓨鍦綖" },
  199. M = { code: 500, msg: "鍒囨崲澶辫触锛岃閲嶈瘯锝�" },
  200. L = { code: 200, msg: "鍒囨崲鎴愬姛锝�" },
  201. C = { code: 200, msg: "鍒囨崲鎴愬姛锝�" },
  202. R = "canplay",
  203. D = "waiting",
  204. A = { src: "", audio: !1, line: 0, controls: !0, baseURL: "//view.csslcloud.net", isRtsStream: !1, init: function() { var e = this; if (c.isBan) return $("#livePlayer").css({ "text-align": "center", color: "white", "font-size": "18px", "line-height": "232px" }), void $("#livePlayer").html("<p>鐩存挱宸插皝绂侊紝璇疯仈绯荤鐞嗗憳</p>");
  205. b("/api/live/record", { accountId: c.userid, roomId: c.roomid, sessionId: c.sessionId }, function(t) { var i;
  206. t.success && 1 === t.data.live.status ? (d.init(), i = e.controls ? '<video id="player_live" style="display: none" webkit-playsinline x5-video-player-type="h5-page" playsinline controls autoplay x-webkit-airplay="allow" x5-playsinline width="100%" height="100%" ></video>' : '<video id="player_live" style="display: none" webkit-playsinline x5-video-player-type="h5-page" playsinline autoplay x-webkit-airplay="allow" x5-playsinline width="100%" height="100%"></video>', $("#" + h.id).html(i), e.video = document.getElementById("player_live"), c.rtsFlag ? e.getRTSHosts() : e.getH5PlayerHosts()) : ($("#livePlayer").css({ "text-align": "center", color: "white", "font-size": "18px", "line-height": "232px" }), $("#livePlayer").html("<p>鐩存挱绛夊緟涓�</p>")) }) }, getH5PlayerHosts: function() { var e = this;
  207. b("/api/live/play", { accountId: c.userid, roomId: c.roomid, sessionId: c.sessionId, types: "hls", platform: 1, terminal: 1 }, function(t) { if (t.success && t.data.stream.length > 0) { e.videoStreams = t.data.stream[0].videos, e.audioStreams = t.data.stream[0].audios, e.currentQualityStream = e.videoStreams[0], e.currentQualityCode = e.videoStreams[0].quality, e.currentLines = e.currentQualityStream.videoStream, e.currentLineIndex = 0, e.currentLine = e.currentLines[0], e.initPlayer(); var i = JSON.parse(JSON.stringify(e.videoStreams)).map(function(e) { return delete e.videoStream, e });
  208. c.onHDReceivedVideoQuality && c.onHDReceivedVideoQuality(i) } }) }, getRTSHosts: function() { var e = this;
  209. b("/api/live/play", { accountId: c.userid, roomId: c.roomid, sessionId: c.sessionId, types: "rts", platform: 1, terminal: 1 }, function(t) { if (t.success && t.data.stream.length > 0) { e.rtsStreams = t.data.stream[0], e.rtsVideoLine = e.rtsStreams.videos[0].videoStream[0], e.currentLines = e.rtsStreams.videos[0].videoStream, e.rtsAudioLine = e.rtsStreams.audios[0], e.currentLineIndex = 0, e.currentQualityCode = e.rtsStreams.videos[0].quality, e.initRtsPlayer(); var i = JSON.parse(JSON.stringify(e.rtsStreams.videos)).map(function(e) { return delete e.videoStream, e });
  210. c.onHDReceivedVideoQuality && c.onHDReceivedVideoQuality(i) } }) }, initRtsPlayer: function() { var e = this;
  211. e.aliRts = new AliRTS, e.bindRTSEvent(), e.aliRts.isSupport({ isReceiveVideo: !0 }).then(function() { c.onLiveStarting && c.onLiveStarting(), e.isRtsStream = !0;
  212. $("#livePlayer").append('<div class="video-big-playBtn" style="display:flex; justify-content: center; align-items: center; width: 100%; height:100%;"><div id="rtsPlayBtn" style="width: 60px; height: 60px; background: url(//view.csslcloud.net/images/big-play-btn.png) no-repeat; background-size: 60px"></div></div>'), $("#rtsPlayBtn").on("click", function() { $("#rtsPlayBtn").hide(), e.play() }) }).catch(function() { e.getH5PlayerHosts() }) }, bindRTSEvent: function() { this.aliRts.on("onError", function(e) { 10201 === e.errorCode && window.rtsPlayOnError && window.rtsPlayOnError() }), this.aliRts.on("onPlayEvent", function(e) { e.event === R || e.event === D || e.event }) }, getLine: function() { return this.currentLines }, getCurrentLine: function() { return this.currentLineIndex }, initPlayer: function() { $("#player_live").show(), this.video.src = this.currentLine, a.setUrl(this.currentLine), a.bindVideoEvent(this.video), c.onLiveStarting && c.onLiveStarting(), c.on_hd_live_player_type && c.on_hd_live_player_type("h5"), c.onPlayerLoad && c.onPlayerLoad(this.video), c.onKickOutMobile = function() { $("#" + h.id).html("") }, this.report || (this.report = new ReportLog(d, 1, 11, this.video, !0)) }, showControl: function(e) { this.controls = e, this.video.controls = e }, switchFullScreen: function(e) { var t = $("#player_live")[0];
  213. e ? t.requestFullscreen ? t.requestFullscreen() : t.mozRequestFullScreen ? t.mozRequestFullScreen() : t.msRequestFullscreen ? t.msRequestFullscreen() : t.webkitSupportsFullscreen && t.webkitEnterFullscreen() : t.exitFullscreen ? t.exitFullscreen() : t.msExitFullscreen ? t.msExitFullscreen() : t.mozExitFullScreen ? t.mozExitFullScreen() : t.webkitExitFullscreen ? t.webkitExitFullscreen() : document.mozCancelFullScreen && document.mozCancelFullScreen() }, ban: function() { $("#livePlayer").css({ "text-align": "center", color: "white", "font-size": "18px", "line-height": "232px" }), a.endLive(), $("#livePlayer").html("<p>鐩存挱宸插皝绂侊紝璇疯仈绯荤鐞嗗憳</p>") }, unban: function() { $("#livePlayer").css({ "text-align": "", color: "", "font-size": "", "line-height": "" }), this.init() }, end: function() { this.isRtsStream && this.aliRts.stopLiveStream(), $("#livePlayer").css({ "text-align": "center", color: "white", "font-size": "18px", "line-height": "232px" }), a.endLive(), $("#livePlayer").html("鐩存挱宸茬粨鏉�") }, appendDoc: function(e) { "https:" === window.location.protocol && (e = e.replace(/http:/g, "https:")); var t = '<img src="' + e + '" />';
  214. $("#" + p.id).html(t) }, changeQuality: function(e, t) { if (!this.isRtsStream && !A.audio)
  215. if (this.videoStreams.find(function(t) { return t.quality === e })) { this.currentQualityCode = e, this.currentQualityStream = this.videoStreams.find(function(e) { return e.quality === this.currentQualityCode }), this.currentLines = this.currentQualityStream.videoStream, this.currentLines[this.currentLineIndex] || (this.currentLineIndex = 0); try { this.currentLine = this.currentLines[this.currentLineIndex], a.setUrl(this.currentLine), $("#" + h.id).find("video").attr("src", this.currentLine), t && t(L) } catch (e) { t && t(M) } } else t && t(k) }, getQualityIndex() { if (!this.isRtsStream) return this.currentQualityCode }, changeLine: function(e, t) { if (!this.isRtsStream) { if (A.audio) { if (!this.audioStreams[e]) return t && t(P);
  216. audio.src = "", audio.src = this.audioStreams[e], audio.play() } else { if (!this.currentLines[e]) return t && t(P);
  217. this.currentLine = this.currentLines[e], a.setUrl(this.currentLine), $("#" + h.id).find("video").attr("src", this.currentLine) }
  218. t && t(C), this.currentLineIndex = e } }, play: function() { var e = this;
  219. c.rtsFlag && this.isRtsStream ? ($("#player_live").show(), e.aliRts.muteLiveStream(!1), e.aliRts.isSupport({ isReceiveVideo: !0 }).then(function() { e.aliRts.startLiveStream(e.rtsVideoLine, e.video).then(function() {}).catch(function() { alert("鎾斁澶辫触锛岃鍒锋柊椤甸潰閲嶈瘯") }) }).catch(function() { this.isRtsStream = !1, e.getH5PlayerHosts() })) : this.video.play() }, onlyAudio: function() { var e = this,
  220. t = $("#" + h.id).find("video");
  221. e.video = document.getElementById("player_live"), t.show(), A.audio = !A.audio, this.isRtsStream ? A.audio ? (e.aliRts.stopLiveStream(), e.aliRts.isSupport({ isReceiveVideo: !1 }).then(function() { e.aliRts.startLiveStream(e.rtsAudioLine, null).then().catch(function() { alert("鎾斁澶辫触锛岃鍒锋柊椤甸潰閲嶈瘯") }) }).catch(function() { e.aliRts.stopLiveStream(), alert("娴忚鍣ㄤ笉鏀寔RTS闊抽鎾斁") })) : (e.aliRts.stopLiveStream(), e.aliRts.isSupport({ isReceiveVideo: !0 }).then(function() { e.aliRts.startLiveStream(e.rtsVideoLine, e.video).then().catch(function() { alert("鎾斁澶辫触锛岃鍒锋柊椤甸潰閲嶈瘯") }) }).catch(function() { alert("111"), alert("鎾斁澶辫触锛岃鍒锋柊椤甸潰閲嶈瘯") })) : A.audio ? (audio = new Audio, audio.src = this.audioStreams[this.currentLineIndex], audio.play()) : (audio.src = "", t.attr("src", this.currentLines[this.currentLineIndex]), t.play()) }, setMuted: function(e) { this.isRtsStream ? this.aliRts.muteLiveStream(e) : this.video.muted = e }, isMobile: function() { if (this.isIPad() || this.isIPhone() || this.isAndroid() || this.isWindowsPhone()) return "isMobile" }, isIPad: function() { return null != navigator.userAgent.match(/iPad/i) }, isIPhone: function() { return null != navigator.userAgent.match(/iPhone/i) }, isAndroid: function() { return null != navigator.userAgent.match(/Android/i) }, isWindowsPhone: function() { return null != navigator.userAgent.match(/Windows Phone/i) } };
  222. window.on_cc_live_accept_interaction = function(e) {!window.isSpeakThirdParty && _ && _.livePlayer && h.closeSound(), _.interaction.clearRequestTimeoutTimer(), window.isSpeakThirdParty && _.interaction.initAgoraRTC(e), c.enterInteractionRoom(), _.interaction.isInteractioning = !0, _.interaction.setCallingTimer(), "function" == typeof window.on_cc_live_interaction_accept && window.on_cc_live_interaction_accept(_.interaction.local.type, F(e)) }, window.on_cc_live_interaction_disconnect_self = function(e) { if (window.isSpeakThirdParty) { _.interaction.leaveAgoraRTC(); var t = _.interaction.local.type; "function" == typeof window.on_cc_live_interaction_disconnect && window.on_cc_live_interaction_disconnect(e, t) } var i = e.disconnectid,
  223. n = !!_.interaction.usersPcs[i]; if (i == c.viewerid || n) { if (i != c.viewerid && n && c.hangupInteraction(), _.interaction.clearCallingTimer(), _.interaction.disconnectInteraction(i), i == c.viewerid || 0 == _.interaction.usersPcs.length) { _.interaction.stopLocalStream();
  224. t = _.interaction.local.type;
  225. $("#videoInteractions").empty(), $("#audioInteractions").empty(), $("#interactionLocalVideo")[0] && ($("#interactionLocalVideo")[0].src = ""), t.video && ($("#livePlayer").show(), h.openSound()), window.isSpeakThirdParty || "function" != typeof window.on_cc_live_interaction_disconnect || window.on_cc_live_interaction_disconnect(e, t) }
  226. window.isRequesting = !1 } }, window.on_cc_live_interaction_remote_media_self = function(e, t, i) { if ("function" == typeof window.on_cc_live_interaction_remote_media && window.on_cc_live_interaction_remote_media(e, t, i), window.isRequesting = !1, e.video) { $("#livePlayer").hide(); var n = "interactionRemoteVideo" + t.id;
  227. $("#" + n).length < 1 && ($("#videoInteractions").append('<video cc-data="0" id="' + n + '" style="height: 100%; width: 100%;" autoplay></video>'), $("#" + n)[0].srcObject = i) } else { n = "interactionRemoteAudio" + t.id;
  228. $("#" + n).length < 1 && ($("#audioInteractions").append('<audio cc-data="2" id="' + n + '" autoplay controls></audio>'), $("#" + n)[0].srcObject = i) } }, window.on_cc_live_interaction_chatusers = function(e) { e = F(e), $.each(e, function(e, t) { return t.id == c.viewerid || ("publisher" == t.role && !t.isMainSpeaker || void _.interaction.createOfferPeerConnection(t)) }) }, window.on_cc_live_interaction_message = function(e) { e = F(e);
  229. x("Interaction", "rtc浜掑姩淇℃伅:" + JSON.stringify(e)); var t = e.toid,
  230. i = e.fromid,
  231. n = e.fromname,
  232. o = e.type,
  233. a = e.data; "string" == typeof a && (a = JSON.parse(a)); var r = e.event; if ("offer" === r) { if (a.type = r, _.interaction.createAnswerPeerConnection({ id: i, name: n, type: o }), !(s = _.interaction.usersPcs[i].pc)) return;
  234. s.setRemoteDescription(new nativeRTCSessionDescription(a)), s.createAnswer(function() {}, function(e) { x("Interaction", "Failure callback: " + e) }) } else if ("answer" === r) { if (!(s = _.interaction.usersPcs[i].pc)) return;
  235. a.type = r, x("Interaction", "answer spark_message淇℃伅:" + a), s.setRemoteDescription(new nativeRTCSessionDescription(a)), s.receivedAnswer = !0, !s.hasAddIce && s.RTCICE && s.addIceCandidate(s.RTCICE) } else { var s, c = _.interaction.usersPcs[i]; if (c || (c = _.interaction.usersPcs[t]), !(s = c ? c.pc : null)) return; var u = new RTCIceCandidate(a);
  236. s.receivedAnswer ? (s.hasAddIce = !0, s.addIceCandidate(u)) : (s.hasAddIce = !1, s.RTCICE = u) } }, window.isDebug = !1; var x = function(e, t) { window.isDebug && console && "function" == typeof console.log && console.log(e, t) };
  237. function F(e) { if ("string" == typeof e) try { return JSON.parse(e) } catch (e) { return {} }
  238. return e }
  239. function q() { var e = h.delay; return (isNaN(e) || e < 0) && (e = 0), e *= 1e3, "isMobile" == A.isMobile() ? 0 === e ? 5e3 : 1e4 : 0 === e ? 1300 : 3e3 }
  240. function N() { var e = h.delay; return (isNaN(e) || e < 0) && (e = 0), "isMobile" == A.isMobile() ? 0 === e ? 5e3 : 1e4 : 0 === e ? 1300 : 3e3 }
  241. window.DWLive = c, window.live = _, c.isSupportInteraction = window.live.interaction.isSupportInteraction, window.onunload = function() { window.live.interaction.hangupInteraction() }, window.onbeforeunload = function() { window.live.interaction.hangupInteraction() }, window._swfInit = function() { "function" == typeof window.on_cc_live_player_ready && window.on_cc_live_player_ready() }, window._swfOk = function(e) { "function" == typeof window.on_cc_swf_loading_completed && window.on_cc_swf_loading_completed(e), h.isReady = !0 } }(window) }]);