"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("vue"),r=require("lodash"),v=require("flv.js"),h=["poster","autoplay","controls","loop","muted"],S=i.defineComponent({name:"zv-media-flv"}),O=i.defineComponent({...S,props:{basicOption:{},sources:{},useEvents:{}},emits:["on-video-progress","on-video-play","on-video-pause","on-video-ended","on-video-playing","on-video-timeupdate","on-video-error","on-video-volumechange"],setup(l,{expose:u,emit:p}){const e=l,c=()=>{const o=i.ref(),t=d=>{if(d&&v.isSupported())try{const a=v.createPlayer({type:"flv",url:d});a.attachMediaElement(o.value),a.load(),e.basicOption.autoplay&&a.play()}catch{}};return i.onMounted(()=>t(e.basicOption.src)),{videoRef:o,initFlvVideo:t}},{videoRef:s,initFlvVideo:m}=c();i.watch(()=>r.cloneDeep(e.basicOption),(o,t)=>{r.isEqual(o,t)||m(o.src)},{deep:!0});const n=p,y=()=>{n("on-video-progress"),window.SHJParseEvent(e.useEvents,"on-video-progress")},E=()=>{n("on-video-play"),window.SHJParseEvent(e.useEvents,"on-video-play")},f=()=>{n("on-video-pause"),window.SHJParseEvent(e.useEvents,"on-video-pause")},P=()=>{n("on-video-ended"),window.SHJParseEvent(e.useEvents,"on-video-ended")},g=()=>{n("on-video-playing"),window.SHJParseEvent(e.useEvents,"on-video-playing")},w=()=>{n("on-video-timeupdate"),window.SHJParseEvent(e.useEvents,"on-video-timeupdate")},V=()=>{n("on-video-error"),window.SHJParseEvent(e.useEvents,"on-video-error")},b=()=>{n("on-video-volumechange"),window.SHJParseEvent(e.useEvents,"on-video-volumechange")};return u({play:()=>{s.value&&s.value.play()},pause:()=>{s.value&&s.value.pause()}}),(o,t)=>(i.openBlock(),i.createElementBlock("video",{ref_key:"videoRef",ref:s,class:"zerov-widget",poster:o.basicOption.poster,autoplay:o.basicOption.autoplay,controls:o.basicOption.controls,loop:o.basicOption.loop,muted:o.basicOption.muted,onProgress:y,onPlay:E,onEnded:P,onPlaying:g,onPause:f,onTimeupdate:w,onError:V,onVolumechange:b},null,40,h))}});exports.default=O;
