<template>
  <OutMask :bg="bg">
    <div class="viedoBox" :class="bg ? 'mobileV' : ''">
      <video
        v-if="showViedo"
        width="100%"
        height="auto"
        autoplay="autoplay"
        x5-video-player-type="h5-page"
        webkit-playsinline
        playsinline
        controls
      >
        <source
          src="https://cdn.star-linear.com/resource/dream/new_pv.mp4"
          type="video/mp4"
        />
      </video>
      <div
        :class="bg ? 'm_close_btn' : 'close_btn'"
        @click="closeViedoBox()"
      ></div>
    </div>
  </OutMask>
</template>

<script>
export default {
  components: {
    OutMask: () => import("./outMask.vue"),
  },
  props: {
    bg: {
      type: String,
      default: "",
    },
  },
  data() {
    return {
      showViedo: true,
    };
  },
  methods: {
    closeViedoBox() {
      // this.showViedo = false;
      this.$emit("closeViedoBox");
    },
  },
};
</script>

<style lang="scss">
.viedoBox {
  width: 960px;
  height: 540px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  z-index: 2;
  &.mobileV {
    margin-top: 28px;
    width: 667px;
    height: auto;
    // height: 375px;
  }
  iframe,
  video {
    width: 100%;
    height: 100%;
    display: block;
  }
  .hidden_v {
    display: none;
  }
  .close_btn {
    top: 0;
    right: -18px;
    transform: translateX(100%);
  }
  .m_close_btn {
    margin: 28px auto 0;
  }
}
.m_close_btn {
  width: 58px;
  height: 147px;
  // background-color: #fff;
  background: url("@/assets/mobile/mask_close.png") center no-repeat;
  background-size: contain;
  margin: 28px auto 0;
}
</style>
