<template>
  <div class="video-wrap">
    <VideoHeader :detail="detail" :online="online" />
    <div
      :class="['videoRef', detail.playType === 2 ? 'record-play' : '']"
      ref="videoRef"
    ></div>
    <div class="plat-btn" v-if="showPlayBtn" @click="playVideo">
      <img src="../../../assets/images/normal_player.png" />
    </div>
    <VideoFooter
      v-if="
        detail.playType === 1 &&
        detail.liveStatus === $liveStatusObj.FinishPlay &&
        detail.libraryList &&
        detail.libraryList.length
      "
      :activityObj="activityObj"
      :informMsgList="informMsgList"
      :detail="detail"
      :isSpeak="true"
      @sendMsg="sendMsg"
    />
  </div>
</template>

<script setup>
import { defineProps } from "vue";
import VideoHeader from "../components/VideoHeader.vue";
import VideoFooter from "../components/VideoFooter.vue";
import useGetLiveStatusObj from "@/hooks/useGetLiveStatusObj";

const $liveStatusObj = useGetLiveStatusObj();

defineProps({
  detail: {
    type: Object,
    default: () => ({}),
  },
  liveStatus: {
    type: Number,
  },
  isSpeak: {
    // 是否关闭互动
    type: Boolean,
    default: false,
  },
  activityObj: {
    type: Object,
    default: () => ({}),
  },
  informMsgList: {
    // 聊天互动信息
    type: Array,
    default: () => [],
  },
  showPlayBtn: {
    type: Boolean,
    default: false,
  },
  online: {
    type: Number,
  },
  closeActivity: {
    type: Function,
  },
  sendMsg: {
    type: Function,
  },
});
</script>
<style scoped lang="scss">
.videoRef,
#player-container-id {
  width: 100%;
  height: 100%;
}
.video-wrap {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  video {
    width: 100%;
    height: 100%;
  }
  ::v-deep .video-js {
    width: 100%;
    height: 100%;
  }
}
.msg {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  border-radius: 16px;
  background: url(../../../assets/images/msg.png) no-repeat left 24px center;
  background-size: 32px 32px;
  background-color: red;
  color: #fff;
  margin-top: 16px;
  padding: 0 24px 0 68px;
  p {
    font-size: 24px;
    color: #ffffff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .close {
    display: block;
    width: 48px;
    height: 48px;
    background: url(../../../assets/images/close.png) no-repeat center;
    background-size: 32px 32px;
    margin-left: 34px;
  }
}
.opt-wrap {
  position: absolute;
  bottom: 40px;
  padding: 0 20px;
  width: 100%;
  box-sizing: border-box;
}
.input-area {
  display: flex;
  align-items: center;
  input {
    height: 64px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 32px;
    font-weight: 500;
    font-size: 24px;
    letter-spacing: 0;
    line-height: 24px;
    padding: 0 16px;
    flex: 1;
    color: #cccccc;
  }

  input::placeholder {
    color: #cccccc; /* 设置颜色为灰色 */
  }
  button {
    width: 64px;
    height: 64px;
    margin-left: 20px;
  }
  .star {
    position: relative;
    background: url(../../../assets/images/like-icon1.png) no-repeat center;
    background-size: cover;
    span {
      position: absolute;
      top: 0;
      right: 0;
      transform: translateX(50%) translateY(-50%);
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 4px;
      flex-direction: column;
      border-radius: 13px 13px 13px 4px;
      background: linear-gradient(
        128deg,
        #fff2dc -25.5%,
        #ffd9a7 89.14%,
        #605a52 89.14%
      );
      color: rgb(142, 81, 5);
      font-size: 18px;
      font-style: normal;
      font-weight: 500;
    }
  }
  .clear {
    background: url(../../../assets/images/clear.png) no-repeat center;
    background-size: cover;
  }
  .share {
    background: url(../../../assets/images/share.png) no-repeat center;
    background-size: cover;
  }
  .shop {
    background: url(../../../assets/images/shop.png) no-repeat center;
    background-size: cover;
  }
}
.interact-scroll {
  position: relative;
  height: 400px;
  overflow: hidden;
  text-align: left;
  flex: 1;
  margin-right: 20px;
  li {
    display: flex;
    align-items: center;
    font-size: 24px;
    font-weight: 500;
    letter-spacing: 0;
    text-align: left;
    color: #fff;
    margin-bottom: 12px;
    label {
      color: rgba(154, 191, 255, 1);
    }
  }
  p {
    line-height: 28px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 16px;
  }
  button {
    display: flex;
    align-items: center;
    width: 160px;
    height: 44px;
    line-height: 44px;
    border: none;
    border-radius: 20px;
    background-color: rgba(0, 0, 0, 0.3);
    background-repeat: no-repeat;
    background-position: left 10px center;
    background-size: 20px 20px;
    margin-left: 10px;
    padding-left: 32px;
    font-size: 24px;
    &.share {
      color: #ff3d36;
      background-image: url(../../../assets/images/share-icon2.png);
    }
    &.attention {
      color: #ff7d26;
      background-image: url(../../../assets/images/attention.png);
    }
  }
}
.msg-content {
  display: flex;
  align-items: flex-end;
  margin-bottom: 20px;
  .recommend-img {
    position: relative;
    width: 208px;
    height: 280px;
    margin-right: 10px;
    img {
      width: 100%;
      height: 100%;
    }
    i {
      position: absolute;
      width: 40px;
      height: 40px;
      border-radius: 50%;
      top: 0;
      right: 0;
      transform: translateX(50%) translateY(-50%);
      background: url(../../../assets/images/close-icon.png) no-repeat center;
      background-size: 100%;
    }
  }
}
.close-screen {
  position: absolute;
  bottom: 144px;
  right: 20px;
  width: 64px;
  height: 64px;
}

::v-deep .tcp-skin .vjs-control-bar {
  font-size: 2.4em;
  bottom: 100px;
  z-index: 3;
}
.record-play {
  ::v-deep .tcp-skin .vjs-control-bar {
    bottom: 20px;
  }
}

.plat-btn {
  position: absolute;
  left: 50%;
  width: 124px;
  height: 124px;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  top: 50%;
  transform: translate(-50%, -50%);
  img {
    width: 64px;
    height: 64px;
    display: flex;
  }
}
::v-deep .tcp-playlist {
  z-index: 2;
}
</style>
