
<template>
  <div  ref="video" id="player"  ></div>
  <!-- <div style="background-color: rgba(156, 167, 84, 0.667); width: 100vw;height: 100vh;position: absolute;" ></div> -->
 
  <home ></home>
  <!-- <div @click="toUE" style="position: absolute;top: 5%; left: 50%;background-color: darkcyan;z-index: 200">向UE发信息</div> -->
</template>

<script>
import { onMounted, ref } from "vue";
import {
  initLoad
} from "../webrtcVideo.js";
import { ElButton, ElInput } from "element-plus";
import Home from './home.vue'
export default {
  components: { ElButton, ElInput, Home },
  setup(props, context) {
    let video = ref(null);
    let videoInstance = ref(null);
    const loginShow = ref(true);
    // 获取用户信息
    const getUserInfo = (url) => {
      let userurl = "   https://weizhi.huanghuai.edu.cn/cmccr-server/center/cas/v1/getUser?casLoginUrl=https://cas.huanghuai.edu.cn/cas/serviceValidate?"
        + url + "&service=https://weizhi.huanghuai.edu.cn/cmips/"
      // axios.get(userurl).then(res => {

      // })
      console.log("是否有url", url)
      if (url) {
        loginShow.value = false
      }

    }
    onMounted(() => {

      videoInstance = initLoad({
        context,
        serverUrl: window.g.UE_IP,
        autoConnection: true,
        showPlayOverlay: true,
        qualityControl: true,
        inputOptions: {
          controlScheme: 1, // 鼠标：0是锁定，1是滑过
          suppressBrowserKeys: false,
        },
      });
      console.log("video.videoInstance", videoInstance);

      // let search = window.location.href.split("?")[1];

      // getUserInfo(search)



      // console.log(search, "编码")
      // let code = result.split("?")[0]; //去掉&之后的冗余部分

      // console.log(result);
      // // window.addEventListener('hashchange', pathChange);
      // const searchParams = currentUrl.searchParams;
      // let ticket = searchParams.get("ticket"); // 'devpoint'
      // console.log("ticket", ticket);
      // searchParams.get("page"); // '1'


    });
    // function handleResponseFunction(data) {
    //   console.log("从UE返回过来的值", data)
    // }
    function toUE() {
      // 向UE发送消息
      // callUIInteraction("open");
      // 同时接收从UE返回过来的值
      // debugger
      // addResponseEventListener("open", handleResponseFunction)
    }

    return {
      video,
      loginShow
    };
  },
};
</script>
<style scoped>
#player {
  width: 100%;
  height: 100%;
  position: absolute;
  overflow: hidden;
}

.hidden {
  display: none;
}
</style>