<template>
  <div>
    <MMCPlayer
      title="测试播放器"
      :streamOptions="streamOptions"
      @close="onClose"
      :obstacleData="obstacleData"
    ></MMCPlayer>
  </div>
</template>

<script>
export default {
  data() {
    return {
      streamOptions: [
        {
          label: "播放源1",
          value:
            "https://sf1-hscdn-tos.pstatp.com/obj/media-fe/xgplayer_doc_video/flv/xgplayer-demo-360p.flv",
          fpvUrl:
            "http://219.151.31.38/liveplay-kk.rtxapp.com/live/program/live/hnwshd/4000000/mnf.m3u8",
        },
        {
          label: "播放源2",
          value:
            "http://219.151.31.38/liveplay-kk.rtxapp.com/live/program/live/hnwshd/4000000/mnf.m3u8",
          fpvUrl:
            "https://sf1-hscdn-tos.pstatp.com/obj/media-fe/xgplayer_doc_video/flv/xgplayer-demo-360p.flv",
        },
        {
          label: "播放源3",
          value:
            "pzsp://pzlink999bju.powzamedia.com:7788/live/ld/trans/test/mlinkm/channel1?ndselect=2&linkmode=8&fstusrd=1&us=1&wsinfo=pzlink999bju.powzamedia.com-13000&only-video=1&rct=500",
        },
      ],
      obstacleData: null,
      /* { 
          distances: [], //array<int>（36个值每10度一个与障碍物的距离厘米）; 
          obsDistance: 0,  //int(避障警告距离米)}
        } */
    };
  },
  mounted() {
    //模拟数据
    setInterval(() => {
      let data = {
        distances: [],
        obsDistance: 15,
      };
      for (let i = 0; i < 36; i++) {
        data.distances.push(Math.random() * 10 * 100);
      }
      this.obstacleData = data;
    }, 1000);
  },
  methods: {
    onClose() {
      alert("关闭");
    },
  },
};
</script>

<style lang="scss" scoped>
</style>