import{L as o,c as a,b as l}from"./gy.srs.sdk.ab1fd116.js";import{b as r}from"./live-student.e6ad7a61.js";import{n as c}from"./vueComponentNormalizer.9ef17bb1.js";import"./index.f5168bf8.js";var v=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("LiveLayout",{ref:"liveLayout",staticClass:"live-student",attrs:{liveInfo:e.room},on:{quitLive:e.quitLive},scopedSlots:e._u([{key:"liveBodyLeftMenu",fn:function(){return[i("div",{staticClass:"live-body-left"},[i("div",{staticClass:"left-menu-item",on:{click:e.toAnswering}},[i("i",{staticClass:"i-x-zxks-canjiakaoshi"}),e._v(" \u7B54\u9898 ")])])]},proxy:!0},{key:"playingBox",fn:function(){var s;return[i("div",{directives:[{name:"show",rawName:"v-show",value:e.isPlaying,expression:"isPlaying"}],staticClass:"live-playing"},[i("video",{ref:"videoPlayer",staticClass:"video-play",attrs:{controls:"",muted:"",autoplay:""},domProps:{muted:!0}})]),i("div",{directives:[{name:"show",rawName:"v-show",value:!e.isPlaying,expression:"!isPlaying"}],staticClass:"live-not-start"},[e._v(" \u76F4\u64AD"+e._s(((s=e.liveInfo)===null||s===void 0?void 0:s.status)==1?"\u5DF2\u6682\u505C":"\u672A\u5F00\u59CB")+"\uFF0C\u7A0D\u7B49\u4E00\u4E0B\u5427\uFF01 ")])]},proxy:!0}])})},u=[];const d={components:{LiveLayout:o},data(){return{liveInfo:null,isPlaying:!1,room:null}},mixins:[a],async created(){},mounted(){},async activated(){this.liveInfo&&(this.liveInfo=null),this.isPlaying=!1,await this.getLiveInfo(this.$route.query.id).then(()=>{this.$refs.videoPlayer.onloadeddata=()=>{var e;this.isPlaying=!0,(e=this.$refs.liveLayout.warmAudio)==null||e.pause()},this.playVideo(),document.addEventListener("click",this.cancelMuted)})},methods:{async getLiveInfo(e){const t=await r(e);this.liveInfo=t.data,this.room=this.liveInfo},playVideo(){this.sdk&&this.sdk.close(),this.$refs.videoPlayer.muted=!0,this.sdk=new l,this.$refs.videoPlayer.srcObject=this.sdk.stream;const e=window.GyConfig.webRtcUrl+this.$route.query.id;this.sdk.play(e).catch(t=>{console.info(t),this.sdk.close()})},cancelMuted(){this.$refs.videoPlayer.muted=!1,this.$refs.videoPlayer.play(),document.removeEventListener("click",this.cancelMuted)},quitLive(){this.$confirm("\u5373\u5C06\u9000\u51FA\u76F4\u64AD, \u662F\u5426\u7EE7\u7EED?","\u63D0\u793A",{confirmButtonText:"\u786E\u5B9A",cancelButtonText:"\u53D6\u6D88",type:"warning"}).then(async()=>{this.room=this.liveInfo,await this.ws_leave_live_room(()=>{this.$router.push("/online-course/live-in-class").then(()=>{location.reload()})})}).catch(e=>{console.log(e)})},toAnswering(){if(this.liveInfo.question&&this.liveInfo.question.length<=0){this.$message.error("\u6682\u65E0\u8BD5\u9898");return}const e=this.$router.resolve({path:"/online-course/live-in-class/live-watch/answering",query:{liveId:this.liveInfo.id}});console.log(e),window.open(e.href,"_blank")}}},n={};var h=c(d,v,u,!1,f,"1db1d75e",null,null);function f(e){for(let t in n)this[t]=n[t]}const g=function(){return h.exports}();export{g as default};
