gh-camp-video-portal/public/lib/trtc/TcPlayer-2.3.2.js

5 lines
96 KiB
JavaScript
Raw Normal View History

2025-05-21 10:20:18 +08:00
/* eslint-disable */
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var i=t();for(var o in i)("object"==typeof exports?exports:e)[o]=i[o]}}(this,function(){return function(e){function t(o){if(i[o])return i[o].exports;var n=i[o]={exports:{},id:o,loaded:!1};return e[o].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var i={};return t.m=e,t.c=i,t.p="//imgcache.qq.com/open/qcloud/video/vcplayer/",t(0)}([function(e,t,i){"use strict";function o(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t["default"]=e,t}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e,t){if(d.IS_MOBILE?(e.flash=!1,d.IS_X5TBS&&e.x5_player?b.mobile=["flv","m3u8","mp4"]:d.IS_ENABLED_MSE&&e.h5_flv&&(b.mobile=["flv","m3u8","mp4"])):(e.flash=!!t.isFormat("rtmp")||e.flash,t.isFormat("flv")&&void 0==e.flash&&(e.flash=!0),e.flash?d.IS_ENABLED_FLASH||(e.flash=!1,d.IS_ENABLED_MSE?e.h5_flv&&(d.IS_SAFARI&&A.compareVersion(d.SAFARI_VERSION,"10.1")>-1||!d.IS_SAFARI)?b.pc=["flv","m3u8","mp4"]:b.pc=["m3u8","mp4"]:b.pc=["mp4"]):d.IS_ENABLED_MSE?e.h5_flv&&(d.IS_SAFARI&&A.compareVersion(d.SAFARI_VERSION,"10.1")>-1||!d.IS_SAFARI)?b.pc=["flv","m3u8","mp4"]:b.pc=["m3u8","mp4"]:d.IS_ENABLED_FLASH?e.flash=!0:b.pc=["mp4"]),e.clarity){var i=M.indexOf(e.clarity);M.splice(i,1),M.unshift(e.clarity)}}function l(e){var t={urls:{m3u8:{od:e.m3u8||"",hd:e.m3u8_hd||"",sd:e.m3u8_sd||""},flv:{od:e.flv||"",hd:e.flv_hd||"",sd:e.flv_sd||""},mp4:{od:e.mp4||"",hd:e.mp4_hd||"",sd:e.mp4_sd||""},rtmp:{od:e.rtmp||"",hd:e.rtmp_hd||"",sd:e.rtmp_sd||""}},isClarity:function(e){var i=t.urls;return!!(i.m3u8[e]||i.flv[e]||i.mp4[e]||i.rtmp[e])},isFormat:function(e){var i=t.urls;return!!i[e].od||!!i[e].hd||!!i[e].sd},hasUrl:function(){return this.isFormat("rtmp")||this.isFormat("flv")||this.isFormat("m3u8")||this.isFormat("mp4")}};t.definitions=[];for(var i=0;i<M.length;i++)t.isClarity(M[i])&&t.definitions.push(M[i]);a(e,t);var o=p(t);return o&&(t.curUrl=o.url,t.curDef=o.definition,t.curFormat=o.format),t}function c(e,t,i){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:b,n="",r=void 0;i=i||(d.IS_MOBILE?o.mobile:o.pc);for(var s=0;s<i.length;s++)if(n=i[s],e[n][t]){r={definition:t,url:e[n][t],format:n};break}return r}function u(e,t){for(var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:M,o="",n=0;n<i.length;n++)if(o=i[n],e[t][o])return{definition:o,url:e[t][o]}}function p(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:b,i=void 0,o="",n=e.urls,r=d.IS_MOBILE?t.mobile:t.pc,s=0;s<r.length;s++)if(o=r[s],e.isFormat(o)){i=u(n,o),i.format=o;break}return i}t.__esModule=!0,t.TcPlayer=void 0;var h=i(1),d=o(h),f=i(2),y=(o(f),i(3)),A=o(y),v=i(4),m=o(v),g=i(5),w=m.MSG,b={mobile:["m3u8","mp4"],pc:["rtmp","flv","m3u8","mp4"]},M=["od","hd","sd"];t.TcPlayer=function(e){function t(i,o){n(this,t);var s=l(o);M=["od","hd","sd"];var a={owner:i,videoSource:s,src:s.curUrl,autoplay:o.autoplay,live:o.live,flash:o.flash,flashUrl:o.flashUrl,poster:o.poster,width:o.width,height:o.height,volume:o.volume,listener:o.listener,wording:o.wording,controls:o.controls,clarity:o.clarity,clarityLabel:o.clarityLabel,showLoading:"boolean"!=typeof o.showLoading||o.showLoading,pausePosterEnabled:void 0===o.pausePosterEnabled||o.pausePosterEnabled,fullscreenEnabled:void 0===o.fuScrnEnabled||o.fuScrnEnabled,systemFullscreen:o.systemFullscreen||!1,hls:o.hls||"0.12.4",h5_flv:o.h5_flv,x5_player:o.x5_player!==!1,x5_type:o.x5_ty
},function(e,t){e.exports="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB2aWV3Qm94PSIwIDAgMzYgMzYiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+DQogICAgPHBhdGggZD0iTTExLDEwIEwxNywxMCAxNywyNiAxMSwyNiBNMjAsMTAgTDI2LDEwIDI2LDI2IDIwLDI2IiBmaWxsPSIjZmZmIj48L3BhdGg+DQo8L3N2Zz4="},function(e,t){e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAQAAAD9CzEMAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAAAFoAAABaAHAjuH0AAAAHdElNRQfgBRQTADNsu4KlAAAAfklEQVRYw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9Ik0xOS42MywxNS45MiBMMjAuNjgsMTQuOTMgTDIyLjgxLDE2Ljk0IEwyNC45NCwxNC45MyBMMjYsMTUuOTIgTDIzLjg2LDE3LjkzIEwyNiwxOS45MyBMMjQuOTQsMjAuOTIgTDIyLjgxLDE4LjkyIEwyMC42OCwyMC45MiBMMTkuNjMsMTkuOTMgTDIxLjc2LD
this.pub({type:p.MSG.Progress,src:this,ts:+new Date})),this.__bytesloaded>=this.__bytesTotal&&this.endPolling())},t.prototype.destroy=function(){"undefined"!=typeof this.el&&"undefined"!=typeof this.el.destroy&&this.el.destroy(),this.endPolling(),delete window[this.__flashCB].fnObj[this.__id],e.prototype.destroy.call(this)},t.prototype.notify=function(e,t){var i={type:e,ts:+new Date};try{switch(this.options.debug&&this.pub({type:i.type,src:this,ts:i.ts,detail:y.extend({debug:!0},t)}),i.type){case"ready":if(this.el=l(this.__id),this.setup(),g.IS_FIREFOX){var o=this;setTimeout(function(){o.el.setAutoPlay(!!o.options.autoplay),o.__timebase=new Date-t.time,o.load(o.options.src)},0)}else this.el.setAutoPlay(!!this.options.autoplay),this.__timebase=new Date-t.time,this.load(this.options.src);return;case"metaData":i.type=p.MSG.MetaLoaded,this.__videoWidth=t.videoWidth,this.__videoHeight=t.videoHeight,this.__duration=t.duration,this.__bytesTotal=t.bytesTotal,this.__prevPlayState=null,this.__m3u8=t.type===y.VideoType.M3U8,this.__rtmp=t.type===y.VideoType.RTMP,this.__type=t.type,this.__metaloaded=!0,this.metaDataLoaded=!0,this.doPolling();var o=this;if(!o.cover)break;setTimeout(function(){o.cover&&(o.owner.removeChild(o.cover),o.cover=null)},500);break;case"playState":this.playState=t.playState,t.playState==v.PlayStates.PLAYING?(this.__playing=!0,this.__stopped=!1,i.type=p.MSG.Play):t.playState==v.PlayStates.PAUSED?(this.__playing=!1,this.__stopped=!1,i.type=p.MSG.Pause):t.playState==v.PlayStates.STOP?(this.__playing=!1,this.__stopped=!0,i.type=p.MSG.Ended,this.__prevPlayState=null,this.options.live&&(this.metaDataLoaded=!1)):t.playState==v.PlayStates.IDLE&&(this.__playing=!1,this.__stopped=!0,i.type=p.MSG.Ended);break;case"seekState":if(this.seekState=t.seekState,!this.__metaloaded)return;if(t.seekState==v.SeekStates.SEEKING)i.type=p.MSG.Seeking;else{if(t.seekState!=v.SeekStates.SEEKED)return;this.__m3u8||this.options.live||t.playState!=v.PlayStates.STOP||(this.play(),this.__prevPlayState=t.playState),this.__m3u8&&(i.type=p.MSG.Seeked)}break;case"netStatus":this.options.live||("NetStream.Buffer.Full"==t.code?(this.__prevPlayState==v.PlayStates.PAUSED||this.__prevPlayState==v.PlayStates.STOP,this.__prevPlayState=null,i.type=p.MSG.Seeked):"NetStream.Seek.Complete"==t.code),"NetConnection.Connect.Closed"==t.code&&(this.options.src.indexOf("rtmp://")>-1?this.playState==v.PlayStates.STOP?(i.type="error",t={code:13,reason:t.code}):(i.type="error",t={code:1002,reason:t.code}):this.playState=v.PlayStates.IDLE),"NetStream.Play.Stop"!=t.code&&"NetConnection.Connect.Success"!=t.code&&"NetConnection.Connect.Failed"!=t.code||(this.playState=v.PlayStates.IDLE);break;case"mediaTime":this.__videoWidth=t.videoWidth,this.__videoHeight=t.videoHeight,i.type=p.MSG.TimeUpdate;break;case"error":if("NetStream.Seek.InvalidTime"==t.code)return this.currentTime(t.details),!1;"NetStream.Play.StreamNotFound"==t.code&&this.pub({type:"netStatus",src:this,ts:i.ts,detail:t});var n=isNaN(parseInt(t.code))?1002:t.code,r=isNaN(parseInt(t.code))?t.code:t.msg,s=r.match(/#(\d+)/);s&&s[1]&&(n=s[1]),t={code:n,reason:r||""},this.metaDataLoaded=!1}var a="printLog"==e||"canPlay"==e;!a&&this.pub({type:i.type,src:this,ts:i.ts,detail:t})}catch(c){y.console.error(e+" "+i.type,c)}},t.prototype.handleMsg=function(e){},t.prototype.videoWidth=function(){return this.__videoWidth},t.prototype.videoHeight=function(){return this.__videoHeight},t.prototype.width=function(e){return"undefined"==typeof e?this.el&&this.el.width:(e="100%",this.el&&(this.el.width=e))},t.prototype.height=function(e){return"undefined"==typeof e?this.el&&this.el.height:(e="100%",this.el&&(this.el.height=e))},t.prototype.play=function(e){this.playState==v.PlayStates.PAUSED||this.playState==v.PlayStates.PLAYING||e?this.el.playerResume():this.playState!=v.PlayStates.PLAYING&&this.el.playerPlay()},t.prototype.togglePlay=function(){this.metaDataLoaded?this.playState==v.PlayStates.PAUSED?this.el.playerResume():this.playState==v.PlayStates.PLAYING?this.el.playerPause():this.playState==v.PlayStates.STOP?(this.currentT
if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var r=i(1),s=o(r),a=i(2),l=o(a),c=i(3),u=function(){function e(t,i){n(this,e),this.player=t,this.options=i,this.load()}return e.prototype.load=function(){l.loadScript((0,c.unifyProtocol)("//pingjs.qq.com/h5/stats.js?v2.0.4"),null,{name:"MTAH5",sid:"500376528",cid:"500383222"},!0)},e.prototype.report=function(){window.MtaH5&&(0==this.player.duration()||this.player.duration()==1/0?MtaH5.clickStat("live",{live:"true"}):MtaH5.clickStat("vod",{vod:"true"}))},e.prototype.reportFlash=function(){if(window.MtaH5){var e=this.options.videoSource,t=(0,c.getFormat)(e),i={browser:s.BROWSER_TYPE,mse:!!s.IS_ENABLED_MSE,format:t};MtaH5.clickStat("flash",i)}},e}();t["default"]=u}])});