import{_ as t,af as a,aa as e,b as n,d as l,p as o,w as s,H as d,i as u,o as i,f as c,k as r,v as m,ag as f,Y as h,R as p}from"./index-2PZN6pGH.js";const V=t({data:()=>({title:"video",src:"",danmuList:[{text:"第 1s 出现的弹幕",color:"#ff0000",time:1},{text:"第 3s 出现的弹幕",color:"#ff00ff",time:3}],danmuValue:"",showVideo:!1}),onReady:function(t){this.videoContext=a("myVideo"),this.showVideo=!0},methods:{sendDanmu:function(){this.videoContext.sendDanmu({text:this.danmuValue,color:this.getRandomColor()}),this.danmuValue=""},videoErrorCallback:function(t){e({content:t.target.errMsg,showCancel:!1})},getRandomColor:function(){const t=[];for(let a=0;a<3;++a){let a=Math.floor(256*Math.random()).toString(16);a=1==a.length?"0"+a:a,t.push(a)}return"#"+t.join("")}}},[["render",function(t,a,e,V,_,b){const g=n(l("page-head"),d),C=f,v=u,w=h,x=p;return i(),o(v,null,{default:s((()=>[c(g,{title:_.title},null,8,["title"]),_.showVideo?(i(),o(v,{key:0,class:"uni-padding-wrap uni-common-mt"},{default:s((()=>[c(v,null,{default:s((()=>[c(C,{id:"myVideo",src:"https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/2minute-demo.mp4",onError:b.videoErrorCallback,"danmu-list":_.danmuList,"enable-danmu":"","danmu-btn":"",controls:"",poster:"https://web-assets.dcloud.net.cn/unidoc/zh/poster.png"},null,8,["onError","danmu-list"])])),_:1}),c(v,{class:"uni-list uni-common-mt"},{default:s((()=>[c(v,{class:"uni-list-cell"},{default:s((()=>[c(v,null,{default:s((()=>[c(v,{class:"uni-label"},{default:s((()=>[r("弹幕内容")])),_:1})])),_:1}),c(v,{class:"uni-list-cell-db"},{default:s((()=>[c(w,{modelValue:_.danmuValue,"onUpdate:modelValue":a[0]||(a[0]=t=>_.danmuValue=t),class:"uni-input",type:"text",placeholder:"在此处输入弹幕内容"},null,8,["modelValue"])])),_:1})])),_:1})])),_:1}),c(v,{class:"uni-btn-v"},{default:s((()=>[c(x,{onClick:b.sendDanmu,class:"page-body-button"},{default:s((()=>[r("发送弹幕")])),_:1},8,["onClick"])])),_:1})])),_:1})):m("",!0)])),_:1})}],["__scopeId","data-v-429a9a6e"]]);export{V as default};
