@zhijiancloud/bpm 1.0.43 → 1.0.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.bpm2=e():t.bpm2=e()}(self,function(){return function(){"use strict";var t={7234:function(t,e,i){var s=i(1601),o=i.n(s),n=i(6314);i.n(n)()(o()).push([t.id,".bpm-video-dialog-fullscreen .el-dialog__header {\n display: none !important;\n}\n.bpm-video-dialog-fullscreen .el-dialog__body {\n padding: 0 !important;\n background-color: #000;\n height: 100vh;\n box-sizing: border-box;\n}\n.bpm-video-dialog-normal .el-dialog__body {\n padding: 0 !important;\n background-color: #000;\n height: 60vh;\n /* Default height for normal dialog */\n box-sizing: border-box;\n}\n.bpm-video-grid-item {\n width: 100%;\n height: 100%;\n overflow: hidden;\n position: relative;\n}\n",""])},6314:function(t){t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var i="",s=void 0!==e[5];return e[4]&&(i+="@supports (".concat(e[4],") {")),e[2]&&(i+="@media ".concat(e[2]," {")),s&&(i+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),i+=t(e),s&&(i+="}"),e[2]&&(i+="}"),e[4]&&(i+="}"),i}).join("")},e.i=function(t,i,s,o,n){"string"==typeof t&&(t=[[null,t,void 0]]);var r={};if(s)for(var l=0;l<this.length;l++){var a=this[l][0];null!=a&&(r[a]=!0)}for(var d=0;d<t.length;d++){var c=[].concat(t[d]);s&&r[c[0]]||(void 0!==n&&(void 0===c[5]||(c[1]="@layer".concat(c[5].length>0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=n),i&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=i):c[2]=i),o&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=o):c[4]="".concat(o)),e.push(c))}},e}},1601:function(t){t.exports=function(t){return t[1]}},4486:function(t,e,i){function s(t,e,i,s,o,n,r,l){var a,d="function"==typeof t?t.options:t;if(e&&(d.render=e,d.staticRenderFns=i,d._compiled=!0),s&&(d.functional=!0),n&&(d._scopeId="data-v-"+n),r?(a=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(r)},d._ssrRegister=a):o&&(a=l?function(){o.call(this,(d.functional?this.parent:this).$root.$options.shadowRoot)}:o),a)if(d.functional){d._injectStyles=a;var c=d.render;d.render=function(t,e){return a.call(e),c(t,e)}}else{var p=d.beforeCreate;d.beforeCreate=p?[].concat(p,a):[a]}return{exports:t,options:d}}i.d(e,{A:function(){return s}})}},e={};function i(s){var o=e[s];if(void 0!==o)return o.exports;var n=e[s]={id:s,exports:{}};return t[s](n,n.exports,i),n.exports}i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,{a:e}),e},i.d=function(t,e){for(var s in e)i.o(e,s)&&!i.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var s={};i.r(s),i.d(s,{default:function(){return O}});var o=function(){var t=this,e=t.$createElement;return(t._self._c||e)(t.curComponent,t._g(t._b({tag:"component",staticClass:"bpm-video",attrs:{value:t.curVal,fieldConf:t.fieldConf,row:t.row,mode:t.mode,uiType:t.uiType},on:{change:t.handleChange}},"component",t.$attrs,!1),t.$listeners))};o._withStripped=!0;var n=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"bpm-video-editor"},["dialog"!==t.videoUiType?i("div",{staticStyle:{"margin-top":"12px"}},t._l(t.localList,function(e,s){return i("div",{key:"pv-"+s,staticStyle:{"margin-bottom":"12px"}},[i("bpm-video-player",{attrs:{src:e.src,type:e.type||"auto",poster:e.poster,accessToken:e.access_token,autoplay:t.localConf.autoplay,controls:t.localConf.controls,loop:t.localConf.loop,volume:t.localConf.volume,playsinline:t.localConf.plays_in_line,width:t.localConf.width,height:t.localConf.height,customConfig:t.localConf.customConfig},on:{play:function(e){return t.$emit("play",{index:s})},pause:function(e){return t.$emit("pause",{index:s})},ended:function(e){return t.$emit("ended",{index:s})},error:function(e){return t.$emit("error",{index:s,error:e})},timeupdate:function(e){return t.$emit("timeupdate",{index:s,data:e})},ready:function(e){return t.$emit("ready",{index:s})}}})],1)}),0):["dialog"===t.videoUiType?i("i",{staticClass:"el-icon-video-play",style:{fontSize:"20px",color:t.localList.length>0?"#409EFF":"#909399",cursor:"pointer"},on:{click:function(e){e.stopPropagation(),t.localList.length>0&&(t.viewDialogVisible=!0)}}},[t._v(t._s(t.localList.length>1?t.localList.length:""))]):t._e(),t._v(" "),"dialog"===t.videoUiType?i("el-dialog",{attrs:{title:t.fieldConf.name||"视频播放",visible:t.viewDialogVisible,width:t.dialogWidth||"80%","append-to-body":"",fullscreen:t.isFullscreen,"show-close":!t.isFullscreen,"custom-class":t.isFullscreen?"bpm-video-dialog-fullscreen":"bpm-video-dialog-normal"},on:{"update:visible":function(e){t.viewDialogVisible=e},close:t.handleCloseDialog}},[t.isFullscreen?t._e():i("div",{staticClass:"bpm-video-dialog-title",attrs:{slot:"title"},slot:"title"},[i("span",[t._v(t._s(t.fieldConf.name||"视频播放"))]),t._v(" "),i("button",{staticClass:"el-dialog__headerbtn",staticStyle:{right:"50px"},attrs:{type:"button"},on:{click:t.toggleFullscreen}},[i("i",{staticClass:"el-icon-full-screen"})])]),t._v(" "),i("div",{staticClass:"bpm-video-grid-container",style:t.gridStyle},t._l(t.localList,function(e,s){return i("div",{key:"view-dlg-"+s,staticClass:"bpm-video-grid-item"},[i("bpm-video-player",{attrs:{src:e.src,type:e.type||"auto",poster:e.poster,accessToken:e.access_token,autoplay:t.localConf.autoplay,controls:t.localConf.controls,loop:t.localConf.loop,volume:t.localConf.volume,playsinline:t.localConf.plays_in_line,width:"100%",height:"100%",customConfig:t.localConf.customConfig},on:{play:function(e){return t.$emit("play",{index:s})},pause:function(e){return t.$emit("pause",{index:s})},ended:function(e){return t.$emit("ended",{index:s})},error:function(e){return t.$emit("error",{index:s,error:e})},timeupdate:function(e){return t.$emit("timeupdate",{index:s,data:e})},ready:function(e){return t.$emit("ready",{index:s})}}})],1)}),0)]):t._e()],t._v(" "),t.readonly?t._e():i("div",{staticClass:"editor-toolbar",staticStyle:{"margin-top":"12px"}},[i("el-button",{attrs:{type:"primary",size:"mini",icon:"el-icon-edit"},on:{click:t.openEditDialog}},[t._v("编辑视频源")])],1),t._v(" "),i("el-dialog",{attrs:{visible:t.editDialogVisible,title:"编辑视频源",width:"60%","append-to-body":""},on:{"update:visible":function(e){t.editDialogVisible=e}}},[i("el-form",{attrs:{"label-width":"120px",size:"small"}},[t._l(t.tempList,function(e,s){return i("div",{key:"card-"+s,staticStyle:{"margin-bottom":"12px"}},[i("el-card",{attrs:{shadow:"never"}},[i("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[i("span",[t._v("视频源 #"+t._s(s+1))]),t._v(" "),i("span",{staticStyle:{float:"right"}},[i("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(e){return t.removeItem(s)}}},[i("span",{staticStyle:{color:"red"}},[i("i",{staticClass:"el-icon-close"})])])],1)]),t._v(" "),i("el-form-item",{attrs:{label:"视频地址"}},[i("el-input",{attrs:{placeholder:"例如:ws://... 或 http(s)://... 或 webrtc://..."},model:{value:e.src,callback:function(i){t.$set(e,"src",i)},expression:"item.src"}})],1),t._v(" "),i("el-form-item",{attrs:{label:"封面图"}},[i("el-input",{attrs:{placeholder:"封面图 URL,可选"},model:{value:e.poster,callback:function(i){t.$set(e,"poster",i)},expression:"item.poster"}})],1)],1)],1)}),t._v(" "),i("el-button",{attrs:{type:"primary",size:"mini",icon:"el-icon-plus"},on:{click:t.addItem}},[t._v("添加视频")])],2),t._v(" "),i("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[i("el-button",{on:{click:function(e){t.editDialogVisible=!1}}},[t._v("取消")]),t._v(" "),i("el-button",{attrs:{type:"primary"},on:{click:t.confirmEdit}},[t._v("确认")])],1)],1)],2)};n._withStripped=!0;var r=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{style:t.containerStyle},[i("div",{attrs:{id:t.playerId}})])};r._withStripped=!0;let l=null,a=null,d=null,c=null,p=null,u=null,h=null,f=!1,m=!1,y=!1,v=!1,g=!1,C=!1,w=!1,b={},E=0,S=null,x=null;var $={name:"BpmVideoPlayer",props:{src:{type:[String,Object],default(){return""}},type:{type:String,default(){return"auto"}},poster:{type:String,default(){return""}},accessToken:{type:String,default(){return""}},autoplay:{type:Boolean,default(){return!1}},controls:{type:Boolean,default(){return!0}},loop:{type:Boolean,default(){return!1}},width:{type:[String,Number],default(){return"100%"}},height:{type:[String,Number],default(){return"100%"}},volume:{type:Number,default(){return.6}},playsinline:{type:Boolean,default(){return!0}},customConfig:{type:Object,default(){return{}}}},data(){return{player:null,playerId:"bpm-video-"+Math.random().toString(36).slice(2),videoEl:null}},computed:{containerStyle(){return{width:"number"==typeof this.width?this.width+"px":this.width,height:"number"==typeof this.height?this.height+"px":this.height}},normalizedUrl(){if("string"==typeof this.src)return this.src;if(Array.isArray(this.src)&&this.src.length>0){const t=this.src[0];if(t)return(t.src&&"string"==typeof t.src?t.src:"")||(t.url&&"string"==typeof t.url?t.url:"")}return this.src&&this.src.url?this.src.url:this.src&&this.src.src?this.src.src:""}},watch:{src(){this.reload()},type(){this.reload()},width(){this.reload()},height(){this.reload()}},mounted(){this.init()},beforeDestroy(){this.destroy()},methods:{loadScript(t){if(b[t])return b[t];const e=Array.from(document.getElementsByTagName("script")).find(e=>e.src&&-1!==e.src.indexOf(t));if(e)return e.dataset&&"true"===e.dataset.loaded?(b[t]=Promise.resolve(),b[t]):(b[t]=new Promise((t,i)=>{e.addEventListener("load",()=>{e.dataset&&(e.dataset.loaded="true"),t()}),e.addEventListener("error",t=>i(t))}),b[t]);const i=document.createElement("script");return i.src=t,i.async=!0,b[t]=new Promise((t,e)=>{i.onload=()=>{E>0&&(E--,0===E&&(S&&(window.define=S),x&&(window.module=x),S=null,x=null)),i.dataset&&(i.dataset.loaded="true"),t()},i.onerror=t=>{E>0&&(E--,0===E&&(S&&(window.define=S),x&&(window.module=x),S=null,x=null)),e(t)}}),0===E&&("function"==typeof window.define&&window.define.amd&&(S=window.define,window.define=void 0),"object"==typeof window.module&&window.module&&window.module.exports&&(x=window.module,window.module=void 0)),E++,document.head.appendChild(i),b[t]},async ensureDeps(){if(console.log("PlayerCtor:",l),!l){const t=this.customConfig&&this.customConfig.xgplayerJsUrl||"https://cdn.jsdelivr.net/npm/xgplayer@3.0.23/dist/index.min.js";m&&(window.Player||window.xgplayer)||(await this.loadScript(t),m=!0);let e=window.Player||window.xgplayer;console.log("PlayerCtor:",e),e&&e.default&&(e=e.default),l=e}if(!f){const t=this.customConfig&&this.customConfig.xgplayerCssUrl||"https://cdn.jsdelivr.net/npm/xgplayer@3.0.23/dist/index.min.css",e=document.createElement("link");e.rel="stylesheet",e.href=t,document.head.appendChild(e),f=!0}},async ensureMpegts(){if(p)return;const t=this.customConfig&&this.customConfig.mpegtsLibUrl||"https://cdn.jsdelivr.net/npm/mpegts.js@1.7.0/dist/mpegts.min.js";await new Promise((e,i)=>{const s=document.createElement("script");s.src=t,s.async=!0,s.onload=()=>e(),s.onerror=t=>i(t),document.head.appendChild(s)}),p=window.mpegts||window.Mpegts||null},async ensureEzopen(){if(u)return;const t=this.customConfig&&this.customConfig.ezuikitUrl||"https://open.ys7.com/sdk/js/1.3/ezuikit.js";C&&window.EZUIPlayer||(await this.loadScript(t),C=!0),u=window.EZUIPlayer},async ensureJsWebRtc(){if(h)return;const t=this.customConfig&&this.customConfig.jsWebRtcUrl||"https://cdn.jsdelivr.net/npm/jswebrtc@1.0.1/dist/jswebrtc.min.js";w&&window.JSWebrtc||(await this.loadScript(t),w=!0),h=window.JSWebrtc},async init(){const t=function(t,e){if(e&&"auto"!==e)return e;if(!t||"string"!=typeof t)return"mp4";const i=t.toLowerCase();return i.startsWith("ezopen://")?"ezopen":i.startsWith("webrtc://")?"webrtc":i.startsWith("rtsp://")?"rtsp":i.startsWith("rtp://")?"rtp":i.startsWith("rtmp://")||i.startsWith("rtmps://")?"rtmp":i.endsWith(".m3u8")?"hls":i.endsWith(".flv")?"flv":i.endsWith(".mpd")?"dash":"mp4"}(this.normalizedUrl,this.type);if(console.log("this.normalizedUrl:"+t),"ezopen"===t)return void await this.initEzopen();if("webrtc"===t)return void await this.initWebRtc();if("rtsp"===t||"rtp"===t)return void await this.initRtsp();await this.ensureDeps();const e=[];let i=this.normalizedUrl;if("hls"===t){if(!document.createElement("video").canPlayType("application/vnd.apple.mpegurl")){if(!a){const t=this.customConfig&&this.customConfig.hlsJsPluginUrl||"https://cdn.jsdelivr.net/npm/xgplayer-hls.js@3.0.23/dist/index.min.js";y&&window.HlsJsPlugin||(await this.loadScript(t),y=!0),a=window.HlsJsPlugin,a&&a.default&&(a=a.default)}a&&e.push(a)}}else if("flv"===t||"rtmp"===t){if(window.MediaSource||console.warn("Current browser does not support MediaSource Extensions (MSE), FLV playback may fail."),"rtmp"===t){if(console.log("this.customConfig:",this.customConfig),!this.customConfig||!this.customConfig.flvUrl)return void this.$emit("error",new Error("浏览器不支持 RTMP,请提供 flvUrl (HTTP-FLV/WS-FLV)"));i=this.customConfig.flvUrl}if(!d){const t=this.customConfig&&this.customConfig.flvJsPluginUrl||"https://cdn.jsdelivr.net/npm/xgplayer-flv.js@3.0.23/dist/index.min.js";v&&window.FlvJsPlugin||(await this.loadScript(t),v=!0),d=window.FlvJsPlugin,d&&d.default&&(d=d.default)}d&&e.push(d)}else if("dash"===t){if(!c){const t=this.customConfig&&this.customConfig.dashPluginUrl||"https://cdn.jsdelivr.net/npm/xgplayer-dash@3.0.0/dist/index.min.js";g&&window.DashPlugin||(await this.loadScript(t),g=!0),c=window.DashPlugin,c&&c.default&&(c=c.default)}e.push(c)}const s=Object.assign({id:this.playerId,url:i,poster:this.poster,autoplay:this.autoplay,controls:this.controls,loop:this.loop,volume:this.volume,playsinline:this.playsinline,width:this.width,height:this.height,plugins:e},this.customConfig||{});this.player=new l(s),this.bindEvents(),this.$emit("ready")},bindEvents(){this.player&&(this.player.on("play",()=>this.$emit("play")),this.player.on("pause",()=>this.$emit("pause")),this.player.on("ended",()=>this.$emit("ended")),this.player.on("error",t=>this.$emit("error",t)),this.player.on("timeupdate",t=>this.$emit("timeupdate",t)),this.player.on("waiting",()=>this.$emit("waiting")),this.player.on("fullscreenchange",t=>this.$emit("fullscreenChange",t)),this.player.on("definitionchange",t=>this.$emit("definitionChange",t)))},bindVideoEvents(){this.videoEl&&(this.videoEl.addEventListener("play",()=>this.$emit("play")),this.videoEl.addEventListener("pause",()=>this.$emit("pause")),this.videoEl.addEventListener("ended",()=>this.$emit("ended")),this.videoEl.addEventListener("waiting",()=>this.$emit("waiting")),this.videoEl.addEventListener("timeupdate",()=>this.$emit("timeupdate",{currentTime:this.videoEl.currentTime})),this.$emit("ready"))},async initRtsp(){try{await this.ensureMpegts()}catch(t){return void this.$emit("error",t)}const t=document.getElementById(this.playerId);if(!t)return;for(;t.firstChild;)t.removeChild(t.firstChild);const e=document.createElement("video");e.style.width="100%",e.style.height="100%",e.autoplay=!!this.autoplay,e.controls=!!this.controls,e.loop=!!this.loop,e.playsInline=!!this.playsinline,e.muted=!1,this.poster&&(e.poster=this.poster),t.appendChild(e),this.videoEl=e;const i=(()=>{const t=this.normalizedUrl||"";return/^ws(s)?:\/\//.test(t)||/^http(s)?:\/\//.test(t)?t:this.customConfig&&this.customConfig.mpegtsUrl?this.customConfig.mpegtsUrl:""})();if(!p||!i)return this.bindVideoEvents(),void this.$emit("error",new Error("RTSP/RTP 需要后端转码为 WebSocket/MPEG-TS,请提供 mpegtsUrl"));const s={isLive:!0,type:"mpegts",url:i},o=p.createPlayer(s,this.customConfig&&this.customConfig.mpegtsConfig||{});o.attachMediaElement(e),o.load(),this.player=o,this.bindVideoEvents(),this.autoplay&&Promise.resolve(e.play()).catch(()=>{})},async initWebRtc(){try{await this.ensureJsWebRtc()}catch(t){return void this.$emit("error",t)}if(!h)return void this.$emit("error",new Error("JSWebrtc load failed"));const t=document.getElementById(this.playerId);if(!t)return;for(;t.firstChild;)t.removeChild(t.firstChild);const e=document.createElement("video");e.style.width="100%",e.style.height="100%",e.autoplay=!!this.autoplay,e.controls=!!this.controls,e.loop=!!this.loop,e.playsInline=!!this.playsinline,this.poster&&(e.poster=this.poster),t.appendChild(e),this.videoEl=e;const i=this.normalizedUrl;this.player=new h.Player(i,{video:e,autoplay:this.autoplay,onPlay:t=>{console.log("JSWebrtc onPlay",t),this.$emit("play")},onPause:t=>{this.$emit("pause")}}),this.bindVideoEvents()},async initEzopen(){if(await this.ensureEzopen(),!u)return console.error("EZUIPlayer load failed"),void this.$emit("error",{message:"EZUIPlayer load failed"});const t=document.getElementById(this.playerId);if(!t)return;t.innerHTML="";let e=this.accessToken;!e&&"object"==typeof this.src&&this.src.accessToken&&(e=this.src.accessToken);let i=this.width,s=this.height;"string"==typeof i&&i.includes("%")&&(i=t.offsetWidth||600),"string"==typeof s&&s.includes("%")&&(s=t.offsetHeight||400),i=parseInt(i)||600,s=parseInt(s)||400,this.player=new u({id:this.playerId,url:this.normalizedUrl,accessToken:e,autoplay:this.autoplay,width:i,height:s,handleSuccess:()=>{console.log("EZUIKit play success"),this.$emit("play")},handleError:t=>{console.error("EZUIKit play error",t),this.$emit("error",t)}}),this.$emit("ready")},async reload(){this.destroy(),await this.init()},destroy(){if(this.player)if(this.player.destroy)try{this.player.destroy()}catch(t){}else if(this.player.stop)try{this.player.stop()}catch(t){}if(this.player=null,this.videoEl&&this.videoEl.parentNode){try{this.videoEl.pause()}catch(t){}this.videoEl.parentNode.removeChild(this.videoEl)}this.videoEl=null},play(){this.videoEl?this.videoEl.play():this.player&&this.player.play&&this.player.play()},pause(){this.videoEl?this.videoEl.pause():this.player&&this.player.pause&&this.player.pause()},seek(t){if(this.videoEl&&"number"==typeof t)try{this.videoEl.currentTime=t}catch(t){}else if(this.player&&"number"==typeof t)try{this.player.currentTime=t}catch(t){}},setVolume(t){this.videoEl&&"number"==typeof t?this.videoEl.volume=Math.max(0,Math.min(1,t)):this.player&&"number"==typeof t&&(this.player.volume=Math.max(0,Math.min(1,t)))},setPlaybackRate(t){this.videoEl&&"number"==typeof t?this.videoEl.playbackRate=t:this.player&&"number"==typeof t&&(this.player.playbackRate=t)}}},j=i(4486),V=(0,j.A)($,r,[],!1,null,null,null);V.options.__file="components/lib/bpmVideo/src/player.vue";var k={name:"BpmVideoEditor",components:{BpmVideoPlayer:V.exports},props:{value:{type:[String,Object,Array]},fieldConf:{type:Object,default(){return{}}},row:{type:Object,default(){return{}}},mode:{type:String,default(){return"edit"}},readonly:{type:Boolean,default:!1},uiType:{type:String,default(){return"normal"}}},data(){return{editDialogVisible:!1,viewDialogVisible:!1,localList:[],tempList:[],localConf:{type:"auto",autoplay:!0,controls:!0,loop:!1,volume:.6,plays_inline:!0,width:"100%",height:"360px",customConfig:{}},isFullscreen:!1}},computed:{dialogWidth(){return this.fieldConf.style.dialog_width||"80%"},videoUiType(){return"table"===this.uiType?"dialog":this.fieldConf.style.video_ui_type||"normal"},previewSrc(){return this.localList.length>0?this.localList[0].src||"":"string"==typeof this.value?this.value:this.value&&"object"==typeof this.value&&(this.value.src||this.value.url)||""},previewPoster(){return this.localList.length>0?this.localList[0].poster||"":this.value&&"object"==typeof this.value?this.value.poster||"":this.fieldConf&&"string"==typeof this.fieldConf.poster?this.fieldConf.poster:""},gridCols(){const t=this.localList.length;return t<=1?1:t<=4?2:t<=9?3:t<=16?4:5},gridStyle(){return{display:"grid",gridTemplateColumns:`repeat(${this.gridCols}, 1fr)`,gridTemplateRows:`repeat(${this.gridCols}, 1fr)`,gap:"0",width:"100%",height:"100%"}}},watch:{fieldConf:{handler(t){this.mergeConf(t)},immediate:!0,deep:!0},value:{handler(t){Array.isArray(t)?this.localList=t.map(t=>({src:t&&(t.src||t.url)||"",poster:t&&t.poster||"",access_token:t&&t.access_token||"",type:t&&t.type||"auto"})):this.localList="string"==typeof t?[{src:t,poster:"",access_token:"",type:"auto"}]:t&&"object"==typeof t?[{src:t.src||t.url||"",poster:t.poster||"",access_token:t.access_token||"",type:t.type||"auto"}]:[]},immediate:!0}},mounted(){document.addEventListener("keydown",this.handleEscKey)},beforeDestroy(){document.removeEventListener("keydown",this.handleEscKey)},methods:{handleEscKey(t){"Escape"===t.key&&this.isFullscreen&&(this.isFullscreen=!1)},handleCloseDialog(){this.isFullscreen=!1},toggleFullscreen(){this.isFullscreen=!this.isFullscreen},mergeConf(t){console.log("fieldConf",t);const e=t.style||{},i=Object.assign({},this.localConf,e);e&&void 0!==e.width&&(i.width=e.width),e&&void 0!==e.height&&(i.height=e.height),this.localConf=i},openEditDialog(){this.tempList=_.cloneDeep(this.localList),this.editDialogVisible=!0},addItem(){this.tempList.push({src:"",poster:"",access_token:"",type:"auto"})},removeItem(t){this.tempList.splice(t,1)},confirmEdit(){this.localList=_.cloneDeep(this.tempList),this.emitChange(),this.editDialogVisible=!1},emitChange(){const t=this.localList.map(t=>({src:t.src||"",poster:t.poster||"",access_token:t.access_token||"",type:t.type||"auto"}));this.$emit("input",t),this.$emit("change",t)}}},L=(i(7234),(0,j.A)(k,n,[],!1,null,null,null));L.options.__file="components/lib/bpmVideo/src/part/editor.vue";var P=L.exports,T=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"bpm-video-reader"},[i("bpm-video-editor",t._g({attrs:{value:t.sourcesList,fieldConf:t.fieldConf,row:t.row,mode:t.mode,uiType:t.uiType,readonly:!0}},t.$listeners))],1)};T._withStripped=!0;var U={name:"BpmVideoReader",components:{BpmVideoEditor:P},props:{value:{type:[String,Object,Array]},fieldConf:{type:Object,default(){return{}}},row:{type:Object,default(){return{}}},mode:{type:String,default(){return"view"}},uiType:{type:String,default(){return"normal"}}},computed:{sourcesList(){return Array.isArray(this.value)&&this.value.length>0?this.value.map(t=>({src:t&&(t.src||t.url)||"",poster:t&&t.poster||""})).filter(t=>t.src):this.fieldConf&&Array.isArray(this.fieldConf.src)&&this.fieldConf.src.length>0?this.fieldConf.src.map(t=>({src:t&&(t.src||t.url)||"",poster:t&&t.poster||""})).filter(t=>t.src):"string"==typeof this.value&&this.value?[{src:this.value,poster:this.fieldConf&&"string"==typeof this.fieldConf.poster?this.fieldConf.poster:""}]:this.fieldConf&&"string"==typeof this.fieldConf.src&&this.fieldConf.src?[{src:this.fieldConf.src,poster:this.fieldConf&&"string"==typeof this.fieldConf.poster?this.fieldConf.poster:""}]:this.fieldConf&&this.fieldConf.defaultSrc?[{src:this.fieldConf.defaultSrc,poster:this.fieldConf&&"string"==typeof this.fieldConf.poster?this.fieldConf.poster:""}]:[]}},vmounted(){console.log("this.fieldConf",this.fieldConf)}},I=(0,j.A)(U,T,[],!1,null,null,null);I.options.__file="components/lib/bpmVideo/src/part/reader.vue";var z=I.exports,A={name:"BpmVideo",components:{editorComponent:P,readerComponent:z},props:{value:{type:[String,Object,Array]},fieldConf:{type:Object,default(){return{}}},row:{type:Object,default(){return{}}},mode:{type:String,default(){return"view"}},uiType:{type:String,default(){return"normal"}}},data(){return{curVal:[]}},computed:{curComponent(){return"view"===this.mode?z:P}},watch:{value(){if(Array.isArray(this.value))this.curVal=this.value;else if("string"==typeof this.value&&this.value){const t=this.fieldConf&&"string"==typeof this.fieldConf.poster?this.fieldConf.poster:"";this.curVal=[{src:this.value,poster:t}]}else if(this.value&&"object"==typeof this.value){const t=this.value.src||this.value.url||"",e=this.value.poster||"";this.curVal=t?[{src:t,poster:e}]:[]}else this.curVal=[]}},mounted(){const t=!!this.fieldConf,e=void 0!==this.value?this.value:t&&void 0!==this.fieldConf.src?this.fieldConf.src:t&&this.fieldConf.defaultSrc?this.fieldConf.defaultSrc:"";if(Array.isArray(e))this.curVal=e;else if("string"==typeof e&&e){const i=t&&"string"==typeof this.fieldConf.poster?this.fieldConf.poster:"";this.curVal=[{src:e,poster:i}]}else if(e&&"object"==typeof e){const t=e.src||e.url||"",i=e.poster||"";this.curVal=t?[{src:t,poster:i}]:[]}else this.curVal=[]},methods:{handleChange(t){if(Array.isArray(t))return this.curVal=t,this.$emit("input",this.curVal),void this.$emit("change",this.curVal);if("string"==typeof t){const e=this.fieldConf&&"string"==typeof this.fieldConf.poster?this.fieldConf.poster:"";this.curVal=[{src:t,poster:e}]}else if(t&&"object"==typeof t){const e=t.src||t.url||"",i=t.poster||"";this.curVal=e?[{src:e,poster:i}]:[]}else this.curVal=[];this.$emit("input",this.curVal),this.$emit("change",this.curVal)}}},D=(0,j.A)(A,o,[],!1,null,null,null);D.options.__file="components/lib/bpmVideo/src/main.vue";var W=D.exports;W.install=function(t){t.component(W.name,W)};var O=W;return s}()});
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.bpm2=e():t.bpm2=e()}(self,function(){return function(){var t,e,i={7234:function(t,e,i){"use strict";var o=i(1601),s=i.n(o),n=i(6314);i.n(n)()(s()).push([t.id,".bpm-video-dialog-fullscreen .el-dialog__header {\n display: none !important;\n}\n.bpm-video-dialog-fullscreen .el-dialog__body {\n padding: 0 !important;\n background-color: #000;\n height: 100vh;\n box-sizing: border-box;\n}\n.bpm-video-dialog-normal .el-dialog__body {\n padding: 0 !important;\n background-color: #000;\n height: 60vh;\n /* Default height for normal dialog */\n box-sizing: border-box;\n}\n.bpm-video-grid-item {\n width: 100%;\n height: 100%;\n overflow: hidden;\n position: relative;\n}\n",""])},6314:function(t){"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var i="",o=void 0!==e[5];return e[4]&&(i+="@supports (".concat(e[4],") {")),e[2]&&(i+="@media ".concat(e[2]," {")),o&&(i+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),i+=t(e),o&&(i+="}"),e[2]&&(i+="}"),e[4]&&(i+="}"),i}).join("")},e.i=function(t,i,o,s,n){"string"==typeof t&&(t=[[null,t,void 0]]);var r={};if(o)for(var l=0;l<this.length;l++){var a=this[l][0];null!=a&&(r[a]=!0)}for(var d=0;d<t.length;d++){var c=[].concat(t[d]);o&&r[c[0]]||(void 0!==n&&(void 0===c[5]||(c[1]="@layer".concat(c[5].length>0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=n),i&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=i):c[2]=i),s&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=s):c[4]="".concat(s)),e.push(c))}},e}},1601:function(t){"use strict";t.exports=function(t){return t[1]}},4486:function(t,e,i){"use strict";function o(t,e,i,o,s,n,r,l){var a,d="function"==typeof t?t.options:t;if(e&&(d.render=e,d.staticRenderFns=i,d._compiled=!0),o&&(d.functional=!0),n&&(d._scopeId="data-v-"+n),r?(a=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),s&&s.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(r)},d._ssrRegister=a):s&&(a=l?function(){s.call(this,(d.functional?this.parent:this).$root.$options.shadowRoot)}:s),a)if(d.functional){d._injectStyles=a;var c=d.render;d.render=function(t,e){return a.call(e),c(t,e)}}else{var u=d.beforeCreate;d.beforeCreate=u?[].concat(u,a):[a]}return{exports:t,options:d}}i.d(e,{A:function(){return o}})},5344:function(t){t.exports=function(){return this.jQuery}()}},o={};function s(t){var e=o[t];if(void 0!==e)return e.exports;var n=o[t]={id:t,exports:{}};return i[t].call(n.exports,n,n.exports,s),n.exports}s.m=i,s.amdO={},s.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return s.d(e,{a:e}),e},s.d=function(t,e){for(var i in e)s.o(e,i)&&!s.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},s.f={},s.e=function(t){return Promise.all(Object.keys(s.f).reduce(function(e,i){return s.f[i](t,e),e},[]))},s.u=function(t){return t+".umd.js"},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),s.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},t={},e="bpm2:",s.l=function(i,o,n,r){if(t[i])t[i].push(o);else{var l,a;if(void 0!==n)for(var d=document.getElementsByTagName("script"),c=0;c<d.length;c++){var u=d[c];if(u.getAttribute("src")==i||u.getAttribute("data-webpack")==e+n){l=u;break}}l||(a=!0,(l=document.createElement("script")).charset="utf-8",s.nc&&l.setAttribute("nonce",s.nc),l.setAttribute("data-webpack",e+n),l.src=i),t[i]=[o];var p=function(e,o){l.onerror=l.onload=null,clearTimeout(h);var s=t[i];if(delete t[i],l.parentNode&&l.parentNode.removeChild(l),s&&s.forEach(function(t){return t(o)}),e)return e(o)},h=setTimeout(p.bind(null,void 0,{type:"timeout",target:l}),12e4);l.onerror=p.bind(null,l.onerror),l.onload=p.bind(null,l.onload),a&&document.head.appendChild(l)}},s.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},function(){var t;s.g.importScripts&&(t=s.g.location+"");var e=s.g.document;if(!t&&e&&(e.currentScript&&"SCRIPT"===e.currentScript.tagName.toUpperCase()&&(t=e.currentScript.src),!t)){var i=e.getElementsByTagName("script");if(i.length)for(var o=i.length-1;o>-1&&(!t||!/^http(s?):/.test(t));)t=i[o--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),s.p=t}(),function(){var t={180:0};s.f.j=function(e,i){var o=s.o(t,e)?t[e]:void 0;if(0!==o)if(o)i.push(o[2]);else{var n=new Promise(function(i,s){o=t[e]=[i,s]});i.push(o[2]=n);var r=s.p+s.u(e),l=new Error;s.l(r,function(i){if(s.o(t,e)&&(0!==(o=t[e])&&(t[e]=void 0),o)){var n=i&&("load"===i.type?"missing":i.type),r=i&&i.target&&i.target.src;l.message="Loading chunk "+e+" failed.\n("+n+": "+r+")",l.name="ChunkLoadError",l.type=n,l.request=r,o[1](l)}},"chunk-"+e,e)}};var e=function(e,i){var o,n,r=i[0],l=i[1],a=i[2],d=0;if(r.some(function(e){return 0!==t[e]})){for(o in l)s.o(l,o)&&(s.m[o]=l[o]);a&&a(s)}for(e&&e(i);d<r.length;d++)n=r[d],s.o(t,n)&&t[n]&&t[n][0](),t[n]=0},i=self.webpackChunkbpm2=self.webpackChunkbpm2||[];i.forEach(e.bind(null,0)),i.push=e.bind(null,i.push.bind(i))}();var n={};return function(){"use strict";s.r(n),s.d(n,{default:function(){return D}});var t=function(){var t=this,e=t.$createElement;return(t._self._c||e)(t.curComponent,t._g(t._b({tag:"component",staticClass:"bpm-video",attrs:{value:t.curVal,fieldConf:t.fieldConf,row:t.row,mode:t.mode,uiType:t.uiType},on:{change:t.handleChange}},"component",t.$attrs,!1),t.$listeners))};t._withStripped=!0;var e=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"bpm-video-editor"},["dialog"!==t.videoUiType?i("div",{staticStyle:{"margin-top":"12px"}},t._l(t.localList,function(e,o){return i("div",{key:"pv-"+o,staticStyle:{"margin-bottom":"12px"}},[i("bpm-video-player",{attrs:{src:e.src,type:e.type||"auto",poster:e.poster,accessToken:e.access_token,areaDomain:e.area_domain||"",autoplay:t.localConf.autoplay,controls:t.localConf.controls,loop:t.localConf.loop,volume:t.localConf.volume,playsinline:t.localConf.plays_in_line,width:t.localConf.width,height:t.localConf.height,customConfig:t.localConf.customConfig},on:{play:function(e){return t.$emit("play",{index:o})},pause:function(e){return t.$emit("pause",{index:o})},ended:function(e){return t.$emit("ended",{index:o})},error:function(e){return t.$emit("error",{index:o,error:e})},timeupdate:function(e){return t.$emit("timeupdate",{index:o,data:e})},ready:function(e){return t.$emit("ready",{index:o})}}})],1)}),0):["dialog"===t.videoUiType?i("i",{staticClass:"el-icon-video-play",style:{fontSize:"20px",color:t.localList.length>0?"#409EFF":"#909399",cursor:"pointer"},on:{click:function(e){e.stopPropagation(),t.localList.length>0&&(t.viewDialogVisible=!0)}}},[t._v(t._s(t.localList.length>1?t.localList.length:""))]):t._e(),t._v(" "),"dialog"===t.videoUiType?i("el-dialog",{attrs:{title:t.fieldConf.name||"视频播放",visible:t.viewDialogVisible,width:t.dialogWidth||"80%","append-to-body":"",fullscreen:t.isFullscreen,"show-close":!t.isFullscreen,"custom-class":t.isFullscreen?"bpm-video-dialog-fullscreen":"bpm-video-dialog-normal"},on:{"update:visible":function(e){t.viewDialogVisible=e},close:t.handleCloseDialog}},[t.isFullscreen?t._e():i("div",{staticClass:"bpm-video-dialog-title",attrs:{slot:"title"},slot:"title"},[i("span",[t._v(t._s(t.fieldConf.name||"视频播放"))]),t._v(" "),i("button",{staticClass:"el-dialog__headerbtn",staticStyle:{right:"50px"},attrs:{type:"button"},on:{click:t.toggleFullscreen}},[i("i",{staticClass:"el-icon-full-screen"})])]),t._v(" "),i("div",{staticClass:"bpm-video-grid-container",style:t.gridStyle},t._l(t.localList,function(e,o){return i("div",{key:"view-dlg-"+o,staticClass:"bpm-video-grid-item"},[i("bpm-video-player",{attrs:{src:e.src,type:e.type||"auto",poster:e.poster,accessToken:e.access_token,autoplay:t.localConf.autoplay,controls:t.localConf.controls,loop:t.localConf.loop,volume:t.localConf.volume,playsinline:t.localConf.plays_in_line,width:"100%",height:"100%",customConfig:t.localConf.customConfig},on:{play:function(e){return t.$emit("play",{index:o})},pause:function(e){return t.$emit("pause",{index:o})},ended:function(e){return t.$emit("ended",{index:o})},error:function(e){return t.$emit("error",{index:o,error:e})},timeupdate:function(e){return t.$emit("timeupdate",{index:o,data:e})},ready:function(e){return t.$emit("ready",{index:o})}}})],1)}),0)]):t._e()],t._v(" "),t.readonly?t._e():i("div",{staticClass:"editor-toolbar",staticStyle:{"margin-top":"12px"}},[i("el-button",{attrs:{type:"primary",size:"mini",icon:"el-icon-edit"},on:{click:t.openEditDialog}},[t._v("编辑视频源")])],1),t._v(" "),i("el-dialog",{attrs:{visible:t.editDialogVisible,title:"编辑视频源",width:"60%","append-to-body":""},on:{"update:visible":function(e){t.editDialogVisible=e}}},[i("el-form",{attrs:{"label-width":"120px",size:"small"}},[t._l(t.tempList,function(e,o){return i("div",{key:"card-"+o,staticStyle:{"margin-bottom":"12px"}},[i("el-card",{attrs:{shadow:"never"}},[i("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[i("span",[t._v("视频源 #"+t._s(o+1))]),t._v(" "),i("span",{staticStyle:{float:"right"}},[i("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(e){return t.removeItem(o)}}},[i("span",{staticStyle:{color:"red"}},[i("i",{staticClass:"el-icon-close"})])])],1)]),t._v(" "),i("el-form-item",{attrs:{label:"视频地址"}},[i("el-input",{attrs:{placeholder:"例如:ws://... 或 http(s)://... 或 webrtc://... 或 ezopen://..."},model:{value:e.src,callback:function(i){t.$set(e,"src",i)},expression:"item.src"}})],1),t._v(" "),i("el-form-item",{attrs:{label:"封面图"}},[i("el-input",{attrs:{placeholder:"封面图 URL,可选"},model:{value:e.poster,callback:function(i){t.$set(e,"poster",i)},expression:"item.poster"}})],1),t._v(" "),i("el-form-item",{attrs:{label:"token"}},[i("el-input",{attrs:{placeholder:"token,可选"},model:{value:e.access_token,callback:function(i){t.$set(e,"access_token",i)},expression:"item.access_token"}})],1),t._v(" "),i("el-form-item",{attrs:{label:"设备环境"}},[i("el-input",{attrs:{placeholder:"设备环境,可选"},model:{value:e.area_domain,callback:function(i){t.$set(e,"area_domain",i)},expression:"item.area_domain"}})],1)],1)],1)}),t._v(" "),i("el-button",{attrs:{type:"primary",size:"mini",icon:"el-icon-plus"},on:{click:t.addItem}},[t._v("添加视频")])],2),t._v(" "),i("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[i("el-button",{on:{click:function(e){t.editDialogVisible=!1}}},[t._v("取消")]),t._v(" "),i("el-button",{attrs:{type:"primary"},on:{click:t.confirmEdit}},[t._v("确认")])],1)],1)],2)};e._withStripped=!0;var i=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{style:t.containerStyle},[i("div",{attrs:{id:t.playerId}})])};i._withStripped=!0;let o=null,r=null,l=null,a=null,d=null,c=null,u=null,p=!1,h=!1,f=!1,m=!1,y=!1,v=!1,g=!1,w={},b=null,C=0,E=null,S=null;var x={name:"BpmVideoPlayer",props:{src:{type:[String,Object],default(){return""}},type:{type:String,default(){return"auto"}},poster:{type:String,default(){return""}},accessToken:{type:String,default(){return""}},areaDomain:{type:String,default(){return""}},autoplay:{type:Boolean,default(){return!1}},controls:{type:Boolean,default(){return!0}},loop:{type:Boolean,default(){return!1}},width:{type:[String,Number],default(){return"100%"}},height:{type:[String,Number],default(){return"100%"}},volume:{type:Number,default(){return.6}},playsinline:{type:Boolean,default(){return!0}},customConfig:{type:Object,default(){return{}}}},data(){return{player:null,playerId:"bpm-video-"+Math.random().toString(36).slice(2),videoEl:null}},computed:{containerStyle(){return{width:"number"==typeof this.width?this.width+"px":this.width,height:"number"==typeof this.height?this.height+"px":this.height}},normalizedUrl(){if("string"==typeof this.src)return this.src;if(Array.isArray(this.src)&&this.src.length>0){const t=this.src[0];if(t)return(t.src&&"string"==typeof t.src?t.src:"")||(t.url&&"string"==typeof t.url?t.url:"")}return this.src&&this.src.url?this.src.url:this.src&&this.src.src?this.src.src:""}},watch:{src(){this.reload()},type(){this.reload()},width(){this.reload()},height(){this.reload()}},mounted(){this.init()},beforeDestroy(){this.destroy()},methods:{loadScript(t){if(w[t])return w[t];const e=Array.from(document.getElementsByTagName("script")).find(e=>e.src&&-1!==e.src.indexOf(t));if(e)return e.dataset&&"true"===e.dataset.loaded?(w[t]=Promise.resolve(),w[t]):(w[t]=new Promise((t,i)=>{e.addEventListener("load",()=>{e.dataset&&(e.dataset.loaded="true"),t()}),e.addEventListener("error",t=>i(t))}),w[t]);const i=document.createElement("script");return i.src=t,i.async=!0,w[t]=new Promise((t,e)=>{i.onload=()=>{C>0&&(C--,0===C&&(E&&(window.define=E),S&&(window.module=S),E=null,S=null)),i.dataset&&(i.dataset.loaded="true"),t()},i.onerror=t=>{C>0&&(C--,0===C&&(E&&(window.define=E),S&&(window.module=S),E=null,S=null)),e(t)}}),0===C&&("function"==typeof window.define&&window.define.amd&&(E=window.define,window.define=void 0),"object"==typeof window.module&&window.module&&window.module.exports&&(S=window.module,window.module=void 0)),C++,document.head.appendChild(i),w[t]},async ensureDeps(){if(console.log("PlayerCtor:",o),!o){const t=this.customConfig&&this.customConfig.xgplayerJsUrl||"https://cdn.jsdelivr.net/npm/xgplayer@3.0.23/dist/index.min.js";h&&(window.Player||window.xgplayer)||(await this.loadScript(t),h=!0);let e=window.Player||window.xgplayer;console.log("PlayerCtor:",e),e&&e.default&&(e=e.default),o=e}if(!p){const t=this.customConfig&&this.customConfig.xgplayerCssUrl||"https://cdn.jsdelivr.net/npm/xgplayer@3.0.23/dist/index.min.css",e=document.createElement("link");e.rel="stylesheet",e.href=t,document.head.appendChild(e),p=!0}},async ensureMpegts(){if(d)return;const t=this.customConfig&&this.customConfig.mpegtsLibUrl||"https://cdn.jsdelivr.net/npm/mpegts.js@1.7.0/dist/mpegts.min.js";await new Promise((e,i)=>{const o=document.createElement("script");o.src=t,o.async=!0,o.onload=()=>e(),o.onerror=t=>i(t),document.head.appendChild(o)}),d=window.mpegts||window.Mpegts||null},async ensureEzopen(){if(c)return;try{b||(b=s.e(552).then(s.bind(s,4552)));const t=await b,e=t&&t.EZUIKitPlayer||t&&t.default&&t.default.EZUIKitPlayer;if(e)return void(c=e)}catch(t){}const t=this.customConfig&&this.customConfig.ezuikitUrl||"https://cdn.jsdelivr.net/npm/ezuikit-js@8.1.6/ezuikit.js",e=!!window.EZUIKitPlayer||!(!window.EZUIKit||!window.EZUIKit.EZUIKitPlayer)||!!window.EZUIPlayer;v&&e||(await this.loadScript(t),v=!0),c=window.EZUIKitPlayer||window.EZUIKit&&window.EZUIKit.EZUIKitPlayer||window.EZUIPlayer||null},async ensureJsWebRtc(){if(u)return;const t=this.customConfig&&this.customConfig.jsWebRtcUrl||"https://cdn.jsdelivr.net/npm/jswebrtc@1.0.1/dist/jswebrtc.min.js";g&&window.JSWebrtc||(await this.loadScript(t),g=!0),u=window.JSWebrtc},async init(){const t=function(t,e){if(e&&"auto"!==e)return e;if(!t||"string"!=typeof t)return"mp4";const i=t.toLowerCase();return i.startsWith("ezopen://")?"ezopen":i.startsWith("webrtc://")?"webrtc":i.startsWith("rtsp://")?"rtsp":i.startsWith("rtp://")?"rtp":i.startsWith("rtmp://")||i.startsWith("rtmps://")?"rtmp":i.endsWith(".m3u8")?"hls":i.endsWith(".flv")?"flv":i.endsWith(".mpd")?"dash":"mp4"}(this.normalizedUrl,this.type);if(console.log("this.normalizedUrl:"+t),"ezopen"===t)return void await this.initEzopen();if("webrtc"===t)return void await this.initWebRtc();if("ezuikit-flv"===t)return void await this.initEzuikitFlv();if("rtsp"===t||"rtp"===t)return void await this.initRtsp();await this.ensureDeps();const e=[];let i=this.normalizedUrl;if("hls"===t){if(!document.createElement("video").canPlayType("application/vnd.apple.mpegurl")){if(!r){const t=this.customConfig&&this.customConfig.hlsJsPluginUrl||"https://cdn.jsdelivr.net/npm/xgplayer-hls.js@3.0.23/dist/index.min.js";f&&window.HlsJsPlugin||(await this.loadScript(t),f=!0),r=window.HlsJsPlugin,r&&r.default&&(r=r.default)}r&&e.push(r)}}else if("flv"===t||"rtmp"===t){if(window.MediaSource||console.warn("Current browser does not support MediaSource Extensions (MSE), FLV playback may fail."),"rtmp"===t){if(console.log("this.customConfig:",this.customConfig),!this.customConfig||!this.customConfig.flvUrl)return void this.$emit("error",new Error("浏览器不支持 RTMP,请提供 flvUrl (HTTP-FLV/WS-FLV)"));i=this.customConfig.flvUrl}if(!l){const t=this.customConfig&&this.customConfig.flvJsPluginUrl||"https://cdn.jsdelivr.net/npm/xgplayer-flv.js@3.0.23/dist/index.min.js";m&&window.FlvJsPlugin||(await this.loadScript(t),m=!0),l=window.FlvJsPlugin,l&&l.default&&(l=l.default)}l&&e.push(l)}else if("dash"===t){if(!a){const t=this.customConfig&&this.customConfig.dashPluginUrl||"https://cdn.jsdelivr.net/npm/xgplayer-dash@3.0.0/dist/index.min.js";y&&window.DashPlugin||(await this.loadScript(t),y=!0),a=window.DashPlugin,a&&a.default&&(a=a.default)}e.push(a)}const s=Object.assign({id:this.playerId,url:i,poster:this.poster,autoplay:this.autoplay,controls:this.controls,loop:this.loop,volume:this.volume,playsinline:this.playsinline,width:this.width,height:this.height,plugins:e},this.customConfig||{});this.player=new o(s),this.bindEvents(),this.$emit("ready")},bindEvents(){this.player&&(this.player.on("play",()=>this.$emit("play")),this.player.on("pause",()=>this.$emit("pause")),this.player.on("ended",()=>this.$emit("ended")),this.player.on("error",t=>this.$emit("error",t)),this.player.on("timeupdate",t=>this.$emit("timeupdate",t)),this.player.on("waiting",()=>this.$emit("waiting")),this.player.on("fullscreenchange",t=>this.$emit("fullscreenChange",t)),this.player.on("definitionchange",t=>this.$emit("definitionChange",t)))},bindVideoEvents(){this.videoEl&&(this.videoEl.addEventListener("play",()=>this.$emit("play")),this.videoEl.addEventListener("pause",()=>this.$emit("pause")),this.videoEl.addEventListener("ended",()=>this.$emit("ended")),this.videoEl.addEventListener("waiting",()=>this.$emit("waiting")),this.videoEl.addEventListener("timeupdate",()=>this.$emit("timeupdate",{currentTime:this.videoEl.currentTime})),this.$emit("ready"))},async initRtsp(){try{await this.ensureMpegts()}catch(t){return void this.$emit("error",t)}const t=document.getElementById(this.playerId);if(!t)return;for(;t.firstChild;)t.removeChild(t.firstChild);const e=document.createElement("video");e.style.width="100%",e.style.height="100%",e.autoplay=!!this.autoplay,e.controls=!!this.controls,e.loop=!!this.loop,e.playsInline=!!this.playsinline,e.muted=!1,this.poster&&(e.poster=this.poster),t.appendChild(e),this.videoEl=e;const i=(()=>{const t=this.normalizedUrl||"";return/^ws(s)?:\/\//.test(t)||/^http(s)?:\/\//.test(t)?t:this.customConfig&&this.customConfig.mpegtsUrl?this.customConfig.mpegtsUrl:""})();if(!d||!i)return this.bindVideoEvents(),void this.$emit("error",new Error("RTSP/RTP 需要后端转码为 WebSocket/MPEG-TS,请提供 mpegtsUrl"));const o={isLive:!0,type:"mpegts",url:i},s=d.createPlayer(o,this.customConfig&&this.customConfig.mpegtsConfig||{});s.attachMediaElement(e),s.load(),this.player=s,this.bindVideoEvents(),this.autoplay&&Promise.resolve(e.play()).catch(()=>{})},async initWebRtc(){try{await this.ensureJsWebRtc()}catch(t){return void this.$emit("error",t)}if(!u)return void this.$emit("error",new Error("JSWebrtc load failed"));const t=document.getElementById(this.playerId);if(!t)return;for(;t.firstChild;)t.removeChild(t.firstChild);const e=document.createElement("video");e.style.width="100%",e.style.height="100%",e.autoplay=!!this.autoplay,e.controls=!!this.controls,e.loop=!!this.loop,e.playsInline=!!this.playsinline,this.poster&&(e.poster=this.poster),t.appendChild(e),this.videoEl=e;const i=this.normalizedUrl;this.player=new u.Player(i,{video:e,autoplay:this.autoplay,onPlay:t=>{console.log("JSWebrtc onPlay",t),this.$emit("play")},onPause:t=>{this.$emit("pause")}}),this.bindVideoEvents()},async initEzopen(){if(await this.ensureEzopen(),!c)return console.error("EZUIKitPlayer load failed"),void this.$emit("error",{message:"EZUIKitPlayer load failed"});const t=document.getElementById(this.playerId);if(!t)return;t.innerHTML="";let e=this.accessToken;!e&&"object"==typeof this.src&&this.src.accessToken&&(e=this.src.accessToken);let i=this.width,o=this.height;const s=t.parentElement||t,n=s.clientWidth||s.offsetWidth||t.clientWidth||t.offsetWidth||0,r=s.clientHeight||s.offsetHeight||t.clientHeight||t.offsetHeight||0,l=(t,e,i)=>{if("number"==typeof t&&Number.isFinite(t))return t;if("string"!=typeof t)return e||i;const o=t.trim();if(!o)return e||i;if(o.endsWith("px")){const t=parseFloat(o.slice(0,-2));return Number.isFinite(t)?t:e||i}if(/^\d+(\.\d+)?$/.test(o))return parseFloat(o);if("auto"===o||o.includes("%")||o.includes("vw")||o.includes("vh")||o.includes("rem")||o.includes("em"))return e||i;const s=parseFloat(o);return Number.isFinite(s)?s:e||i};i=l(i,n,600),o=l(o,r,400),console.log("EzuiPlayerCtor",c);const a={id:this.playerId,url:this.normalizedUrl,accessToken:e,template:"simple",autoplay:this.autoplay,width:Math.max(1,Math.round(i)),height:Math.max(1,Math.round(o)),handleSuccess:()=>{console.log("EZUIKit play success"),this.$emit("play")},handleError:t=>{console.error("EZUIKit play error",t),this.$emit("error",t)}};this.areaDomain&&(a.env={domain:this.areaDomain}),this.player=new c(a),console.log("this.player",this.player);const d=this.player&&this.player.eventEmitter,u=c&&c.EVENTS;d&&u&&(u.play&&d.on(u.play,()=>this.$emit("play")),u.pause&&d.on(u.pause,()=>this.$emit("pause")),u.stop&&d.on(u.stop,()=>this.$emit("ended")),u.openSound&&d.on(u.openSound,()=>this.$emit("openSound")),u.closeSound&&d.on(u.closeSound,()=>this.$emit("closeSound")),u.fullscreenChange&&d.on(u.fullscreenChange,t=>this.$emit("fullscreenChange",t))),this.$emit("ready")},async initEzuikitFlv(){},async reload(){this.destroy(),await this.init()},destroy(){if(this.player)if(this.player.destroy)try{this.player.destroy()}catch(t){}else if(this.player.stop)try{this.player.stop()}catch(t){}if(this.player=null,this.videoEl&&this.videoEl.parentNode){try{this.videoEl.pause()}catch(t){}this.videoEl.parentNode.removeChild(this.videoEl)}this.videoEl=null},play(){this.videoEl?this.videoEl.play():this.player&&this.player.play&&this.player.play()},pause(){this.videoEl?this.videoEl.pause():this.player&&this.player.pause&&this.player.pause()},seek(t){if(this.videoEl&&"number"==typeof t)try{this.videoEl.currentTime=t}catch(t){}else if(this.player&&"number"==typeof t)try{this.player.currentTime=t}catch(t){}},setVolume(t){this.videoEl&&"number"==typeof t?this.videoEl.volume=Math.max(0,Math.min(1,t)):this.player&&"number"==typeof t&&(this.player.volume=Math.max(0,Math.min(1,t)))},setPlaybackRate(t){this.videoEl&&"number"==typeof t?this.videoEl.playbackRate=t:this.player&&"number"==typeof t&&(this.player.playbackRate=t)}}},$=s(4486),k=(0,$.A)(x,i,[],!1,null,null,null);k.options.__file="components/lib/bpmVideo/src/player.vue";var j={name:"BpmVideoEditor",components:{BpmVideoPlayer:k.exports},props:{value:{type:[String,Object,Array]},fieldConf:{type:Object,default(){return{}}},row:{type:Object,default(){return{}}},mode:{type:String,default(){return"edit"}},readonly:{type:Boolean,default:!1},uiType:{type:String,default(){return"normal"}}},data(){return{editDialogVisible:!1,viewDialogVisible:!1,localList:[],tempList:[],localConf:{type:"auto",autoplay:!0,controls:!0,loop:!1,volume:.6,plays_inline:!0,width:"100%",height:"360px",customConfig:{}},isFullscreen:!1}},computed:{dialogWidth(){return this.fieldConf.style.dialog_width||"80%"},videoUiType(){return"table"===this.uiType?"dialog":this.fieldConf.style.video_ui_type||"normal"},previewSrc(){return this.localList.length>0?this.localList[0].src||"":"string"==typeof this.value?this.value:this.value&&"object"==typeof this.value&&(this.value.src||this.value.url)||""},previewPoster(){return this.localList.length>0?this.localList[0].poster||"":this.value&&"object"==typeof this.value?this.value.poster||"":this.fieldConf&&"string"==typeof this.fieldConf.poster?this.fieldConf.poster:""},gridCols(){const t=this.localList.length;return t<=1?1:t<=4?2:t<=9?3:t<=16?4:5},gridStyle(){return{display:"grid",gridTemplateColumns:`repeat(${this.gridCols}, 1fr)`,gridTemplateRows:`repeat(${this.gridCols}, 1fr)`,gap:"0",width:"100%",height:"100%"}}},watch:{fieldConf:{handler(t){this.mergeConf(t)},immediate:!0,deep:!0},value:{handler(t){Array.isArray(t)?this.localList=t.map(t=>({src:t&&(t.src||t.url)||"",poster:t&&t.poster||"",access_token:t&&t.access_token||"",type:t&&t.type||"auto",area_domain:t&&t.area_domain||""})):this.localList="string"==typeof t?[{src:t,poster:"",access_token:"",type:"auto"}]:t&&"object"==typeof t?[{src:t.src||t.url||"",poster:t.poster||"",access_token:t.access_token||"",type:t.type||"auto",area_domain:t.area_domain||""}]:[]},immediate:!0}},mounted(){document.addEventListener("keydown",this.handleEscKey)},beforeDestroy(){document.removeEventListener("keydown",this.handleEscKey)},methods:{handleEscKey(t){"Escape"===t.key&&this.isFullscreen&&(this.isFullscreen=!1)},handleCloseDialog(){this.isFullscreen=!1},toggleFullscreen(){this.isFullscreen=!this.isFullscreen},mergeConf(t){console.log("fieldConf",t);const e=t.style||{},i=Object.assign({},this.localConf,e);e&&void 0!==e.width&&(i.width=e.width),e&&void 0!==e.height&&(i.height=e.height),this.localConf=i},openEditDialog(){this.tempList=_.cloneDeep(this.localList),this.editDialogVisible=!0},addItem(){this.tempList.push({src:"",poster:"",access_token:"",type:"auto"})},removeItem(t){this.tempList.splice(t,1)},confirmEdit(){this.localList=_.cloneDeep(this.tempList),this.emitChange(),this.editDialogVisible=!1},emitChange(){const t=this.localList.map(t=>({src:t.src||"",poster:t.poster||"",access_token:t.access_token||"",type:t.type||"auto"}));this.$emit("input",t),this.$emit("change",t)}}},P=(s(7234),(0,$.A)(j,e,[],!1,null,null,null));P.options.__file="components/lib/bpmVideo/src/part/editor.vue";var V=P.exports,T=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"bpm-video-reader"},[i("bpm-video-editor",t._g({attrs:{value:t.sourcesList,fieldConf:t.fieldConf,row:t.row,mode:t.mode,uiType:t.uiType,readonly:!0}},t.$listeners))],1)};T._withStripped=!0;var U={name:"BpmVideoReader",components:{BpmVideoEditor:V},props:{value:{type:[String,Object,Array]},fieldConf:{type:Object,default(){return{}}},row:{type:Object,default(){return{}}},mode:{type:String,default(){return"view"}},uiType:{type:String,default(){return"normal"}}},computed:{sourcesList(){return Array.isArray(this.value)&&this.value.length>0?this.value.map(t=>({src:t&&(t.src||t.url)||"",poster:t&&t.poster||""})).filter(t=>t.src):this.fieldConf&&Array.isArray(this.fieldConf.src)&&this.fieldConf.src.length>0?this.fieldConf.src.map(t=>({src:t&&(t.src||t.url)||"",poster:t&&t.poster||""})).filter(t=>t.src):"string"==typeof this.value&&this.value?[{src:this.value,poster:this.fieldConf&&"string"==typeof this.fieldConf.poster?this.fieldConf.poster:""}]:this.fieldConf&&"string"==typeof this.fieldConf.src&&this.fieldConf.src?[{src:this.fieldConf.src,poster:this.fieldConf&&"string"==typeof this.fieldConf.poster?this.fieldConf.poster:""}]:this.fieldConf&&this.fieldConf.defaultSrc?[{src:this.fieldConf.defaultSrc,poster:this.fieldConf&&"string"==typeof this.fieldConf.poster?this.fieldConf.poster:""}]:[]}},vmounted(){console.log("this.fieldConf",this.fieldConf)}},L=(0,$.A)(U,T,[],!1,null,null,null);L.options.__file="components/lib/bpmVideo/src/part/reader.vue";var I=L.exports,z={name:"BpmVideo",components:{editorComponent:V,readerComponent:I},props:{value:{type:[String,Object,Array]},fieldConf:{type:Object,default(){return{}}},row:{type:Object,default(){return{}}},mode:{type:String,default(){return"view"}},uiType:{type:String,default(){return"normal"}}},data(){return{curVal:[]}},computed:{curComponent(){return"view"===this.mode?I:V}},watch:{value(){if(Array.isArray(this.value))this.curVal=this.value;else if("string"==typeof this.value&&this.value){const t=this.fieldConf&&"string"==typeof this.fieldConf.poster?this.fieldConf.poster:"";this.curVal=[{src:this.value,poster:t}]}else if(this.value&&"object"==typeof this.value){const t=this.value.src||this.value.url||"",e=this.value.poster||"";this.curVal=t?[{src:t,poster:e}]:[]}else this.curVal=[]}},mounted(){const t=!!this.fieldConf,e=void 0!==this.value?this.value:t&&void 0!==this.fieldConf.src?this.fieldConf.src:t&&this.fieldConf.defaultSrc?this.fieldConf.defaultSrc:"";if(Array.isArray(e))this.curVal=e;else if("string"==typeof e&&e){const i=t&&"string"==typeof this.fieldConf.poster?this.fieldConf.poster:"";this.curVal=[{src:e,poster:i}]}else if(e&&"object"==typeof e){const t=e.src||e.url||"",i=e.poster||"";this.curVal=t?[{src:t,poster:i}]:[]}else this.curVal=[]},methods:{handleChange(t){if(Array.isArray(t))return this.curVal=t,this.$emit("input",this.curVal),void this.$emit("change",this.curVal);if("string"==typeof t){const e=this.fieldConf&&"string"==typeof this.fieldConf.poster?this.fieldConf.poster:"";this.curVal=[{src:t,poster:e}]}else if(t&&"object"==typeof t){const e=t.src||t.url||"",i=t.poster||"";this.curVal=e?[{src:e,poster:i}]:[]}else this.curVal=[];this.$emit("input",this.curVal),this.$emit("change",this.curVal)}}},F=(0,$.A)(z,t,[],!1,null,null,null);F.options.__file="components/lib/bpmVideo/src/main.vue";var A=F.exports;A.install=function(t){t.component(A.name,A)};var D=A}(),n}()});