<template>
    <popup v-if="show">
      <i @click="$emit('close')" class="iconfont iconbs_close closeicon"></i>
      <div class="ui-message ui-message-confirm">
        <div class="ui-message-main">
          <template v-if="item.hotspotType=='textarea'">
            <div class="v-textarea">
              <span>{{item.textarea}}</span>
            </div>
          </template>

          <video
              v-else
              id="myVideo"
              ref="video"
              webkit-playsinline='true'
              playsinline='true'
              x5-video-player-type='h5' 
              x5-video-player-fullscreen='true'
              controls
              class="video-js"
              :poster="item.video.icon"
            >
            <source
              :src="item.video.ossPath"
            >
          </video>
          <!-- <video :poster="item.video.icon"  controls autoplay :src="item.video.ossPath"></video> -->
        </div>
      </div>
    </popup>
</template>

<script>
import Popup from "@/components/shared/popup";

export default {
  props:['show','item'],
  components:{
    Popup
  },
  data(){
    let typeStr={
      image:'icon',
      pano:'previewIcon'
      // image:'icon',
      // image:'icon',
    }
    return {
      typeStr
    }
  },
  mounted(){
    this.$nextTick(() => {
        try {
          this.myPlayer = this.$video('myVideo', {
          loop: true,
          preload: 'auto'
        })
        } catch (error) {
          error
        }
    })
  }
}
</script>

<style lang="less" scoped>
.ui-message{
  width: 100%;
  background: none;
  border: none;
  max-width: 100%;
  padding: 0;
}
.closeicon{
  position: fixed;
  color: rgba(255, 255, 255, 0.88);
  top: 28px;
  font-size: 14px;
  right: 28px;
}
.ui-message-confirm{
  border-radius: 0;
  .icon-close{
    color: #909090;
  }
  .ui-message-main{
    width: 100%;
    font-size: 0;
    position: relative;
    >img{
      width: 100%;
    }
    video{
      min-height: 210px;
      width: 100%;
    }
    .v-textarea{
      width: 100%;
      max-height: 540px;
      overflow-y: auto;
      padding: 30px 50px;
      text-align: left;
      >span{
        font-size: 14px;
        color: #202020;
        word-break: break-all;
      }
    }
    
  }
  .ui-message-footer{
    width: 100%;
    .btn{
      width: 80%;
      display: flex;
      justify-content: center;
      margin: 0 auto;
      .ui-button{
        max-width: 104px;
      }
    }

  }
}
</style>

<style lang="less" scoped>
@import './preview.less';
</style>