vodh5player.min.js 92 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795
  1. /*! h5vod wrapper 2022-07-26-2:29 */
  2. !function (e, a) {
  3. "object" == typeof exports && "undefined" != typeof module ? module.exports = a(require("global/window"), require("global/document")) : "function" == typeof define && define.amd ? define(["global/window", "global/document"], a) : (e = e || self).vodh5player = a(e.window, e.document)
  4. }(this, function (window$1, document) {
  5. "use strict";
  6. window$1 = window$1 && Object.prototype.hasOwnProperty.call(window$1, "default") ? window$1.default : window$1,
  7. document = document && Object.prototype.hasOwnProperty.call(document, "default") ? document.default : document;
  8. var wrapperversion = "2.7.8"
  9. , wrapperupdate = "22-7-20"
  10. , vodh5player = {}
  11. , P2P_FC = ["电视剧"]
  12. , NOTP2P_FC = [];
  13. function getvodplayerNS() {
  14. return void 0 === vodh5player._namespace && (vodh5player._namespace = {}),
  15. vodh5player._namespace
  16. }
  17. function VodConstructer(id) {
  18. var this_ = this;
  19. this.id = "VC_" + id,
  20. this_.isSafariPreAdHasShowed_ = !1,
  21. this_.isStartTimeHasSet_ = !1,
  22. this_.delayStartTime_ = 0,
  23. this.debug = vodh5player.DEBUG,
  24. this.PRE_AD_URL,
  25. this.POST_AD_URL,
  26. this.BANNER_AD_URL,
  27. this.PAUSE_AD_URL,
  28. this.VIDEO_CORE_NAME = "vodh5core",
  29. this.VIDEO_CORE_URL = "video_novhs.min.js",
  30. this.VIDEO_LANG_URL = "zh-CN.js",
  31. this.VIDEO_LANG_NAME = "vodh5Lang_" + this.VIDEO_LANG_URL,
  32. vodh5player.RELEASE ? this.VHS_URL = "vhs_drm.min.js" : this.VHS_URL = vodh5player.DRM ? "vhs_drm.min.js" : "vhs.min.js",
  33. this.VHS_NAME = "vodh5_" + this.VHS_URL,
  34. this.VIDEO_CSS_URL = "",
  35. this.VIDEO_CSS2_URL = "",
  36. this.config,
  37. this.allCoreLoaded = !1,
  38. this.vjsplayer,
  39. this.vodParas,
  40. this.group,
  41. this.HTTP_PRE = "https://",
  42. this.container_,
  43. this.PLAYER_TYPE_INDEX,
  44. this.analyticObj = {},
  45. this.analyticObj.playScene = vodh5player.PLAY_SCENE,
  46. this.analyticObj.playerversion = vodh5player.VERSION + "-" + wrapperversion,
  47. this.analyticObj.playerAppname = vodh5player.APP_NAME,
  48. this.analyticObj.streamType = "vod",
  49. this.analyticObj.streamProtocol = "HLS",
  50. this.analyticObj.playAMR = "F",
  51. this.analyticObj.P2PStyle = "F",
  52. this.analyticObj.ready4play1_1 = !1,
  53. this.analyticObj.firstplay = !1,
  54. this.analyticObj.cumulativeTime = 0,
  55. this.analyticObj.cumulativeTimeTimer,
  56. this.analyticObj.heartbeat,
  57. this.analyticObj.freezed = !1,
  58. this.analyticObj.loadtime = 0,
  59. this.analyticObj.loadtimeTimer,
  60. this.analyticObj.errorSent = !1,
  61. this.analyticObj.cdnsip = "none",
  62. this.analyticObj.cdncip = "none",
  63. this.setStartTime_ = !1,
  64. this.preAdVdnTimeOut_,
  65. this.preAdVdnTimeOutState_ = !1,
  66. this.postAdVdnTimeOut_,
  67. this.postAdVdnTimeOutState_ = !1,
  68. this.firstEnded_,
  69. this.firstFramePlayed_ = !1,
  70. this.paramTranslation = function (e) {
  71. switch ("" !== (this.vodParas = e).language && "en" !== e.language && (this.VIDEO_LANG_URL = e.language + ".js",
  72. this.VIDEO_LANG_NAME = "vodh5Lang_" + this.VIDEO_LANG_URL),
  73. e.configType && (vodh5player.CONFIG_URL = "config/" + e.configType + ".json"),
  74. vodh5player.HLSP2P_HAS_INSTANCE_RUNNING ? (this.vodParas.HLSP2P = !0,
  75. vodh5player.HLSP2P_HAS_INSTANCE_RUNNING = !0) : this.vodParas.HLSP2P = !1,
  76. void 0 !== this.vodParas.cms && void 0 !== this.vodParas.cms.fc && -1 < P2P_FC.indexOf(this.vodParas.cms.fc) ? vodh5player.P2P = !0 : vodh5player.P2P = !1,
  77. vodh5player.P2P ? this.analyticObj.P2PStyle = "T" : this.analyticObj.P2PStyle = "F",
  78. this.vodParas.dpr = window.devicePixelRatio,
  79. void 0 !== this.vodParas.enableVip && !0 === this.vodParas.enableVip && (vodh5player.enableVip = !0,
  80. vodh5player.userLevel = this.vodParas.userLevel || 0,
  81. void 0 !== this.vodParas.skipAdTip && !0 === this.vodParas.skipAdTip && (vodh5player.skipAdTip = !0)),
  82. vodh5player.trace("enableVip:" + vodh5player.enableVip),
  83. vodh5player.trace("userLevel:" + vodh5player.userLevel),
  84. vodh5player.trace("skipAdTip:" + vodh5player.skipAdTip),
  85. vodh5player.trace("p2p:" + (vodh5player.P2P ? "on" : "off")),
  86. void 0 === this.vodParas.PLAYER_TYPE_INDEX ? this.PLAYER_TYPE_INDEX = 0 : this.PLAYER_TYPE_INDEX = this.vodParas.PLAYER_TYPE_INDEX,
  87. !0 === this.vodParas.isVod4k && (this.PLAYER_TYPE_INDEX = this.vodParas.PLAYER_TYPE_INDEX = 1),
  88. this.vodParas,
  89. vodh5player.enableVip ? vodh5player.trace("player type no longer valid when costom config is on!") : vodh5player.trace("player type index:" + this.PLAYER_TYPE_INDEX + " in " + vodh5player.PLAYER_TYPES),
  90. 1 === this.PLAYER_TYPE_INDEX && (vodh5player.PLAY_SCENE = "HTML5.PC.4K",
  91. this.analyticObj.playScene = vodh5player.PLAY_SCENE),
  92. vodh5player.PLAYER_NAME = vodh5player.DRM ? "HTML5_VOD_DRM_PLAYER" : "HTML5_VOD_PLAYER",
  93. this.group = e.group,
  94. e.style) {
  95. case void 0:
  96. case "":
  97. this.VIDEO_CSS_URL = "./css/vodh5player-v2.min.css";
  98. break;
  99. case "ipanda":
  100. this.VIDEO_CSS_URL = "./css/vodh5player-ipanda.min.css";
  101. break;
  102. default:
  103. this.VIDEO_CSS_URL = "./css/vodh5player-v2.min.css"
  104. }
  105. void 0 !== this.vodParas && !1 !== this.vodParas.enableQualityLock ? vodh5player.enableQualityLock = !0 : 0 == this.vodParas.enableQualityLock && (vodh5player.enableQualityLock = !1),
  106. !1 !== this.vodParas.hasPreAD && (this.vodParas.hasPreAD = !0),
  107. !1 !== this.vodParas.hasPauseAD && (this.vodParas.hasPauseAD = !0),
  108. !1 !== this.vodParas.hasBannerAD && (this.vodParas.hasBannerAD = !0),
  109. !1 !== this.vodParas.hasPostAD && (this.vodParas.hasPostAD = !0),
  110. void 0 === this.vodParas.isHttps ? (-1 !== location.href.indexOf("https://") ? (this.HTTP_PRE = "https://",
  111. this.vodParas.isHttps = !0,
  112. vodh5player.HTTP_PRE = "https://") : (this.HTTP_PRE = "http://",
  113. this.vodParas.isHttps = !1,
  114. vodh5player.HTTP_PRE = "http://"),
  115. vodh5player.trace("para <https> is undefined use pageurl prefix which is " + this.vodParas.isHttps)) : !0 === this.vodParas.isHttps ? (this.HTTP_PRE = "https://",
  116. this.vodParas.isHttps = !0,
  117. vodh5player.HTTP_PRE = "https://") : (this.HTTP_PRE = "http://",
  118. this.vodParas.isHttps = !1,
  119. vodh5player.HTTP_PRE = "http://"),
  120. void 0 !== this.vodParas.preAdUrl && (this.PRE_AD_URL = this.vodParas.preAdUrl),
  121. void 0 !== this.vodParas.postAdUrl && (this.POST_AD_URL = this.vodParas.postAdUrl),
  122. void 0 !== this.vodParas.pauseAdUrl && (this.PAUSE_AD_URL = this.vodParas.pauseAdUrl),
  123. void 0 !== this.vodParas.bannerAdUrl && (this.BANNER_AD_URL = this.vodParas.bannerAdUrl),
  124. void 0 === this.vodParas.listMode && (this.vodParas.listMode = !1),
  125. !0 === this.vodParas.hasBarrage && void 0 !== this.vodParas.barrageApp && void 0 !== this.vodParas.barrageItemId && void 0 !== this.vodParas.barrageType ? this.vodParas._hasBarrage = !0 : this.vodParas._hasBarrage = !1,
  126. vodh5player.trace("barrage:" + (this.vodParas._hasBarrage ? "on" : "off")),
  127. void 0 === this.vodParas.setup_autoNext && (this.vodParas.setup_autoNext = !0),
  128. void 0 === this.vodParas.setup_loop && (this.vodParas.setup_loop = !1),
  129. !1 !== this.vodParas.ui_cuePoint && (this.vodParas.ui_cuePoint = !0),
  130. void 0 === this.vodParas.autoplay || "true" === this.vodParas.autoplay || !0 === this.vodParas.autoplay ? this.vodParas.autoplay = !0 : "false" === this.vodParas.autoplay || !1 === this.vodParas.autoplay ? this.vodParas.autoplay = !1 : "muted" === this.vodParas.autoplay ? this.vodParas.autoplay = "muted" : "any" === this.vodParas.autoplay ? this.vodParas.autoplay = "any" : this.vodParas.autoplay = !0,
  131. vodh5player.trace("autoplay:" + this.vodParas.autoplay),
  132. void 0 === this.vodParas.ui_pictureInPicture && (this.vodParas.ui_pictureInPicture = !0),
  133. !0 === this.vodParas.chooseVideo && (vodh5player.trace("开启选集功能,videoAlbum:" + this.vodParas.videoAlbum),
  134. void 0 !== this.vodParas.column_id_pk ? vodh5player.CHOOSE_VIDEO_URL += "&id=" + this.vodParas.column_id_pk : vodh5player.CHOOSE_VIDEO_URL += "&id=PAGE1431952477871318")
  135. }
  136. ,
  137. this.loadCore = function () {
  138. var e, a = this;
  139. null !== document.getElementById("vodh5core") ? (vodh5player.trace("vodh5core already exist"),
  140. vodh5player.VERSION = videojs.PLAYER_VERSION,
  141. a.loadVHS()) : (vodh5player.trace("vodh5core loading..."),
  142. (e = vodh5player.createElementByType("script", "", "absolute", "0px", "0px", "0px", "0px")).src =
  143. this.HTTP_PRE + window.location.host + '/static/js/lib/video_novhs.min.js',
  144. // this.HTTP_PRE + vodh5player.DOMAIN + this.VIDEO_CORE_URL,
  145. document.getElementsByTagName("head")[0].appendChild(e),
  146. e.onload = function () {
  147. e.id = a.VIDEO_CORE_NAME,
  148. vodh5player.VERSION = videojs.PLAYER_VERSION,
  149. a.loadVHS()
  150. }
  151. )
  152. }
  153. ,
  154. this.loadVHS = function () {
  155. var e, a = this;
  156. null !== document.getElementById(this.VHS_NAME) ? this.loadPlugins() : ((e = vodh5player.createElementByType("script", "", "absolute", "0px", "0px", "0px", "0px")).src = this.HTTP_PRE + vodh5player.DOMAIN + this.VHS_URL,
  157. document.getElementsByTagName("head")[0].appendChild(e),
  158. e.onload = function () {
  159. e.id = a.VHS_NAME,
  160. a.loadPlugins()
  161. }
  162. )
  163. }
  164. ,
  165. this.loadSingletonWorker = function () {
  166. var r, t = this;
  167. !1 === vodh5player.wasmSupported_ ? vodh5player.convivaOn ? t.loadConvivaJs1() : t.loadStyle() : (vodh5player.workerModuleInitialized ? vodh5player.trace("worker already onRuntimeInitialized , skip...") : vodh5player.workerLoaded ? (vodh5player.trace("worker already loaded"),
  168. vodh5player.workerWatcherVCList.push(t),
  169. console.log(vodh5player.workerWatcherVCList.length)) : vodh5player.workIsLoading ? (vodh5player.trace("worker is loading... by over player"),
  170. (r = document.getElementById(vodh5player.H5_WORKER_NAME)).addEventListener("load", function () {
  171. vodh5player.trace("worker has loaded by over players"),
  172. vodh5player.workerWatcherVCList.push(t)
  173. })) : ((r = vodh5player.createElementByType("script", "", "absolute", "0px", "0px", "0px", "0px")).src = this.HTTP_PRE + vodh5player.DOMAIN + vodh5player.H5_WORKER,
  174. document.getElementsByTagName("head")[0].appendChild(r),
  175. vodh5player.workIsLoading = !0,
  176. r.id = vodh5player.H5_WORKER_NAME,
  177. r.onload = function () {
  178. vodh5player.trace(">>" + r.src + " loaded"),
  179. vodh5player.workerLoaded = !0;
  180. var e, a = null;
  181. window.CNTVH5PlayerModule ? a = window.CNTVH5PlayerModule : window.CNTVH5PlayerModule = a,
  182. "function" == typeof CNTVModule && (a = CNTVModule(),
  183. window.CNTVH5PlayerModule = a,
  184. e = setTimeout(function () {
  185. vodh5player.trace("worker timeout!", !0),
  186. vodh5player.workerStatus.workertimeout = !0,
  187. t.workerTimeroutError()
  188. }, vodh5player.WORKER_TIMEOUT)),
  189. a.onRuntimeInitialized = function () {
  190. vodh5player.trace("worker onRuntimeInitialized"),
  191. vodh5player.workerModuleInitialized = !0,
  192. vodh5player.workerStatus.initialized = !0,
  193. window.moduleRoot = window,
  194. clearTimeout(e),
  195. t.loadChecker()
  196. }
  197. }
  198. ),
  199. t.loadHLSP2P())
  200. }
  201. ,
  202. this.loadPlugins = function () {
  203. var e, a = this;
  204. null !== document.getElementById(this.VIDEO_LANG_NAME) ? a.loadSingletonWorker() : ((e = vodh5player.createElementByType("script", "", "absolute", "0px", "0px", "0px", "0px")).src = this.HTTP_PRE + vodh5player.DOMAIN + this.VIDEO_LANG_URL,
  205. document.getElementsByTagName("head")[0].appendChild(e),
  206. e.onload = function () {
  207. e.id = a.VIDEO_LANG_NAME,
  208. a.loadSingletonWorker()
  209. }
  210. )
  211. }
  212. ,
  213. this.loadHLSP2P = function () {
  214. var e, a = this;
  215. !vodh5player.P2P || null !== document.getElementById(vodh5player.HLSP2P_NAME) ? this.loadChooseVideo() : ((e = vodh5player.createElementByType("script", "", "absolute", "0px", "0px", "0px", "0px")).src = this.HTTP_PRE + vodh5player.DOMAIN + vodh5player.HLSP2P,
  216. e.setAttribute("crossorigin", "anonymous"),
  217. document.getElementsByTagName("head")[0].appendChild(e),
  218. e.onload = function () {
  219. vodh5player.hlsp2pLoaded || (e.id = vodh5player.HLSP2P_NAME,
  220. vodh5player.hlsp2pLoaded = !0),
  221. a.loadChooseVideo()
  222. }
  223. )
  224. }
  225. ,
  226. this.loadHLSP2P_2 = function () {
  227. var e, a = this;
  228. null !== document.getElementById(vodh5player.HLSP2P_2_NAME) ? this.loadHLSP2P() : ((e = vodh5player.createElementByType("script", "", "absolute", "0px", "0px", "0px", "0px")).src = this.HTTP_PRE + vodh5player.DOMAIN + vodh5player.HLSP2P_2,
  229. e.setAttribute("crossorigin", "anonymous"),
  230. document.getElementsByTagName("head")[0].appendChild(e),
  231. e.onload = function () {
  232. e.id = vodh5player.HLSP2P_2_NAME,
  233. vodh5player.hlsp2pLoaded = !0,
  234. a.loadChooseVideo()
  235. }
  236. )
  237. }
  238. ,
  239. this.loadChooseVideo = function () {
  240. var e, a = this;
  241. !0 !== a.vodParas.chooseVideo ? a.loadConfig() : null !== document.getElementById(vodh5player.CHOOSE_VIDEO_NAME) ? this.loadConfig() : ((e = vodh5player.createElementByType("script", "", "absolute", "0px", "0px", "0px", "0px")).src = this.HTTP_PRE + vodh5player.CHOOSE_VIDEO_URL + "&callback=chooseVideoJsonpHandler",
  242. window.chooseVideoJsonpHandler = a.chooseVideoJsonpHandler,
  243. document.getElementsByTagName("head")[0].appendChild(e),
  244. e.onload = function () {
  245. e.id = vodh5player.CHOOSE_VIDEO_NAME,
  246. a.loadConfig()
  247. }
  248. )
  249. }
  250. ,
  251. this.chooseVideoJsonpHandler = function (e) {
  252. vodh5player.chooseVideoData = e,
  253. delete window.chooseVideoJsonpHandler
  254. }
  255. ,
  256. this.loadConfig = function () {
  257. var a = this;
  258. vodh5player.xhrRequest({
  259. url: vodh5player.HTTP_PRE + vodh5player.DOMAIN + vodh5player.CONFIG_URL,
  260. timeout: 1e4,
  261. data: {},
  262. success: function (e) {
  263. a.config = e,
  264. vodh5player.enableVip && a.processConfig(e),
  265. vodh5player.convivaOn ? a.loadConvivaJs1() : a.loadStyle()
  266. },
  267. error: function (e) {
  268. vodh5player.trace("config load error" + e),
  269. vodh5player.convivaOn ? a.loadConvivaJs1() : a.loadStyle()
  270. }
  271. })
  272. }
  273. ,
  274. this.loadConvivaJs1 = function () {
  275. var e, a = this;
  276. null !== document.getElementById(vodh5player.CONVIVA_URL_NAME_1) ? a.loadConvivaJs2() : ((e = vodh5player.createElementByType("script", "", "absolute", "0px", "0px", "0px", "0px")).src = vodh5player.HTTP_PRE + vodh5player.DOMAIN + vodh5player.CONVIVA_URL_1,
  277. document.getElementsByTagName("head")[0].appendChild(e),
  278. e.onload = function () {
  279. e.id = vodh5player.CONVIVA_URL_NAME_1,
  280. a.loadConvivaJs2()
  281. }
  282. )
  283. }
  284. ,
  285. this.loadConvivaJs2 = function () {
  286. var e, a = this;
  287. null !== document.getElementById(vodh5player.CONVIVA_URL_NAME_2) ? a.loadConvivaJs3() : ((e = vodh5player.createElementByType("script", "", "absolute", "0px", "0px", "0px", "0px")).src = vodh5player.HTTP_PRE + vodh5player.DOMAIN + vodh5player.CONVIVA_URL_2,
  288. document.getElementsByTagName("head")[0].appendChild(e),
  289. e.onload = function () {
  290. e.id = vodh5player.CONVIVA_URL_NAME_2,
  291. a.loadConvivaJs3()
  292. }
  293. )
  294. }
  295. ,
  296. this.loadConvivaJs3 = function () {
  297. var e, a = this;
  298. null !== document.getElementById(vodh5player.CONVIVA_URL_NAME_3) ? a.loadStyle() : ((e = vodh5player.createElementByType("script", "", "absolute", "0px", "0px", "0px", "0px")).src = vodh5player.HTTP_PRE + vodh5player.DOMAIN + vodh5player.CONVIVA_URL_3,
  299. document.getElementsByTagName("head")[0].appendChild(e),
  300. e.onload = function () {
  301. e.id = vodh5player.CONVIVA_URL_NAME_3,
  302. a.loadStyle()
  303. }
  304. )
  305. }
  306. ,
  307. this.loadStyle = function () {
  308. var e, a, r;
  309. null !== document.getElementById("vodh5css") ? this.loadStyle2() : ((e = document.createElement("link")).type = "text/css",
  310. e.rel = "stylesheet",
  311. e.href = this.HTTP_PRE + vodh5player.DOMAIN + this.VIDEO_CSS_URL,
  312. a = document.getElementsByTagName("head")[0],
  313. r = this,
  314. a.appendChild(e),
  315. e.onload = function () {
  316. e.id = "vodh5css",
  317. r.loadStyle2()
  318. }
  319. )
  320. }
  321. ,
  322. this.loadStyle2 = function () {
  323. var e, a;
  324. vodh5player.trace(">>loadStyle2"),
  325. this.VIDEO_CSS2_URL ? null !== document.getElementById("vodh5css2") ? (vodh5player.trace(">>vodh5css2 already exist"),
  326. vodh5player.styleLoaded = !0,
  327. this.loadChecker()) : ((e = document.createElement("link")).type = "text/css",
  328. e.rel = "stylesheet",
  329. e.href = this.HTTP_PRE + vodh5player.DOMAIN + this.VIDEO_CSS2_URL,
  330. document.getElementsByTagName("head")[0].appendChild(e),
  331. a = this,
  332. e.onload = function () {
  333. vodh5player.trace(">>" + e.href + " has loaded"),
  334. e.id = "vodh5css2",
  335. vodh5player.styleLoaded = !0,
  336. a.loadChecker()
  337. }
  338. ) : (vodh5player.styleLoaded = !0,
  339. vodh5player.trace(">>no css2"),
  340. this.loadChecker())
  341. }
  342. ,
  343. this.processConfig = function (e) {
  344. vodh5player.uniquelabel = e.quality.uniquelabel,
  345. vodh5player.DEFAULT_QUALITY_LABELS = e.quality.labels,
  346. vodh5player.DEFAULT_QUALITIES_DIVIDE = e.quality.divide,
  347. vodh5player.qualitiesEnabled = e.quality.enabled,
  348. vodh5player.permissionLevel = e.quality.permissionLevel,
  349. vodh5player.qualitiesNeedPermission = e.quality.needPermission;
  350. for (var a = vodh5player.DEFAULT_QUALITY_LABELS.length - 1; vodh5player.qualitiesEnabled.length < a;)
  351. vodh5player.qualitiesEnabled.push(!0);
  352. for (; vodh5player.qualitiesNeedPermission.length < a;)
  353. vodh5player.qualitiesNeedPermission.push(vodh5player.qualitiesNeedPermission[vodh5player.qualitiesNeedPermission.length - 1]);
  354. console.log("custom config: -----------------------------"),
  355. console.log(vodh5player.uniquelabel),
  356. console.log(vodh5player.DEFAULT_QUALITY_LABELS),
  357. console.log(vodh5player.DEFAULT_QUALITIES_DIVIDE),
  358. console.log(vodh5player.qualitiesEnabled),
  359. console.log(vodh5player.permissionLevel),
  360. console.log(vodh5player.qualitiesNeedPermission),
  361. console.log("--------------------------------------------")
  362. }
  363. ,
  364. this.loadChecker = function () {
  365. vodh5player.trace("allCoreLoaded:" + this.allCoreLoaded + " workerModuleInitialized:" + vodh5player.workerModuleInitialized + " styleLoaded:" + vodh5player.styleLoaded + " workertimeout:" + vodh5player.workerStatus.workertimeout);
  366. var e, r = this;
  367. !this.allCoreLoaded && vodh5player.styleLoaded && !vodh5player.workerStatus.workertimeout && vodh5player.workerModuleInitialized && (vodh5player.trace(">> -- all core complete --"),
  368. this.allCoreLoaded = !0,
  369. vodh5player.trace("start checking preAd... hasPreAD:" + this.vodParas.hasPreAD + " PRE_AD_URL:" + this.PRE_AD_URL),
  370. this.vodParas.hasPreAD && this.PRE_AD_URL ? (e = this.PRE_AD_URL,
  371. this.vodParas.preAdsParas && (this.vodParas.preAdsParas.length = 0,
  372. delete this.vodParas.preAdsParas),
  373. vodh5player.xhrRequest({
  374. url: e,
  375. timeout: vodh5player.VJS_ADS_TIMEOUT,
  376. data: {},
  377. customPara: e,
  378. success: function (e, a) {
  379. vodh5player.trace("preAdData loaded."),
  380. r.parsePreAdsData(e, a)
  381. },
  382. ontimeout: function (e) {
  383. vodh5player.trace("preAdData load timeout."),
  384. r.sendAliAnalytic("/play.1.24", "code=" + vodh5player.ALI_ANALYTICS_ERROR_CODE_1_24_TIMEOUT + "&msg=error1&url=" + e.url + "&bfirstframeplayed=" + (r.firstFramePlayed_ ? "1" : "0"))
  385. },
  386. error: function (e) {
  387. vodh5player.trace("preAdData load error:" + e),
  388. r.parsePreAdsDataError()
  389. }
  390. })) : (vodh5player.trace("no preAD"),
  391. this.vodParas.hasPreAD = !1,
  392. this.requestContentVDN(this.vodParas)))
  393. }
  394. ,
  395. this.parsePreAdsData = function (e, a) {
  396. vodh5player.trace("preAdData parsing...");
  397. var r = this
  398. , t = this.vodParas;
  399. if (e && void 0 === t.preAdsParas) {
  400. try {
  401. var o = 0;
  402. Array.isArray(e) && (o = e.length),
  403. vodh5player.trace("preAd number:" + o),
  404. t.preAdsParas = [];
  405. for (var d = t.preAdsIndex = 0; d < o; d++) {
  406. if (void 0 === e[d].guid) {
  407. console.warn("广告数据解析错误!"),
  408. r.sendAliAnalytic("/play.1.24", "code=" + vodh5player.ALI_ANALYTICS_ERROR_CODE_1_24_JSON_PARSE + "&msg=error2&url=" + a + "&bfirstframeplayed=" + (r.firstFramePlayed_ ? "1" : "0")),
  409. t.preAdsParas.length = 0;
  410. break
  411. }
  412. e[d].guid && e[d].clickUrl && (t.preAdsParas[d] = {},
  413. t.preAdsParas[d].guid = e[d].guid,
  414. t.preAdsParas[d].clickUrl = e[d].clickUrl,
  415. t.preAdsParas[d].adStartMonitor = e[d].startcount,
  416. t.preAdsParas[d].adMiddleMonitor = e[d].middlecount,
  417. t.preAdsParas[d].adMiddleMonitorTime = parseInt(e[d].monitorTime),
  418. t.preAdsParas[d].adMonitor3 = e[d].eventExposure,
  419. t.preAdsParas[d].adMonitor4 = e[d].eventExposure1,
  420. t.preAdsParas[d].duration = parseInt(e[d].duration))
  421. }
  422. } catch (e) {
  423. console.warn("广告解析错误!"),
  424. r.sendAliAnalytic("/play.1.24", "code=" + vodh5player.ALI_ANALYTICS_ERROR_CODE_1_24_JSON_PARSE + "&msg=error2&url=" + a + "&bfirstframeplayed=" + (r.firstFramePlayed_ ? "1" : "0"))
  425. }
  426. var i = 0;
  427. if (0 === (i = t.preAdsParas.length))
  428. return vodh5player.trace("parsePreAdsData: there is no preAd"),
  429. t.preAdsParas.length = 0,
  430. delete t.preAdsParas,
  431. void this.requestContentVDN(t);
  432. for (var l = (new Date).getTime().toString().slice(0, 10), s = t.fingerprint_uid, n = md5(l + "2049" + vodh5player.VDN_AD_STATIC_CHECK + s).toUpperCase(), p = 0; p < i; p++) {
  433. var h = this.HTTP_PRE + vodh5player.VDN_AD_URL + "pid=" + t.preAdsParas[p].guid + vodh5player.VDN_PARA1
  434. , r = (h += "&tsp=" + l + "&vn=2049&vc=" + n + "&uid=" + s + "&wlan=",
  435. this.sendAliAnalytic_ad("/play.1.40", "ad_url=null&ad_v_id=" + t.preAdsParas[p].guid + "&ad_sum=" + i + "&ad_num=" + (p + 1) + "&ad_len=" + 15 * i),
  436. this);
  437. vodh5player.xhrRequest({
  438. url: h,
  439. responseType: "json",
  440. data: {},
  441. customPara: {
  442. adindex: p,
  443. url: h
  444. },
  445. success: function (e, a) {
  446. vodh5player.trace("preAd vdn loaded xhr" + a.adindex),
  447. r.parsePreAdVdnDataXHR(e, a.adindex, a.url)
  448. },
  449. ontimeout: function (e) {
  450. vodh5player.trace("preAd vdn load timeout."),
  451. r.sendAliAnalytic("/play.1.24", "code=" + vodh5player.ALI_ANALYTICS_ERROR_CODE_1_24_TIMEOUT + "&msg=error3&url=" + e.url + "&bfirstframeplayed=" + (r.firstFramePlayed_ ? "1" : "0"))
  452. },
  453. error: function (e) {
  454. vodh5player.trace("preAd vdn load error xhr" + e),
  455. r.getPreAdVdnErrorXHR()
  456. }
  457. })
  458. }
  459. r = this;
  460. this.preAdVdnTimeOut_ = setTimeout(function () {
  461. r.sendAliAnalytic("/play.1.24", "code=" + vodh5player.ALI_ANALYTICS_ERROR_CODE_1_24_TIMEOUT + "&msg=error3&bfirstframeplayed=" + (r.firstFramePlayed_ ? "1" : "0")),
  462. console.warn(vodh5player.DEBUG_LABEL + "preAdVdnTimeOut timeout !"),
  463. r.preAdVdnTimeOutState_ = !0,
  464. r.parseAdVdnDataTimeOut()
  465. }, vodh5player.AD_VDN_TIME_OUT)
  466. } else
  467. vodh5player.trace("no preAd 2"),
  468. t.preAdsParas.length = 0,
  469. delete t.preAdsParas,
  470. r.requestContentVDN(t);
  471. return i
  472. }
  473. ,
  474. this.parsePreAdVdnDataXHR = function (e, a, r) {
  475. var t = this
  476. , o = this.vodParas;
  477. if (vodh5player.trace("pre ad:" + a + " vdn data received xhr"),
  478. !t.preAdVdnTimeOutState_) {
  479. try {
  480. o.preAdsParas[a].url = e.hls_url
  481. } catch (e) {
  482. t.sendAliAnalytic("/play.1.24", "code=" + vodh5player.ALI_ANALYTICS_ERROR_CODE_1_24_JSON_PARSE + "&msg=error4&url=" + r + "&bfirstframeplayed=" + (t.firstFramePlayed_ ? "1" : "0"))
  483. }
  484. t.sendAliAnalytic_ad("/play.1.41", "ad_url=" + encodeURIComponent(o.preAdsParas[a].url) + "&ad_v_id=" + o.preAdsParas[a].guid + "&ad_sum=" + o.preAdsParas.length + "&ad_num=" + (a + 1) + "&ad_len=" + 15 * o.preAdsParas.length);
  485. for (var d = !0, i = 0; i < o.preAdsParas.length; i++)
  486. if (void 0 === o.preAdsParas[i].url) {
  487. d = !1;
  488. break
  489. }
  490. d && (clearTimeout(t.preAdVdnTimeOut_),
  491. t.requestContentVDN(o))
  492. }
  493. }
  494. ,
  495. this.parseAdVdnDataTimeOut = function () {
  496. for (var e = this.vodParas.preAdsParas.length - 1; 0 <= e; e--)
  497. void 0 === this.vodParas.preAdsParas[e].url && console.warn(vodh5player.DEBUG_LABEL + "pre as i:" + e + "timeout !");
  498. this.preparePreAd()
  499. }
  500. ,
  501. this.preparePreAd = function () {
  502. for (var e = this.vodParas.preAdsParas.length - 1; 0 <= e; e--)
  503. void 0 === this.vodParas.preAdsParas[e].url && this.vodParas.preAdsParas.splice(e, 1);
  504. this.requestContentVDN(this.vodParas)
  505. }
  506. ,
  507. this.parsePostAdsData = function (e) {
  508. vodh5player.trace("parsePostAdsData" + e);
  509. var a = this.vodParas;
  510. if (e && void 0 === a.postAdsParas) {
  511. var r = 0;
  512. Array.isArray(e) && (r = e.length),
  513. a.postAdsParas = [];
  514. for (var t = 0; t < r; t++) {
  515. if (void 0 === e[t].guid) {
  516. console.warn("广告数据解析错误!"),
  517. p.sendAliAnalytic("/play.1.24", "code=" + vodh5player.ALI_ANALYTICS_ERROR_CODE_1_24_JSON_PARSE + "&msg=error2&url=" + url + "&bfirstframeplayed=" + (p.firstFramePlayed_ ? "1" : "0")),
  518. a.postAdsParas.length = 0;
  519. break
  520. }
  521. e[t].guid && e[t].clickUrl && (a.postAdsParas[t] = {},
  522. a.postAdsParas[t].guid = e[t].guid,
  523. a.postAdsParas[t].clickUrl = e[t].clickUrl,
  524. a.postAdsParas[t].adStartMonitor = e[t].startcount,
  525. a.postAdsParas[t].adMiddleMonitor = e[t].middlecount,
  526. a.postAdsParas[t].adMiddleMonitorTime = parseInt(e[t].monitorTime),
  527. a.postAdsParas[t].adMonitor3 = e[t].eventExposure,
  528. a.postAdsParas[t].adMonitor4 = e[t].eventExposure1,
  529. a.postAdsParas[t].duration = parseInt(e[t].duration))
  530. }
  531. vodh5player.trace("post ad number:" + a.postAdsParas.length);
  532. var o = 0;
  533. if (0 === (o = a.postAdsParas.length))
  534. return vodh5player.trace("there s no postAd ~1"),
  535. a.postAdsParas.length = 0,
  536. delete a.postAdsParas,
  537. void this.vjsplayer.trigger("nopostroll");
  538. for (var d = (new Date).getTime().toString().slice(0, 10), i = a.fingerprint_uid, l = md5(d + "2049" + vodh5player.VDN_AD_STATIC_CHECK + i).toUpperCase(), s = 0; s < o; s++) {
  539. var n = this.HTTP_PRE + vodh5player.VDN_AD_URL + "pid=" + a.postAdsParas[s].guid + vodh5player.VDN_PARA1
  540. , p = (n += "&tsp=" + d + "&vn=2049&vc=" + l + "&uid=" + i + "&wlan=",
  541. this.sendAliAnalytic_ad("/play.1.40", "ad_url=null&ad_v_id=" + a.postAdsParas[s].guid + "&ad_sum=" + o + "&ad_num=" + (s + 1) + "&ad_len=" + 15 * o),
  542. this);
  543. vodh5player.xhrRequest({
  544. url: n,
  545. responseType: "json",
  546. data: {},
  547. customPara: s,
  548. success: function (e, a) {
  549. vodh5player.trace("post ad vdn loaded xhr" + a),
  550. p.parsePostAdVdnDataXHR(e, a)
  551. },
  552. error: function (e) {
  553. vodh5player.trace("post ad load error xhr" + e),
  554. p.getPostAdVdnErrorXHR()
  555. }
  556. })
  557. }
  558. p = this;
  559. this.postAdVdnTimeOut_ = setTimeout(function () {
  560. console.warn(vodh5player.DEBUG_LABEL + "postAdVdnTimeOut timeout !"),
  561. p.postAdVdnTimeOutState_ = !0,
  562. p.vjsplayer.trigger("nopostroll")
  563. }, vodh5player.AD_VDN_TIME_OUT)
  564. } else
  565. this.debug && window.console.warn(vodh5player.DEBUG_LABEL + "postAd data error"),
  566. a.postAdsParas.length = 0,
  567. delete a.postAdsParas;
  568. return o
  569. }
  570. ,
  571. this.parsePostAdVdnData = function (data) {
  572. var this_ = data.this
  573. , adIndex = data.adIndex
  574. , vodParas = this_.vodParas;
  575. if (vodh5player.trace("parsePostAdVdnData index:" + adIndex),
  576. !this_.postAdVdnTimeOutState_) {
  577. for (var obj = eval("(" + vodAdCallsData + ")"), allAdURLLoaded = (vodParas.postAdsParas[adIndex].url = obj.hls_url,
  578. this_.sendAliAnalytic_ad("/play.1.41", "ad_url=" + encodeURIComponent(vodParas.postAdsParas[adIndex].url) + "&ad_v_id=" + vodParas.postAdsParas[adIndex].guid + "&ad_sum=" + vodParas.postAdsParas.length + "&ad_num=" + (adIndex + 1) + "&ad_len=" + 15 * vodParas.postAdsParas.length),
  579. !0), i = 0; i < vodParas.postAdsParas.length; i++)
  580. if (void 0 === vodParas.postAdsParas[i].url) {
  581. allAdURLLoaded = !1;
  582. break
  583. }
  584. allAdURLLoaded && (clearTimeout(this_.postAdVdnTimeOut_),
  585. vodh5player.trace("all post ad url loaded"),
  586. this_.startPostAD())
  587. }
  588. }
  589. ,
  590. this.parsePostAdVdnDataXHR = function (e, a) {
  591. var r = this
  592. , t = r.vodParas;
  593. if (vodh5player.trace("parsePostAdVdnData index:" + a),
  594. !r.postAdVdnTimeOutState_) {
  595. t.postAdsParas[a].url = e.hls_url,
  596. r.sendAliAnalytic_ad("/play.1.41", "ad_url=" + encodeURIComponent(t.postAdsParas[a].url) + "&ad_v_id=" + t.postAdsParas[a].guid + "&ad_sum=" + t.postAdsParas.length + "&ad_num=" + (a + 1) + "&ad_len=" + 15 * t.postAdsParas.length);
  597. for (var o = !0, d = 0; d < t.postAdsParas.length; d++)
  598. if (void 0 === t.postAdsParas[d].url) {
  599. o = !1;
  600. break
  601. }
  602. o && (clearTimeout(r.postAdVdnTimeOut_),
  603. vodh5player.trace("all post ad url loaded"),
  604. r.startPostAD())
  605. }
  606. }
  607. ,
  608. this.requestContentVDN = function (r) {
  609. var e = this.HTTP_PRE + vodh5player.VDN_URL + "pid=" + r.videoId + vodh5player.VDN_PARA1
  610. , a = (new Date).getTime().toString().slice(0, 10)
  611. , t = "2049"
  612. , o = ""
  613. , d = r.fingerprint_uid
  614. , i = (void 0 !== r.vdn && void 0 !== r.vdn.vn && (t = r.vdn.vn),
  615. void 0 !== r.vdn && void 0 !== r.vdn.vtoken && "" !== r.vdn.vtoken && (o = r.vdn.vtoken),
  616. md5(a + t + vodh5player.VDN_AD_STATIC_CHECK + d).toUpperCase())
  617. , l = (e += "&tsp=" + a + "&vn=" + t + "&vc=" + i + "&uid=" + d + "&wlan=",
  618. "" !== o && (e += "&vtokenpos=1"),
  619. void 0 !== r.vdn && void 0 !== r.vdn.pcv && (e += "&pcv=" + r.vdn.pcv),
  620. this);
  621. vodh5player.xhrRequest({
  622. url: e,
  623. vtoken: o,
  624. method: "GET",
  625. responseType: "text",
  626. data: {},
  627. customPara: e,
  628. success: function (e, a) {
  629. l.parseVodDataFromVdnXhr(r, e, a)
  630. },
  631. ontimeout: function (e) {
  632. vodh5player.trace("content vdn timeout."),
  633. l.sendAliAnalytic("/play.1.4", "code=" + vodh5player.ALI_ANALYTICS_ERROR_CODE_1_24_TIMEOUT + "&msg=error5&url=" + e.url + "&bfirstframeplayed=" + (l.firstFramePlayed_ ? "1" : "0"))
  634. },
  635. error: function (e) {
  636. vodh5player.trace("content vdn load error" + e),
  637. l.parseVodDataFromVdnXhrError(r)
  638. }
  639. })
  640. }
  641. ,
  642. this.parseVodDataFromVdnXhr = function (y, e, a) {
  643. vodh5player.trace("parsing content vdn data ...");
  644. try {
  645. var u = JSON.parse(e)
  646. } catch (e) {
  647. return window.console.warn(vodh5player.DEBUG_LABEL + "content vdn data parse error!"),
  648. this_.sendAliAnalytic("/play.1.4", "code=" + vodh5player.ALI_ANALYTICS_ERROR_CODE_1_24_JSON_PARSE + "&msg=error6&url=" + a + "&bfirstframeplayed=" + (this_.firstFramePlayed_ ? "1" : "0")),
  649. void this.parseVodDataFromVdnXhrError(y)
  650. }
  651. try {
  652. var r;
  653. if ("no" === u.ack)
  654. return this.container_ = document.getElementById(y.divId),
  655. this.container_.className = "vdn-novideo-error pic_box",
  656. r = "版权原因 无法播放",
  657. "002" === u.status || "003" === u.status ? r = "暂不支持播放该视频内容" : "004" === u.status ? r = "该视频不存在" : "006" === u.status ? r = "收费视频未定价" : "007" === u.status && (r = "收费视频无观看权限"),
  658. this.container_.innerHTML = "<div style='height:50px; top:45%; position: relative;'>" + r + "</div>",
  659. void this_.sendAliAnalytic("/play.1.24", "code=" + vodh5player.ALI_ANALYTICS_ERROR_CODE_1_24_COPYRIGHT + "&msg=error7&url=" + a + "&bfirstframeplayed=" + (this_.firstFramePlayed_ ? "1" : "0"));
  660. if ("yes" === u.ack && "0" === u.public)
  661. return this.container_ = document.getElementById(y.divId),
  662. this.container_.className = "vdn-novideo-error pic_box",
  663. this.container_.innerHTML = "<div style='height:50px; top:45%; position: relative;'>您所在的地区,暂不支持播放该视频</div>",
  664. void this_.sendAliAnalytic("/play.1.24", "code=" + vodh5player.ALI_ANALYTICS_ERROR_CODE_1_24_COPYRIGHT + "&msg=error7&url=" + a + "&bfirstframeplayed=" + (this_.firstFramePlayed_ ? "1" : "0"));
  665. if (!0 === vodh5player.DRM && !1 === vodh5player.TMP_DRM_CLOSE) {
  666. if ("" === u.manifest.hls_h5e_url || void 0 === u.manifest.hls_h5e_url)
  667. return window.console.warn(vodh5player.DEBUG_LABEL + "content vdn hls_enc_url parse error!"),
  668. void this.parseVodDataFromVdnXhrError(y)
  669. } else if ("" === u.hls_url || void 0 === u.hls_url)
  670. return window.console.warn(vodh5player.DEBUG_LABEL + "content vdn hls_url parse error!"),
  671. void this.parseVodDataFromVdnXhrError(y);
  672. this.analyticObj.cdnCode = u.hls_cdn_info.cdn_code,
  673. this.analyticObj.lc_ip = u.lc.ip,
  674. this.analyticObj.lc_coun = u.lc.country_code,
  675. this.analyticObj.lc_prov = u.lc.provice_code,
  676. this.analyticObj.lc_city = u.lc.city_code,
  677. this.analyticObj.lc_isp = u.lc.isp_code,
  678. this.analyticObj.client_sid = u.client_sid,
  679. this.analyticObj.column = u.column,
  680. this.analyticObj.channel = u.play_channel,
  681. this.analyticObj.assetName = y.videoId + u.title,
  682. this.analyticObj.public = u.public;
  683. var t, _ = vodh5player.DRM ? u.manifest.hls_h5e_url : u.hls_url;
  684. if (void 0 === _ && (_ = u.hls_url),
  685. this.analyticObj.streamUrl = _,
  686. y.isHttps && "http:" === _.substr(0, 5) && (_ = "https:" + _.substr(5),
  687. vodh5player.trace("https transition:" + _)),
  688. void 0 !== u.video.totalLength && u.video.totalLength <= 60 && (vodh5player.trace("video duration is less than 60 seconds"),
  689. y.hasBannerAD = !1,
  690. y.hasPauseAD = !1,
  691. y.hasPreAD = !1,
  692. y.hasPostAD = !1),
  693. y.ui_cuePoint && (y.cuePoints = u.segments),
  694. vodh5player.enableVip ? vodh5player.trace("vdn vdnDefaultStream:" + y.vdnDefaultStream + (vodh5player.enableVip ? " (custom config no longer use)" : "")) : "chapters" === u.default_stream ? y.vdnDefaultStream = vodh5player.DEFAULT_QUALITY_LABELS[1] : "chapters2" === u.default_stream ? y.vdnDefaultStream = vodh5player.DEFAULT_QUALITY_LABELS[2] : "chapters3" === u.default_stream ? y.vdnDefaultStream = vodh5player.DEFAULT_QUALITY_LABELS[3] : "chapters4" === u.default_stream ? y.vdnDefaultStream = vodh5player.DEFAULT_QUALITY_LABELS[4] : "chapters5" === u.default_stream ? y.vdnDefaultStream = vodh5player.DEFAULT_QUALITY_LABELS[5] : "chapters6" === u.default_stream ? y.vdnDefaultStream = vodh5player.DEFAULT_QUALITY_LABELS[6] : "chapters7" === u.default_stream ? y.vdnDefaultStream = vodh5player.DEFAULT_QUALITY_LABELS[7] : y.vdnDefaultStream = vodh5player.DEFAULT_QUALITY_LABELS[3],
  695. vodh5player.cdnHostName = vodh5player.getHostName(_),
  696. void 0 !== y.posterImg && "" !== y.posterImg || u.video.chapters3 && u.video.chapters3[0] && (y.posterImg = t = u.video.chapters3[0].image),
  697. void 0 !== y.posterImg && "" !== y.posterImg || void 0 !== t || u.video.chapters4 && u.video.chapters4[0] && (y.posterImg = t = u.video.chapters4[0].image),
  698. vodh5player.enableVip)
  699. return vodh5player.trace("load master m3u8 file"),
  700. void vodh5player.xhrRequest({
  701. url: _,
  702. responseType: "text",
  703. timeout: 6e3,
  704. data: {},
  705. success: function (e, a, r) {
  706. console.log("getAllResponseHeaders:"),
  707. console.log(r);
  708. r = new videojs.M3u8Parser;
  709. if (r.push(e),
  710. r.end(),
  711. r.manifest.playlists) {
  712. var t, o = r.manifest.playlists;
  713. if (o.map(function (e) {
  714. e.url = vodh5player.cdnHostName + e.uri,
  715. e.masterIndex = o.indexOf(e);
  716. for (var a = 0; a < vodh5player.DEFAULT_QUALITIES_DIVIDE.length; a++)
  717. e.attributes.BANDWIDTH < vodh5player.DEFAULT_QUALITIES_DIVIDE[0] ? (e.enabled = !1,
  718. e.label = "LOW") : e.attributes.BANDWIDTH > vodh5player.DEFAULT_QUALITIES_DIVIDE[vodh5player.DEFAULT_QUALITIES_DIVIDE.length - 1] ? (e.enabled = !1,
  719. e.label = "HI") : e.attributes.BANDWIDTH > vodh5player.DEFAULT_QUALITIES_DIVIDE[a] && e.attributes.BANDWIDTH <= vodh5player.DEFAULT_QUALITIES_DIVIDE[a + 1] && (e.enabled = !0,
  720. e.label = vodh5player.DEFAULT_QUALITY_LABELS[a],
  721. e.permition = vodh5player.qualitiesNeedPermission[a],
  722. vodh5player.qualitiesEnabled[a] || (e.enabled = !1))
  723. }),
  724. vodh5player.uniquelabel)
  725. for (var d = o.length, i = 0; i < d; i++)
  726. for (var l = 0; l < d; l++)
  727. i !== l && o[i].label === o[l].label && o[i].enabled && o[l].enabled && o[i].attributes.BANDWIDTH > o[l].attributes.BANDWIDTH && (o[l].enabled = !1);
  728. vodh5player.trace("DEV>> "),
  729. console.table(o),
  730. console.log(o);
  731. for (var s, n = !0, i = o.length - 1; 0 <= i; i--)
  732. if (0 === o[i].permition && o[i].enabled) {
  733. n = !1,
  734. s = o[i].label;
  735. break
  736. }
  737. for (var p, h, l = 0; l < o.length; l++)
  738. if (1 === o[l].permition && o[l].enabled) {
  739. p = o[l].label,
  740. console.log("lowest1Label:" + p);
  741. break
  742. }
  743. for (l = o.length - 1; -0 < l; l--)
  744. if (1 === o[l].permition && o[l].enabled) {
  745. h = o[l].label,
  746. console.log("highest1Label:" + h);
  747. break
  748. }
  749. if (0 === vodh5player.userLevel) {
  750. if (n)
  751. return vodh5player.trace("无免费码率,请登录观看"),
  752. void this_.noFreeQualityError("无免费码率,请登录观看");
  753. t = s
  754. } else
  755. 0 < vodh5player.userLevel && (h ? t = h : s ? t = s : vodh5player.trace("无有效码率", !0));
  756. vodh5player.trace("targetQualityLabel:" + t);
  757. var e = videojs.storePub.get("h5vodlocaldata")
  758. , c = void 0 !== e && void 0 !== e.lastQuality ? e.lastQuality : "";
  759. if (c) {
  760. for (var v = !1, i = o.length - 1; 0 <= i; i--)
  761. o[i].enabled && o[i].label === c && o[i].permition <= vodh5player.userLevel && (t = c,
  762. v = !0,
  763. vodh5player.trace("user saved QualityLabel:" + t));
  764. v || vodh5player.trace("user saved QualityLabel can not use.")
  765. }
  766. for (i = o.length - 1; 0 <= i; i--)
  767. o[i].permition <= vodh5player.userLevel && (o[i].permition = 0);
  768. "1" === u.public && "001" === u.status && (this_.vjsplayer = this_.createVJS(y.divId, _, y.posterImg, y.language, o, t),
  769. this_.vjsplayer.shellstructure = this_,
  770. vodh5player.playerList.push(this_.vjsplayer))
  771. } else
  772. vodh5player.trace("m3u8 has problom!", !0)
  773. },
  774. error: function (e) {
  775. vodh5player.trace("videoUrl load error" + e)
  776. }
  777. });
  778. "1" === u.public && "001" === u.status && (this.vjsplayer = this.createVJS(y.divId, _, y.posterImg, y.language),
  779. this.vjsplayer.shellstructure = this,
  780. vodh5player.playerList.push(this.vjsplayer))
  781. } catch (e) {
  782. this_.sendAliAnalytic("/play.1.4", "code=" + vodh5player.ALI_ANALYTICS_ERROR_CODE_1_24_JSON_PARSE + "&msg=error6&url=" + a + "&bfirstframeplayed=" + (this_.firstFramePlayed_ ? "1" : "0"))
  783. }
  784. }
  785. ,
  786. this.noFreeQualityError = function (e) {
  787. this.container_ = document.getElementById(this.vodParas.divId),
  788. this.container_.className += " vdn-novideo-error pic_box",
  789. this.container_.innerHTML = "<div id='constructErrorpanel' style='height:50px; top:45%; position: relative;'> " + e + "</div>",
  790. this.container_.innerHTML = this.container_.innerHTML + "<div style='height:50px; top:45%; position: relative;'> <button onClick='nobrPlay()'>登录</button></div>",
  791. this_.sendAliAnalytic("/play.1.24", "code=" + vodh5player.ALI_ANALYTICS_ERROR_CODE_1_24_TIMEOUT + "&msg=" + e + "&url=&bfirstframeplayed=" + (this_.firstFramePlayed_ ? "1" : "0"))
  792. }
  793. ,
  794. this.trycall = function (e) {
  795. try {
  796. e()
  797. } catch (e) {
  798. vodh5player.trace(e)
  799. }
  800. }
  801. ,
  802. this.workerTimeroutError = function (e) {
  803. console.warn(vodh5player.DEBUG_LABEL + "workerTimeroutError " + this.id),
  804. this.container_ = document.getElementById(this.vodParas.divId),
  805. this.container_.className += " vdn-novideo-error pic_box",
  806. this.container_.innerHTML = "<div style='height:50px; top:45%; position: relative;'>播放器加载超时 " + vodh5player.ERROR_CODE[0] + "</div>",
  807. this_.sendAliAnalytic("/play.1.24", "code=" + vodh5player.ALI_ANALYTICS_ERROR_CODE_1_24_TIMEOUT + "&msg=workertimeout&url=&bfirstframeplayed=" + (this_.firstFramePlayed_ ? "1" : "0"))
  808. }
  809. ,
  810. this.parseVodDataFromVdnXhrError = function (e) {
  811. void 0 !== e ? (console.warn(vodh5player.DEBUG_LABEL + "404 parseVodDataFromVdnXhrError " + e.divId),
  812. this.container_ = document.getElementById(e.divId),
  813. this.container_.className = "vdn-novideo-error pic_box",
  814. this.container_.innerHTML = "<div style='height:50px; top:45%; position: relative;'>网络开小差了,请稍后再试</div>") : console.warn(vodh5player.DEBUG_LABEL + "404 parseVodDataFromVdnXhrError ")
  815. }
  816. ,
  817. this.createVJS = function (e, a, r, t, o, d) {
  818. var i = this.vodParas
  819. , l = !1
  820. , s = !1
  821. , n = !1
  822. , p = !1
  823. , h = (vodh5player.trace("create vjs ..."),
  824. void 0 !== t && "" !== t && " " !== t || (t = "zh-CN"),
  825. this.container_ = document.getElementById(e),
  826. document.createElement("source"))
  827. , a = (void 0 !== i.videoSrc ? (h.src = i.videoSrc,
  828. window.console.warn("test url:" + i.videoSrc)) : h.src = a,
  829. h.type = "application/x-mpegURL",
  830. document.createElement("video"))
  831. , e = (a.setAttribute("id", e + "_player"),
  832. a.setAttribute("class", "video-js"),
  833. a.appendChild(h),
  834. a.style.position = "absolute",
  835. a.style.width = "100%",
  836. a.style.height = "100%",
  837. a.style.left = "0px",
  838. a.style.top = "0px",
  839. this.container_.appendChild(a),
  840. videojs.storePub.get("h5vodlocaldata"))
  841. , h = -1
  842. , c = 1 === i.PLAYER_TYPE_INDEX ? (vodh5player.enableQualityLock = !0,
  843. [6, 5, 4, 3, 2, 1, 7]) : (vodh5player.enableQualityLock = !0,
  844. [3, 4, 2, 5, 1])
  845. , v = (void 0 !== e && void 0 !== e.lastQuality ? (v = e.lastQuality,
  846. h = vodh5player.DEFAULT_QUALITY_LABELS.indexOf(v)) : v = "",
  847. vodh5player.trace(" savedQuality:" + v + " savedQualityIndex:" + h),
  848. -1 !== (e = vodh5player.DEFAULT_QUALITY_LABELS.indexOf(i.vdnDefaultStream)) && -1 !== c.indexOf(e) && (c.splice(c.indexOf(e), 1),
  849. c.unshift(e)),
  850. -1 !== h && -1 !== c.indexOf(h) && (c.splice(c.indexOf(h), 1),
  851. c.unshift(h)),
  852. vodh5player.trace("defaultQuality:" + c + (vodh5player.enableVip ? " (custom config will not be use this array!)" : "")),
  853. vodh5player.enableQualityLock || (c.length = 0,
  854. c = null,
  855. vodh5player.trace("enableQualityLock:false")),
  856. {
  857. wrapperVersion: vodh5player.DEV ? "dev " + wrapperversion : wrapperversion,
  858. wrapperupdate: wrapperupdate,
  859. enableVip: vodh5player.enableVip,
  860. skipAdTip: vodh5player.skipAdTip,
  861. qualityPermitMode: vodh5player.enableVip,
  862. customQualityList: o,
  863. customDefaultQuality: d,
  864. enableQualityLock: vodh5player.enableQualityLock,
  865. config: this.config,
  866. logicIndex: this.PLAYER_TYPE_INDEX,
  867. drmLabel: vodh5player.DRM,
  868. debug: this.debug,
  869. debugInfo: vodh5player.debugInfo,
  870. paras: i,
  871. poster: r,
  872. vdnDefaultStream: i.vdnDefaultStream,
  873. controls: !0,
  874. setup_loop: !1,
  875. setup_autoNext: !0,
  876. autoplay: i.autoplay,
  877. cuePoints: i.cuePoints,
  878. preload: "auto",
  879. language: t,
  880. playbackRates: [.5, 1, 1.25, 1.5, 2],
  881. breakpoints: {},
  882. responsive: !0,
  883. userActions: {
  884. hotkeys: {
  885. muteKey: function (e) {
  886. return 77 === e.which
  887. },
  888. fullscreenKey: function (e) {
  889. return 70 === e.which
  890. },
  891. playPauseKey: function (e) {
  892. return 80 === e.which || 32 === e.which
  893. }
  894. }
  895. },
  896. nextImageUrl: "" + i.ui_nextImageUrl,
  897. nextTitle: "" + i.ui_nextTitle,
  898. controlBar: {
  899. nextPanel: i.listMode,
  900. currentTimeDisplay: !0,
  901. remainingTimeDisplay: !1,
  902. seekToLive: !1,
  903. customControlSpacer: !0,
  904. audioModeButton: !1,
  905. playbackQualityMenuButton: i.ui_quality,
  906. playbackQualityLabels: i.playbackQualityLabels,
  907. playbackRateMenuButton: i.ui_rate,
  908. chooseVideoButton: !0 === i.chooseVideo,
  909. descriptionsButton: !1,
  910. subsCapsButton: !1,
  911. audioTrackButton: !1,
  912. setupMenuButton: i.ui_setup,
  913. fullscreenToggle: i.ui_fullScreen,
  914. webfullscreenToggle: i.ui_webFullScreen,
  915. volumePanel: {
  916. inline: !1
  917. }
  918. },
  919. videoSnapUrl: vodh5player.VIDEO_SNAP_URL,
  920. barrageVod: "video" === i.barrageType,
  921. barrageConfigUrl: vodh5player.BARRAGE_CONFIG_URL,
  922. barrageContentUrl: "video" === i.barrageType ? "common.newcomment.cntv.cn/data/pandabarrage?" : "common.newcomment.cntv.cn/comment/list?",
  923. hasBarrage: i._hasBarrage,
  924. barrageApp: i.barrageApp,
  925. barrageItemId: i.barrageItemId,
  926. chooseVideoPanel: !0 === i.chooseVideo,
  927. chooseVideoData: vodh5player.chooseVideoData,
  928. textTrackSettings: !1,
  929. html5: {
  930. nativeCaptions: !1,
  931. nativeAudioTracks: !1,
  932. nativeVideoTracks: !1,
  933. hls: {
  934. debug: !1,
  935. overrideNative: !0
  936. }
  937. },
  938. isHttps: i.isHttps,
  939. pauseAd: i.hasPauseAD,
  940. pauseAdUrl: this.PAUSE_AD_URL,
  941. bannerAd: i.hasBannerAD,
  942. bannerAdUrl: this.BANNER_AD_URL
  943. })
  944. , y = (vodh5player.enableVip ? vodh5player.trace("custom config no longer use Lock quality:defaultQualityArr") : v.html5.hls.selectedIndex = c,
  945. this)
  946. , u = videojs(a.getAttribute("id"), v, function () {
  947. if (y.debug && window.console.log(vodh5player.DEBUG_LABEL + "player s ready, core version:" + videojs.VERSION + "-" + videojs.UPDATE_DATE + "-" + videojs.PLAYER_VERSION),
  948. y.analyticObj.playerversion = vodh5player.VERSION + "-" + wrapperversion,
  949. vodh5player.convivaOn && !this.convivaIntegration) {
  950. vodh5player.trace("conviva init");
  951. var e = {};
  952. e.ASSET_NAME = i.videoId,
  953. e.VIEWER_ID = i.fingerprint_uid,
  954. e.PLAYER_NAME = vodh5player.PLAYER_NAME,
  955. e.APP_VERSION = vodh5player.VERSION,
  956. e.PLAY_SCENE = vodh5player.PLAY_SCENE,
  957. e.APP_NAME = vodh5player.APP_NAME,
  958. e.P2P = vodh5player.P2P,
  959. e.cdnCode = y.analyticObj.cdnCode,
  960. e.lc_coun = y.analyticObj.lc_coun,
  961. e.lc_prov = y.analyticObj.lc_prov,
  962. e.lc_city = y.analyticObj.lc_city,
  963. e.lc_isp = y.analyticObj.lc_isp,
  964. e.wrapperversion = vodh5player.DEV ? "dev " + wrapperversion : wrapperversion;
  965. try {
  966. this.convivaIntegration = new ConvivaIma3IntegrationVod(this, e)
  967. } catch (e) {
  968. console.warn("conviva Error:" + e.message)
  969. }
  970. }
  971. y.analyticObj.createTime = Math.round((new Date).getTime() / 1e3),
  972. y.sendAliAnalytic("/play.1.3"),
  973. i.hasPreAD ? vodh5player.trace("safari pread 跳过续播逻辑") : void 0 !== i.startTime && "" !== i.startTime && null !== i.startTime && " " !== i.startTime ? (vodh5player.delayStartTime_ = i.startTime,
  974. vodh5player.trace("video start at:" + i.startTime + "s")) : (e = u.getSavedPosition(i.videoId),
  975. vodh5player.delayStartTime_ = e,
  976. vodh5player.trace("video start at savedPosition: " + e),
  977. e < 30 && (vodh5player.isStartTimeHasSet_ = !0),
  978. vodh5player.trace("vodh5player.isStartTimeHasSet_" + vodh5player.isStartTimeHasSet_)),
  979. u.on("timeupdate", function () {
  980. y.currentTimeSec_ !== Math.round(u.currentTime()) && (y.currentTimeSec_ = Math.round(u.currentTime()),
  981. u.saveVideoPosition(i.videoId)),
  982. vodh5player.isSafari && !u.ads.isInAdMode() && .1 < u.currentTime() && !y.isSafariPreAdHasShowed_ && (vodh5player.trace(" safari 开始广告"),
  983. y.isSafariPreAdHasShowed_ = !0,
  984. y.readyForPreroll(u)),
  985. !vodh5player.isStartTimeHasSet_ && !u.ads.isInAdMode() && 0 < vodh5player.delayStartTime_ && (u.currentTime(vodh5player.delayStartTime_),
  986. vodh5player.isStartTimeHasSet_ = !0)
  987. }),
  988. u.on("adtimeupdate", function () {
  989. var e, a;
  990. void 0 !== i.preAdsParas && 0 <= i.preAdsParas.length && (e = i.preAdsParas[i.preAdsIndex].adMiddleMonitor,
  991. a = i.preAdsParas[i.preAdsIndex].adMiddleMonitorTime,
  992. void 0 !== e && void 0 !== a && "" !== e && null !== e && Math.round(u.currentTime()) === a && (i.preAdsParas[i.preAdsIndex].adMiddleMonitor = "",
  993. vodh5player.xhrRequest({
  994. url: e,
  995. data: {}
  996. })))
  997. }),
  998. u.on("readyforpreroll", function () {
  999. s = !0,
  1000. vodh5player.trace("ADS readyforpreroll _ifPrerollReady:" + s),
  1001. p ? console.warn(vodh5player.DEBUG_LABEL + "ADS PREROLL TIMEOUT !") : (l && (l = s = null,
  1002. vodh5player.isSafari || y.readyForPreroll(u)),
  1003. vodh5player.isSafari && u.trigger("nopreroll"))
  1004. }),
  1005. u.on("readyforpostroll", function () {
  1006. vodh5player.trace("<player>e: readyforpostroll"),
  1007. y.readyForPostroll(u)
  1008. }),
  1009. u.on("adsready", function () {
  1010. vodh5player.trace("<player>e: adsready")
  1011. }),
  1012. u.on("adstart", function () {
  1013. vodh5player.trace("<player>e: adstart")
  1014. }),
  1015. u.on("adend", function () {
  1016. vodh5player.trace("<player>e: adend")
  1017. }),
  1018. u.on("adskip", function () {
  1019. vodh5player.trace("<player>e: adskip")
  1020. }),
  1021. u.on("adtimeout", function () {
  1022. vodh5player.trace("<player>e: adtimeout"),
  1023. p = !0
  1024. }),
  1025. u.on("firstplay", function () {
  1026. vodh5player.trace("<player>e: firstplay")
  1027. }),
  1028. u.on("nextvideo", function () {
  1029. vodh5player.trace("<player>e: NextVideo");
  1030. try {
  1031. NextVideo()
  1032. } catch (e) {
  1033. console.warn(vodh5player.DEBUG_LABEL + " disappearance function NextVideo")
  1034. }
  1035. }),
  1036. u.on("vipstatus", function () {
  1037. vodh5player.trace("<player>e: vipstatus");
  1038. try {
  1039. vipstatus()
  1040. } catch (e) {
  1041. console.warn(vodh5player.DEBUG_LABEL + " disappearance function vipstatus")
  1042. }
  1043. }),
  1044. u.on("loginstatus", function () {
  1045. vodh5player.trace("<player>e: loginstatus");
  1046. try {
  1047. loginstatus()
  1048. } catch (e) {
  1049. console.warn(vodh5player.DEBUG_LABEL + " disappearance function loginstatus")
  1050. }
  1051. }),
  1052. u.on("CDN_MEDIA_INFO", function (e) {
  1053. e.cdnMediaInfo.cdncip && (y.analyticObj.cdncip = e.cdnMediaInfo.cdncip),
  1054. e.cdnMediaInfo.cdnsip && (y.analyticObj.cdnsip = e.cdnMediaInfo.cdnsip),
  1055. y.analyticObj.cdncip && !e.cdnMediaInfo.cdncip && vodh5player.trace("cdncip turn invalid!", !0),
  1056. y.analyticObj.cdnsip && !e.cdnMediaInfo.cdnsip && vodh5player.trace("cdnsip turn invalid!", !0)
  1057. }),
  1058. u.on("enterFullWindow", function () {
  1059. vodh5player.trace("<player>e: enterFullWindow"),
  1060. "function" == typeof changeWindowToWebFullSceen && changeWindowToWebFullSceen(this.id())
  1061. }),
  1062. u.on("exitFullWindow", function () {
  1063. vodh5player.trace("<player>e: exitFullWindow"),
  1064. "function" == typeof changeWindowToNormalSceen && changeWindowToNormalSceen(this.id())
  1065. }),
  1066. u.on("changeHLSP2P", function (e) {
  1067. vodh5player.trace("changeHLSP2P:" + y.vodParas.videoId),
  1068. vodh5player.P2P ? vodh5player.hlsp2pLoaded && (e = vodh5player.cdnHostName + e.level.id.substr(2),
  1069. vodh5player.trace(" HLSP2P start,p2purl:" + e),
  1070. "undefined" != typeof HLSP2P && HLSP2P.isSupported() && (void 0 !== window.vjsp2p && (window.vjsp2p.destroy(),
  1071. window.vjsp2p = null),
  1072. window.vjsp2p = HLSP2P.createCommon({
  1073. videoId: u.el().getElementsByTagName("video")[0].id,
  1074. url: e
  1075. }),
  1076. window.vjsp2p.on(HLSP2P.Events.Rollback, function () {
  1077. window.vjsp2p.destroy()
  1078. }))) : vodh5player.trace("cancel p2p")
  1079. }),
  1080. u.on("changeAudioMode", function (e) {
  1081. switch (e.audioMode) {
  1082. case 0:
  1083. void 0 !== y.liveAudio && y.liveAudio.dislinkerDest();
  1084. break;
  1085. case 1:
  1086. void 0 !== y.liveAudio && y.liveAudio.connectDestHeadset();
  1087. break;
  1088. case 2:
  1089. void 0 !== y.liveAudio && y.liveAudio.connectDestLoudspeaker()
  1090. }
  1091. }),
  1092. i.preAdsParas && 0 < i.preAdsParas.length ? (u.addClass("ads"),
  1093. u.trigger("adsready")) : (i.hasPreAD = !1,
  1094. vodh5player.trace("ADS nopreroll 1"),
  1095. y.analyticObj.ready4play1_1 = !0,
  1096. u.trigger("nopreroll")),
  1097. y.container_.dispatchEvent(new Event("vodplayerready"))
  1098. })
  1099. , _ = (u.ready(function () {
  1100. n && (vodh5player.trace("trigger loadstart again"),
  1101. u.trigger("loadstart"),
  1102. n = !1)
  1103. }),
  1104. u.addClass("whs"),
  1105. u.on("loadstart", function () {
  1106. vodh5player.trace("<player>e: loadstart")
  1107. }),
  1108. u.on("error", function () {
  1109. vodh5player.trace("vjs error,code:" + u.error_.code + ",msg:" + u.error_.message),
  1110. y.sendAliAnalytic("/play.1.4", "msg=" + u.error_.message + "&bfirstframeplayed=" + (y.firstFramePlayed_ ? "1" : "0"))
  1111. }),
  1112. u.on("ended", function () {
  1113. vodh5player.trace("<player>e: ended"),
  1114. u.isInPictureInPicture() && u.exitPictureInPicture(),
  1115. y.contentEnded()
  1116. }),
  1117. u.on("loadedmetadata", function () {
  1118. !1 === l && (l = !0),
  1119. vodh5player.trace("<player>e: loadedmetadata"),
  1120. p ? console.warn(vodh5player.DEBUG_LABEL + "ADS PREROLL TIMEOUT !") : s && (y.readyForPreroll(u),
  1121. l = s = null)
  1122. }),
  1123. u.on("loadeddata", function () {
  1124. vodh5player.trace("<player>e: loadeddata"),
  1125. (void 0 === y.vodParas.preAdsParas || y.vodParas.preAdsParas.length <= 0) && y.sendAliAnalytic("/play.1.6")
  1126. }),
  1127. u.on("play", function () {
  1128. if (vodh5player.trace("<player>e: play"),
  1129. 1 < vodh5player.playerList.length)
  1130. for (var e = vodh5player.playerList.length, a = 0; a < e; a++)
  1131. vodh5player.playerList[a] !== this && vodh5player.playerList[a].shellstructure.group === this.shellstructure.group && vodh5player.playerList[a].pause();
  1132. for (var r = document.querySelectorAll("audio"), t = 0; t < r.length; t++)
  1133. r[t].pause()
  1134. }),
  1135. u.on("pause", function () {
  1136. vodh5player.trace("<player>e: pause"),
  1137. y.sendAliAnalytic("/play.1.7")
  1138. }),
  1139. u.on("analyticALI.play.1.13", function () {
  1140. y.sendAliAnalytic("/play.1.13")
  1141. }),
  1142. u.on("analyticALI.play.1.14", function () {
  1143. y.sendAliAnalytic("/play.1.14")
  1144. }),
  1145. u.on("analyticALI.play.1.17", function () {
  1146. y.sendAliAnalytic("/play.1.17")
  1147. }),
  1148. u.on("sourceset", function (e) {
  1149. vodh5player.trace("<player>e: sourceset")
  1150. }),
  1151. u.on("waiting", function (e) {
  1152. vodh5player.trace("<player>e: waiting"),
  1153. y.sendAliAnalytic("/play.1.18"),
  1154. void 0 !== y.analyticObj && (y.analyticObj.freezed = !0)
  1155. }),
  1156. u.on("playing", function (e) {
  1157. vodh5player.trace("<player>e: playing"),
  1158. y.analyticObj.ready4play1_1 && !y.analyticObj.firstplay && (y.firstFramePlayed_ = !0,
  1159. y.analyticObj.ready4play1_1 = !1,
  1160. y.analyticObj.firstplay = !0,
  1161. y.analyticObj.cumulativeTime = 0,
  1162. y.analyticObj.cumulativeTimeTimer = setInterval(y.cumulativeTimeStep, 1e3, y),
  1163. y.analyticObj.heartbeat = setInterval(y.aliHeartbeat, 1e3 * vodh5player.ALI_HEARTBEAT, y),
  1164. y.sendAliAnalytic("/play.1.1"))
  1165. }),
  1166. u.on("canplay", function (e) {
  1167. vodh5player.trace("<player>e: canplay")
  1168. }),
  1169. u.on("canplaythrough", function (e) {
  1170. vodh5player.trace("<player>e: canplaythrough"),
  1171. void 0 !== y.analyticObj && !0 === y.analyticObj.freezed && (y.sendAliAnalytic("/play.1.19"),
  1172. y.analyticObj.freezed = !1)
  1173. }),
  1174. u.on("seeking", function (e) {
  1175. vodh5player.trace("<player>e: seeking"),
  1176. 0 !== u.currentTime() && y.sendAliAnalytic("/play.1.15")
  1177. }),
  1178. u.on("durationchange", function (e) {
  1179. vodh5player.trace("<player>e: durationchange" + u.duration()),
  1180. vodh5player.trace("<player>e: currentTime" + u.currentTime())
  1181. }),
  1182. u.on("fullscreenchange", function (e) {
  1183. vodh5player.trace("<player>e: fullscreenchange"),
  1184. u.isFullscreen() ? y.sendAliAnalytic("/play.1.8") : y.sendAliAnalytic("/play.1.9")
  1185. }),
  1186. u.on("enterpictureinpicture", function (e) {
  1187. vodh5player.trace("<player>e: enterpictureinpicture")
  1188. }),
  1189. u.on("leavepictureinpicture", function (e) {
  1190. vodh5player.trace("<player>e: leavepictureinpicture")
  1191. }),
  1192. u.on("ratechange", function (e) {
  1193. vodh5player.trace("<player>e: ratechange")
  1194. }),
  1195. u.on("qualitychange", function (e) {
  1196. vodh5player.trace("<player>e: qualitychange")
  1197. }),
  1198. !0);
  1199. return u.on("volumechange", function (e) {
  1200. var a;
  1201. _ && (y.sendAliAnalytic("/play.1.16"),
  1202. _ = !1,
  1203. a = setTimeout(function () {
  1204. _ = !0,
  1205. clearTimeout(a)
  1206. }, 300))
  1207. }),
  1208. u
  1209. }
  1210. ,
  1211. this.readyForPreroll = function (t) {
  1212. var o = this
  1213. , d = this.vodParas
  1214. , i = (this.debug && (vodh5player.trace("readyForPreroll() hasPreAD:" + d.hasPreAD),
  1215. d.preAdsParas && vodh5player.trace("preAds:" + d.preAdsParas.length)),
  1216. 0);
  1217. if (!d.hasPreAD || void 0 === d.preAdsParas || 0 === d.preAdsParas.length)
  1218. return vodh5player.trace("ADS nopreroll 2"),
  1219. d.hasPreAD = !1,
  1220. o.analyticObj.ready4play1_1 = !0,
  1221. t.setAdsLabel(),
  1222. void t.trigger("nopreroll");
  1223. t.ads._state.adsReady = !0,
  1224. t.ads.startLinearAdMode();
  1225. for (var e = 0, a = i + 1; a < d.preAdsParas.length; a++)
  1226. e += d.preAdsParas[a].duration;
  1227. t.setAdsLabel(i + 1 + "/" + d.preAdsParas.length, d.preAdsParas[i].clickUrl, e),
  1228. t.src({
  1229. src: "" + d.preAdsParas[i].url,
  1230. type: "application/x-mpegURL"
  1231. });
  1232. var r = d.preAdsParas[i].adStartMonitor
  1233. , r = (null != r && "" !== r && vodh5player.xhrRequest({
  1234. url: r,
  1235. data: {}
  1236. }),
  1237. d.preAdsParas[i].adMonitor3)
  1238. , r = (null != r && "" !== r && vodh5player.xhrRequest({
  1239. url: r,
  1240. data: {}
  1241. }),
  1242. d.preAdsParas[i].adMonitor4);
  1243. null != r && "" !== r && vodh5player.xhrRequest({
  1244. url: r,
  1245. data: {}
  1246. }),
  1247. t.on("adplaying", function () {
  1248. vodh5player.trace("pre adplaying trigger ads-ad-started"),
  1249. t.trigger("ads-ad-started"),
  1250. !0 !== d.preAdsParas[i].sent && (d.preAdsParas[i].sent = !0,
  1251. o.sendAliAnalytic_ad("/play.1.42", "ad_url=" + encodeURIComponent(d.preAdsParas[i].url) + "&ad_v_id=" + d.preAdsParas[i].guid + "&ad_sum=" + d.preAdsParas.length + "&ad_num=" + (i + 1) + "&ad_len=" + 15 * d.preAdsParas.length))
  1252. }),
  1253. t.on("adended", function () {
  1254. if (vodh5player.trace("ADS pre adended"),
  1255. o.sendAliAnalytic_ad("/play.1.43", "ad_url=" + encodeURIComponent(d.preAdsParas[i].url) + "&ad_v_id=" + d.preAdsParas[i].guid + "&ad_sum=" + d.preAdsParas.length + "&ad_num=" + (i + 1) + "&ad_len=" + 15 * d.preAdsParas.length),
  1256. ++i < d.preAdsParas.length) {
  1257. for (var e = 0, a = (d.preAdsIndex = i) + 1; a < d.preAdsParas.length; a++)
  1258. e += d.preAdsParas[a].duration;
  1259. t.setAdsLabel(i + 1 + "/" + d.preAdsParas.length, d.preAdsParas[i].clickUrl, e),
  1260. t.src({
  1261. src: "" + d.preAdsParas[i].url,
  1262. type: "application/x-mpegURL"
  1263. });
  1264. var r = d.preAdsParas[i].adStartMonitor
  1265. , r = (null != r && "" !== r && vodh5player.xhrRequest({
  1266. url: r,
  1267. data: {}
  1268. }),
  1269. d.preAdsParas[i].adMonitor3)
  1270. , r = (null != r && "" !== r && vodh5player.xhrRequest({
  1271. url: r,
  1272. data: {}
  1273. }),
  1274. d.preAdsParas[i].adMonitor4);
  1275. null != r && "" !== r && vodh5player.xhrRequest({
  1276. url: r,
  1277. data: {}
  1278. })
  1279. } else
  1280. d.preAdsIndex = 0,
  1281. o.analyticObj.ready4play1_1 = !0,
  1282. t.setAdsLabel(),
  1283. t.ads.endLinearAdMode(),
  1284. t.off("adended"),
  1285. t.off("adplaying"),
  1286. o.sendAliAnalytic("/play.1.6")
  1287. })
  1288. }
  1289. ,
  1290. this.readyForPostroll = function (e) {
  1291. if (vodh5player.trace("readyForPostroll() hasPostAD:" + this.vodParas.hasPostAD),
  1292. !this.vodParas.hasPostAD || void 0 === this.POST_AD_URL)
  1293. return vodh5player.trace("ADS nopostroll 1" + this.POST_AD_URL),
  1294. void e.trigger("nopostroll");
  1295. var e = this.POST_AD_URL
  1296. , a = (this.vodParas.postAdsParas && (this.vodParas.postAdsParas.length = 0,
  1297. delete this.vodParas.postAdsParas),
  1298. this);
  1299. vodh5player.xhrRequest({
  1300. url: e,
  1301. timeout: vodh5player.VJS_ADS_TIMEOUT,
  1302. data: {},
  1303. success: function (e) {
  1304. vodh5player.trace("postad loaded " + e),
  1305. null === e ? a.parsePostAdsDataError(null) : a.parsePostAdsData(e)
  1306. },
  1307. error: function (e) {
  1308. vodh5player.trace("postad load error" + e),
  1309. a.parsePostAdsDataError(e)
  1310. }
  1311. })
  1312. }
  1313. ,
  1314. this.startPostAD = function () {
  1315. for (var r = 0, t = this.vodParas, o = this.vjsplayer, d = this, e = (o.isInPictureInPicture() && o.exitPictureInPicture(),
  1316. 0), a = r + 1; a < t.postAdsParas.length; a++)
  1317. e += t.postAdsParas[a].duration;
  1318. o.ads.startLinearAdMode(),
  1319. o.setAdsLabel(r + 1 + "/" + t.postAdsParas.length, t.postAdsParas[r].clickUrl, e),
  1320. o.src({
  1321. src: "" + t.postAdsParas[r].url,
  1322. type: "application/x-mpegURL"
  1323. }),
  1324. o.on("adplaying", function () {
  1325. vodh5player.trace("post adplaying trigger ads-ad-started"),
  1326. o.trigger("ads-ad-started"),
  1327. !0 !== t.postAdsParas[r].sent && (t.postAdsParas[r].sent = !0,
  1328. d.sendAliAnalytic_ad("/play.1.42", "ad_url=" + encodeURIComponent(t.postAdsParas[r].url) + "&ad_v_id=" + t.postAdsParas[r].guid + "&ad_sum=" + t.postAdsParas.length + "&ad_num=" + (r + 1) + "&ad_len=" + 15 * t.postAdsParas.length))
  1329. }),
  1330. o.on("adended", function () {
  1331. vodh5player.trace("ADS post adended"),
  1332. d.sendAliAnalytic_ad("/play.1.43", "ad_url=" + encodeURIComponent(t.postAdsParas[r].url) + "&ad_v_id=" + t.postAdsParas[r].guid + "&ad_sum=" + t.postAdsParas.length + "&ad_num=" + (r + 1) + "&ad_len=" + 15 * t.postAdsParas.length);
  1333. for (var e = 0, a = ++r + 1; a < t.postAdsParas.length; a++)
  1334. e += t.postAdsParas[a].duration;
  1335. r < t.postAdsParas.length ? (o.setAdsLabel(r + 1 + "/" + t.postAdsParas.length, t.postAdsParas[r].clickUrl, e),
  1336. o.src({
  1337. src: "" + t.postAdsParas[r].url,
  1338. type: "application/x-mpegURL"
  1339. })) : (vodh5player.trace("all post over"),
  1340. o.setAdsLabel(),
  1341. o.ads.endLinearAdMode(),
  1342. o.off("adended"),
  1343. o.off("adplaying"))
  1344. })
  1345. }
  1346. ,
  1347. this.changeSrc = function (e, a) {
  1348. vodh5player.trace(" changeSrc()");
  1349. var r = this.vjsplayer
  1350. , t = r.currentTime();
  1351. r.src(e),
  1352. !0 === a ? r.currentTime(0) : r.currentTime(t)
  1353. }
  1354. ,
  1355. this.contentEnded = function () {
  1356. vodh5player.trace(" contentEnded()");
  1357. var e = this.vjsplayer;
  1358. if (this.isSafariPreAdHasShowed_ = !0,
  1359. e.loop2())
  1360. e.currentTime(0),
  1361. e.play();
  1362. else {
  1363. try {
  1364. PlayComplete()
  1365. } catch (e) {
  1366. console.warn(vodh5player.DEBUG_LABEL + " disappearance function PlayComplete ,contentEnded")
  1367. }
  1368. if (!0 === e.autoNext())
  1369. try {
  1370. NextVideo()
  1371. } catch (e) {
  1372. console.warn(vodh5player.DEBUG_LABEL + " disappearance function NextVideo ,contentEnded")
  1373. }
  1374. }
  1375. }
  1376. ,
  1377. this.getPreAdVdnError = function (e) {
  1378. console.warn(vodh5player.DEBUG_LABEL + "getPreAdVdnError !" + e)
  1379. }
  1380. ,
  1381. this.getPreAdVdnErrorXHR = function (e) {
  1382. console.warn(vodh5player.DEBUG_LABEL + "getPreAdVdnErrorXHR !" + e)
  1383. }
  1384. ,
  1385. this.getPostAdVdnError = function (e) {
  1386. console.warn(vodh5player.DEBUG_LABEL + "getPostAdVdnError !" + e)
  1387. }
  1388. ,
  1389. this.getPostAdVdnErrorXHR = function (e) {
  1390. console.warn(vodh5player.DEBUG_LABEL + "getPostAdVdnErrorXHR !" + e)
  1391. }
  1392. ,
  1393. this.parsePreAdsDataError = function () {
  1394. console.warn(vodh5player.DEBUG_LABEL + "parsePreAdsDataError !"),
  1395. this.requestContentVDN(this.vodParas)
  1396. }
  1397. ,
  1398. this.parsePostAdsDataError = function (e) {
  1399. console.warn(vodh5player.DEBUG_LABEL + "parsePostAdsDataError !" + e),
  1400. this.vjsplayer.trigger("nopostroll")
  1401. }
  1402. ,
  1403. this.dispose = function (e) {
  1404. console.log('disposedisposedisposedisposedisposedisposedispose1123');
  1405. vodh5player.trace("disposing :" + this.vjsplayer.id()),
  1406. void 0 !== window.vjsp2p && (vodh5player.trace("destroy window.vjsp2p"),
  1407. window.vjsp2p.destroy(),
  1408. window.vjsp2p = null),
  1409. this.liveAudio,
  1410. "undefined" != typeof convivaVideoAnalytics && (vodh5player.trace("cleaning conviva :" + this.vjsplayer.id()),
  1411. convivaVideoAnalytics.reportPlaybackEnded(),
  1412. convivaVideoAnalytics.release(),
  1413. convivaVideoAnalytics = null,
  1414. videoPlayer.convivaVideoAnalytics = null,
  1415. Conviva.Analytics.release()),
  1416. vodh5player.removeElementById(vodh5player.CONVIVA_URL_NAME_1),
  1417. vodh5player.removeElementById(vodh5player.CONVIVA_URL_NAME_2),
  1418. vodh5player.removeElementById(vodh5player.CONVIVA_URL_NAME_3),
  1419. vodh5player.removeElementById(vodh5player.ALI_ANALYTICS_NAME),
  1420. vodh5player.removeElementById(vodh5player.FINGERPRINT2_NAME),
  1421. vodh5player.removeElementById(this.VIDEO_CORE_NAME),
  1422. vodh5player.removeElementById(this.VHS_NAME),
  1423. vodh5player.removeElementById(this.VIDEO_LANG_NAME),
  1424. this.sendAliAnalytic("/play.1.5"),
  1425. clearInterval(this.analyticObj.heartbeat),
  1426. clearInterval(this.analyticObj.cumulativeTimeTimer),
  1427. this.vjsplayer.dispose()
  1428. }
  1429. ,
  1430. this.sendAliAnalytic = function (e, a, r) {
  1431. var t = "";
  1432. null != a && (t += a),
  1433. void 0 === r && (a = this.analyticObj,
  1434. t = (t = (t = (t = (t = (t += "&playScene=" + vodh5player.PLAY_SCENE) + "&playerName=" + vodh5player.PLAYER_NAME) + "&playerversion=" + a.playerversion) + "&streamType=" + a.streamType) + "&streamProtocol=" + a.streamProtocol) + "&playAMR=" + a.playAMR,
  1435. void 0 !== this.vjsplayer ? (null !== this.vjsplayer.getCurentBitrate() ? t += "&bit=" + this.vjsplayer.getCurentBitrate() : t += "&bit=0",
  1436. t += "&loadtime=" + a.loadtime) : t += "&bit=0&loadtime=0",
  1437. t += "&playtime=" + this.analyticObj.cumulativeTime,
  1438. void 0 !== this.vjsplayer ? t += "&playing=" + this.vjsplayer.isPlaying() : t += "&playing=" + !1,
  1439. void 0 !== this.vjsplayer && this.vjsplayer.getQualityLevels() && (t += "&streamMBR=" + this.vjsplayer.getQualityLevels().length),
  1440. t = (t = (t = (t = (t = (t = (t = (t = (t = (t = (t = (t = (t = (t = (t = (t = (t = (t = (t = (t += "&v_id=" + this.vodParas.videoId) + "&referURL=" + encodeURIComponent(document.referrer)) + "&curURL=" + encodeURIComponent(window.location.href)) + "&createTime=" + a.createTime) + "&streamUrl=" + encodeURIComponent(a.streamUrl)) + "&cdnCode=" + a.cdnCode) + "&lc_ip=" + a.lc_ip) + "&lc_coun=" + a.lc_coun) + "&lc_prov=" + a.lc_prov) + "&lc_city=" + a.lc_city) + "&lc_isp=" + a.lc_isp) + "&client_sid=" + a.client_sid) + "&column=" + a.column) + "&channel=" + a.channel) + "&assetName=" + a.assetName) + "&public=" + a.public) + "&cdncip=" + a.cdncip) + "&cdnsip=" + a.cdnsip) + "&P2PStyle=" + a.P2PStyle) + "&unixts=" + Math.round((new Date).getTime() / 1e3)),
  1441. "undefined" != typeof goldlog ? goldlog.record(e, "", t, "") : vodh5player.trace("lost alianlytic", !0)
  1442. }
  1443. ,
  1444. this.sendAliAnalytic_ad = function (e, a) {
  1445. var r = ""
  1446. , a = (null != a && (r += a),
  1447. this.analyticObj)
  1448. , r = (r += "&playScene=" + vodh5player.PLAY_SCENE) + ("&playerversion=" + a.playerversion);
  1449. void 0 !== this.vjsplayer ? (null !== this.vjsplayer.getCurentBitrate() ? r += "&bit=" + this.vjsplayer.getCurentBitrate() : r += "&bit=0",
  1450. r += "&loadtime=" + a.loadtime) : r += "&bit=0&loadtime=0",
  1451. r = (r = (r = (r = (r = (r = (r = r + ("&v_id=" + this.vodParas.videoId) + "&type=vod") + "&referURL=" + encodeURIComponent(document.referrer)) + "&curURL=" + encodeURIComponent(window.location.href)) + "&createTime=" + a.createTime) + "&cdnCode=" + a.cdnCode) + "&column=" + a.column) + "&channel=" + a.channel,
  1452. "undefined" != typeof goldlog ? goldlog.record(e, "", r, "") : this.debug && window.console.warn(vodh5player.DEBUG_LABEL + "lost alianlytic")
  1453. }
  1454. ,
  1455. this.cumulativeTimeStep = function (e) {
  1456. console.log(e.vjsplayer.isPlaying());
  1457. e.vjsplayer &&
  1458. e.vjsplayer.isPlaying() &&
  1459. e.vjsplayer.ads &&
  1460. !1 === e.vjsplayer.ads.isInAdMode() &&
  1461. e.analyticObj.cumulativeTime++
  1462. }
  1463. ,
  1464. this.aliHeartbeat = function (e) {
  1465. e.sendAliAnalytic("/play.1.2")
  1466. }
  1467. }
  1468. return vodh5player.playerList = [],
  1469. vodh5player.workerWatcherVCList = [],
  1470. vodh5player.VJS_ADS_TIMEOUT = 6e3,
  1471. "jstest.v.cntv.cn" === document.domain ? vodh5player.RELEASE = !1 : vodh5player.RELEASE = !0,
  1472. vodh5player.DEV = !1,
  1473. !0 === vodh5player.RELEASE && (vodh5player.DEV = !1),
  1474. vodh5player.DEBUG_LABEL = "[vh5] ",
  1475. vodh5player.DEBUG = !1,
  1476. vodh5player.VERSION = "",
  1477. vodh5player.debugInfo = "",
  1478. vodh5player.enableVip = !1,
  1479. vodh5player.skipAdTip = !1,
  1480. vodh5player.DRM = !1,
  1481. vodh5player.TMP_DRM_CLOSE = !1,
  1482. vodh5player.enableQualityLock = !0,
  1483. vodh5player.DEFAULT_QUALITY_LABELS = ["SLD", "LD", "STD", "HD", "SD", "SHD", "720P", "1080P"],
  1484. vodh5player.DEFAULT_QUALITIES_DIVIDE = [0, 25e4, 5e5, 1e6, 15e5, 23e5, 4e6, 6e6, 1e7],
  1485. vodh5player.uniquelabel = !1,
  1486. vodh5player.PLAYER_TYPES = ["normal", "4k"],
  1487. vodh5player.DOMAIN = vodh5player.RELEASE ? "player.cntv.cn/h5vod/" : "jstest.v.cntv.cn/h5vod/",
  1488. vodh5player.rootDomain,
  1489. vodh5player.cdnDomain,
  1490. !0 === vodh5player.DEV && (vodh5player.DOMAIN = "jstest.v.cntv.cn/h5vod/dev/"),
  1491. vodh5player.HTTP_PRE = "https://",
  1492. vodh5player.VDN_AD_URL = "vdn.apps.cntv.cn/api/getVideoInfoAd.do?",
  1493. vodh5player.AD_VDN_TIME_OUT = 6e3,
  1494. vodh5player.VDN_URL = "vdn.apps.cntv.cn/api/getHttpVideoInfo.do?",
  1495. vodh5player.VDN_PARA1 = "&client=flash&im=0",
  1496. vodh5player.VDN_AD_STATIC_CHECK = "47899B86370B879139C08EA3B5E88267",
  1497. vodh5player.PLAYER_NAME = vodh5player.DRM ? "HTML5_VOD_DRM_PLAYER" : "HTML5_VOD_PLAYER",
  1498. vodh5player.PLAY_SCENE = "HTML5.PC",
  1499. vodh5player.APP_NAME = "WEB.HTML5.PC",
  1500. vodh5player.CONFIG_URL = "h5vodconfig.json",
  1501. vodh5player.H5_WORKER = "h5.worker",
  1502. vodh5player.workIsLoading = !1,
  1503. vodh5player.workerLoaded = !1,
  1504. vodh5player.H5_WORKER_NAME = "vodh5_" + vodh5player.H5_WORKER,
  1505. vodh5player.workerModuleInitialized = !1,
  1506. vodh5player.getWorkerStatus = function () {
  1507. var e = {}
  1508. , a = !1
  1509. , r = !1;
  1510. return Object.defineProperty(e, "workertimeout", {
  1511. get: function () {
  1512. return r
  1513. },
  1514. set: function (e) {
  1515. e ? (r = e,
  1516. vodh5player.workerWatcherVCList.forEach(function (e) {
  1517. console.log(e.id),
  1518. e.workerTimeroutError()
  1519. })) : console.log("only TRUE can be set to this value!")
  1520. }
  1521. }),
  1522. Object.defineProperty(e, "initialized", {
  1523. get: function () {
  1524. return a
  1525. },
  1526. set: function (e) {
  1527. e ? (a = e,
  1528. vodh5player.workerWatcherVCList.forEach(function (e) {
  1529. console.log(e.id),
  1530. e.loadChecker()
  1531. })) : console.log("only TRUE can be set to this value!")
  1532. }
  1533. })
  1534. }
  1535. ,
  1536. vodh5player.workerStatus = vodh5player.getWorkerStatus(),
  1537. vodh5player.WORKER_TIMEOUT = 6e3,
  1538. vodh5player.styleLoaded = !1,
  1539. vodh5player.P2P = !1,
  1540. vodh5player.HLSP2P = "hlsp2p.js",
  1541. vodh5player.hlsp2pLoaded = !1,
  1542. vodh5player.HLSP2P_NAME = "vodh5_" + vodh5player.HLSP2P,
  1543. vodh5player.HLSP2P_HAS_INSTANCE_RUNNING = !1,
  1544. vodh5player.CHOOSE_VIDEO_URL = "api.cntv.cn/NewVideo/getVideoListByPrimaryPageId?mode=2&sort=asc&n=96&p=1&serviceId=panda",
  1545. vodh5player.CHOOSE_VIDEO_NAME = "vodh5_choosevideo",
  1546. vodh5player.BARRAGE_CONFIG_URL = "www.cntv.cn/pinglun/liuyan/2019dmbq/index.json",
  1547. vodh5player.convivaOn = !1,
  1548. vodh5player.CONVIVA_URL_1 = "conviva/conviva-core-sdk.js",
  1549. vodh5player.CONVIVA_URL_2 = "conviva/conviva-videojs-module.js",
  1550. vodh5player.CONVIVA_URL_3 = "conviva/conviva-vod.js",
  1551. vodh5player.CONVIVA_URL_NAME_1 = "vod-conviva-core-sdk-4-0-4",
  1552. vodh5player.CONVIVA_URL_NAME_2 = "vod-conviva-videojs-module-4-0-4",
  1553. vodh5player.CONVIVA_URL_NAME_3 = "vod-conviva-cctv-4-0-4",
  1554. vodh5player.alianalyicsOn = !0,
  1555. vodh5player.ALI_ANALYTICS_DOMAIN = "js.data.cctv.com",
  1556. vodh5player.ALI_ANALYTICS_URL = "/__aplus_plugin_cctv.js,aplus_plugin_aplus_u.js",
  1557. vodh5player.ALI_ANALYTICS_NAME = "aliAnalyticsJs237",
  1558. vodh5player.ALI_ANALYTICS_ERROR_CODE_1_24_P2P = "10002",
  1559. vodh5player.ALI_ANALYTICS_ERROR_CODE_1_24_JSON_PARSE = "998",
  1560. vodh5player.ALI_ANALYTICS_ERROR_CODE_1_24_TIMEOUT = "999",
  1561. vodh5player.ALI_ANALYTICS_ERROR_CODE_1_24_OTHER = "10000",
  1562. vodh5player.ALI_ANALYTICS_ERROR_CODE_1_24_COPYRIGHT = "10001",
  1563. vodh5player.FINGERPRINT2_URL = "js.player.cntv.cn/creator/fingerprint2.js",
  1564. vodh5player.FINGERPRINT2_NAME = "jsFingerLoader",
  1565. vodh5player.VIDEO_SNAP_URL = "",
  1566. vodh5player.ALI_HEARTBEAT = 20,
  1567. vodh5player.isSafari = -1 < navigator.userAgent.indexOf("Safari") && -1 == navigator.userAgent.indexOf("Chrome"),
  1568. vodh5player.ERROR_CODE = ["0001", "0002", "0003", "0004", "0005", "0006", "0007", "0008", "0009", "0010"],
  1569. vodh5player.ERROR_CODE = ["0001", "0002", "0003", "0004", "0005", "0006", "0007", "0008", "0009", "0010"],
  1570. vodh5player.namespace = getvodplayerNS(),
  1571. vodh5player.namespace.addConfig = function (e) {
  1572. console.warn(vodh5player.DEBUG_LABEL + "addConfig" + e)
  1573. }
  1574. ,
  1575. vodh5player.namespace.pauseAllPlayer = function (e) {
  1576. vodh5player.playerList;
  1577. for (var a = 0; a < vodh5player.playerList.length; a++)
  1578. vodh5player.playerList[a].group === e && vodh5player.playerList[a].pause()
  1579. }
  1580. ,
  1581. vodh5player.namespace.debug = function (e) {
  1582. vodh5player.DEBUG = !0 === e
  1583. }
  1584. ,
  1585. vodh5player.namespace.getVodPlayer = function (e) {
  1586. if (0 === vodh5player.playerList.length)
  1587. return console.warn(vodh5player.DEBUG_LABEL + "there is no players"),
  1588. null;
  1589. if (void 0 === e)
  1590. return vodh5player.playerList[vodh5player.playerList.length - 1];
  1591. for (var a, r = vodh5player.playerList.length, t = 0; t < r; t++)
  1592. if ((a = vodh5player.playerList[t]) && a.id === e)
  1593. return a
  1594. }
  1595. ,
  1596. vodh5player.namespace.getVodPlayers = function () {
  1597. return vodh5player.playerList
  1598. }
  1599. ,
  1600. vodh5player.namespace.createVodPlayer = function (e) {
  1601. var a = ""
  1602. , a = "\n H5vodplayer Release Wrapper:" + wrapperversion + "\n"
  1603. , a = (vodh5player.RELEASE ? window$1.console.log("%c " + a, "color:#2a9934;font-size:8pt;letter-spacing:12pt;line-height:8pt;font-weight:bold;font-family:monospace;") : window$1.console.log("%c " + (a = "\n H5vodplayer DEBUG Wrapper:" + wrapperversion + " warn this`s debug version!\n"), "color:#ff6868;font-size:8pt;letter-spacing:12pt;line-height:8pt;font-weight:bold;font-family:monospace;"),
  1604. vodh5player.trace("vodh5player creating...", !1, e.divId),
  1605. {})
  1606. , r = navigator.userAgent.toLowerCase()
  1607. , t = ((t = r.match(/msie ([\d.]+)/)) ? a.ie = t[1] : (t = r.match(/firefox\/([\d.]+)/)) ? a.firefox = t[1] : (t = r.match(/chrome\/([\d.]+)/)) ? a.chrome = t[1] : (t = r.match(/opera.([\d.]+)/)) ? a.opera = t[1] : (t = r.match(/version\/([\d.]+).*safari/)) && (a.safari = t[1]),
  1608. vodh5player.isSafari && (vodh5player.versionSafari = a.safari),
  1609. vodh5player.rootDomain = document.domain.split(".").slice(-2).join("."),
  1610. "com.cn" === vodh5player.rootDomain && (vodh5player.rootDomain = document.domain.split(".").slice(-3).join(".")),
  1611. -1 < navigator.userAgent.indexOf("Edge") || navigator.userAgent.indexOf("Edg"),
  1612. "undefined" != typeof Conviva && void 0 === Conviva.Analytics && (vodh5player.trace("there is conviva left, clearing ..."),
  1613. Conviva = void 0),
  1614. "function" != typeof getCookie_vdn ? (window.console.warn(vodh5player.DEBUG_LABEL + "lost getCookie_vdn(), check if the dependent file vodplayer.js exist"),
  1615. void 0 === vodh5player.getCookie_vdn("Fingerprint") || "" === vodh5player.getCookie_vdn("Fingerprint") ? vodh5player.trace("create new fingerprint") : e.fingerprint_uid = vodh5player.getCookie_vdn("Fingerprint")) : void 0 === getCookie_vdn("Fingerprint") || "" === getCookie_vdn("Fingerprint") ? vodh5player.trace("create new fingerprint") : e.fingerprint_uid = getCookie_vdn("Fingerprint"),
  1616. new VodConstructer(e.divId));
  1617. if (t.paramTranslation(e),
  1618. !isWasmSupported())
  1619. return vodh5player.wasmSupported_ = !1,
  1620. window$1.console.warn("不支持wasm"),
  1621. (a = document.createElement("link")).type = "text/css",
  1622. a.rel = "stylesheet",
  1623. a.href = vodh5player.HTTP_PRE + vodh5player.DOMAIN + "./css/vodh5player-v2.min.css",
  1624. document.getElementsByTagName("head")[0].appendChild(a),
  1625. (a = document.getElementById(e.divId)).className = "vdn-novideo-error pic_box",
  1626. void ("micromessenger" == r.match(/MicroMessenger/i) && "windows" == r.match(/Windows/i) ? a.innerHTML = "<div style='height:50px; top:40%; position: relative;'>您当前的浏览器不支持视频播放 <br><br> 请使用外部浏览器观看 <br><br> (如果是360、QQ或搜狗浏览器,须使用极速模式观看)</div>" : a.innerHTML = "<div style='height:50px; top:45%; position: relative;'>您当前的浏览器无法支持该视频播放 <br><br> 请到浏览器官方网站更新版本,或更换其他浏览器和设备</div>");
  1627. vodh5player.wasmSupported_ = !0,
  1628. t.loadCore(),
  1629. vodh5player.loadAliAnalyticsJs()
  1630. }
  1631. ,
  1632. vodh5player.namespace.dispose = function (e, a) {
  1633. console.log('进来----------------------');
  1634. vodh5player.trace("disposing ... disposePlugin:" + a),
  1635. e.shellstructure.dispose(a);
  1636. for (var r = !1, t = vodh5player.playerList.length - 1; 0 <= t; t--)
  1637. if (vodh5player.playerList[t] === e) {
  1638. vodh5player.playerList.splice(t, 1),
  1639. r = !0;
  1640. break
  1641. }
  1642. r || console.warn("disposing player isnt in the playerlist")
  1643. }
  1644. ,
  1645. vodh5player.getHostName = function (e) {
  1646. var a;
  1647. return -1 < e.indexOf("//") ? (a = e.indexOf("/", 8),
  1648. e.substring(0, a)) : ""
  1649. }
  1650. ,
  1651. vodh5player.getdomain = function (e) {
  1652. return document.domain
  1653. }
  1654. ,
  1655. vodh5player.xhrRequest = function (r) {
  1656. if ("[object Object]" === String(r)) {
  1657. r.method = r.method ? r.method.toUpperCase() : "GET",
  1658. r.data = r.data || {};
  1659. var e, a = [];
  1660. for (e in r.data)
  1661. a.push("".concat(e, "=", r.data[e]));
  1662. r.data = a.join("&"),
  1663. "GET" === r.method && 0 < r.data.length && (r.url += 0 === location.search.length ? "".concat("?", r.data) : "".concat("&", r.data));
  1664. var t = new XMLHttpRequest;
  1665. t.responseType = r.responseType || "json",
  1666. t.onreadystatechange = function () {
  1667. 4 === t.readyState && (200 === t.status ? r.success && "function" == typeof r.success && r.success(t.response, r.customPara, t.getAllResponseHeaders()) : r.error && "function" == typeof r.error && r.error())
  1668. }
  1669. ,
  1670. t.open(r.method, r.url, !0),
  1671. void 0 !== r.timeout && (t.timeout = r.timeout),
  1672. t.ontimeout = function (e) {
  1673. var a;
  1674. r.ontimeout && "function" == typeof r.ontimeout && ((a = {}).url = r.url,
  1675. r.ontimeout(a))
  1676. }
  1677. ,
  1678. "POST" === r.method && t.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"),
  1679. void 0 !== r.vtoken && "" !== r.vtoken && t.setRequestHeader("vtoken", r.vtoken),
  1680. t.send("POST" === r.method ? r.data : null)
  1681. }
  1682. }
  1683. ,
  1684. vodh5player.loadScript = function (e, a, r, t, o) {
  1685. var d = document.getElementsByTagName("head")[0]
  1686. , i = document.createElement("script");
  1687. i.type = "text/javascript",
  1688. i.onload = function () {
  1689. "function" == typeof a && (o ? setTimeout(function () {
  1690. a(r)
  1691. }, o) : a(r))
  1692. }
  1693. ,
  1694. i.onreadystatechange = function () {
  1695. (8 < clientInfo.broserVersion && 4 == i.readyState && 200 == i.status || clientInfo.broserVersion <= 8 && ("loaded" == i.readyState || "complete" == i.readyState)) && "function" == typeof a && (o ? setTimeout(function () {
  1696. a(r)
  1697. }, o) : a(r))
  1698. }
  1699. ,
  1700. i.onerror = function () {
  1701. "function" == typeof t && t(r)
  1702. }
  1703. ,
  1704. i.src = e,
  1705. d.appendChild(i)
  1706. }
  1707. ,
  1708. vodh5player.createElementByType = function (e, a, r, t, o, d, i) {
  1709. e = document.createElement(e);
  1710. return e.setAttribute("id", a),
  1711. e.style.position = r,
  1712. e.style.width = t,
  1713. e.style.height = o,
  1714. e.style.left = d,
  1715. e.style.top = i,
  1716. e
  1717. }
  1718. ,
  1719. vodh5player.removeElementById = function (e) {
  1720. e = document.getElementById(e);
  1721. null !== e && e.parentNode.removeChild(e)
  1722. }
  1723. ,
  1724. vodh5player.loadAliAnalyticsJs = function () {
  1725. var e;
  1726. null === document.getElementById(vodh5player.ALI_ANALYTICS_NAME) && (0 < ["ipanda.cn", "cctv.cn"].indexOf(vodh5player.rootDomain) && (vodh5player.ALI_ANALYTICS_DOMAIN = "js.data.cctv.cn"),
  1727. (e = vodh5player.createElementByType("script", "", "absolute", "0px", "0px", "0px", "0px")).src = vodh5player.HTTP_PRE + vodh5player.ALI_ANALYTICS_DOMAIN + vodh5player.ALI_ANALYTICS_URL,
  1728. document.getElementsByTagName("head")[0].appendChild(e),
  1729. e.onload = function () {
  1730. e.id = vodh5player.ALI_ANALYTICS_NAME
  1731. }
  1732. )
  1733. }
  1734. ,
  1735. vodh5player.getCookie_vdn = function (e) {
  1736. var a = "";
  1737. if (document.cookie)
  1738. for (var r = document.cookie.split("; "), t = 0; t < r.length; t++) {
  1739. var o = r[t].split("=");
  1740. if (o[0] == e) {
  1741. a = o[1].toString();
  1742. break
  1743. }
  1744. }
  1745. a += "";
  1746. try {
  1747. (!a || a.length < 20) && window.localStorage && (a = localStorage[e] || "")
  1748. } catch (e) {
  1749. a = ""
  1750. }
  1751. return a
  1752. }
  1753. ,
  1754. vodh5player.getFingerprint = function () {
  1755. (new Fingerprint2).get(function (e) {
  1756. vodh5player.setCookie_vdn("Fingerprint", e.toUpperCase(), 7)
  1757. })
  1758. }
  1759. ,
  1760. vodh5player.setCookie_vdn = function (e, a, r) {
  1761. var t;
  1762. r ? ((t = new Date).setTime(t.getTime() + 24 * r * 60 * 60 * 1e3),
  1763. document.cookie = e + "=" + a + ";expires=" + t.toGMTString()) : document.cookie = e + "=" + a;
  1764. try {
  1765. window.localStorage && localStorage.setItem(e, a)
  1766. } catch (e) { }
  1767. }
  1768. ,
  1769. vodh5player.getfingerprint2 = function () {
  1770. var e = document.getElementsByTagName("head")[0]
  1771. , a = vodh5player.createElementByType("script", vodh5player.FINGERPRINT2_NAME, "absolute", "0px", "0px", "0px", "0px");
  1772. a.src = vodh5player.HTTP_PRE + vodh5player.FINGERPRINT2_URL,
  1773. e.appendChild(a),
  1774. void 0 !== a.onload && (a.onload = function () {
  1775. getFingerprint()
  1776. }
  1777. ),
  1778. void 0 !== a.onreadystatechange && (a.onreadystatechange = function () {
  1779. "loaded" != a.readyState && "complete" != a.readyState || getFingerprint()
  1780. }
  1781. )
  1782. }
  1783. ,
  1784. vodh5player.trace = function (e, a, r) {
  1785. var t = new Date
  1786. , t = vodh5player.DEBUG_LABEL + "> " + t.getHours() + ":" + t.getMinutes() + ":" + t.getSeconds() + ":" + t.getMilliseconds();
  1787. r && (t += " {" + r + "}"),
  1788. t += " " + e,
  1789. vodh5player.DEBUG ? a ? window$1.console.warn(t) : window$1.console.log(t) : a && window$1.console.warn(t),
  1790. vodh5player.debugInfo += t + "\r\n"
  1791. }
  1792. ,
  1793. vodh5player
  1794. });