1、安装依赖:

npm install videojs-vr --save
npm install video.js --save

2、使用:

<template>
  <div>
    <video
      width="734"
      height="434"
      id="videojs"
      class="video-js vjs-default-skin"
      crossorigin="anonymous"
      controls
      playsinline
    >
      <!-- http://otaup.aiskill.komect.com/skill/RY_VR/res/%E5%A4%8D%E5%85%B4%E5%8F%B7%E9%AB%98%E9%93%81%E5%AE%89%E5%85%A8%E5%85%A8%E6%99%AF%E8%A7%86%E9%A2%91.mp4?AWSAccessKeyId=23011GA2YBECL7O214GH&Expires=1619168498&Signature=HDSRY%2Fp4Cw3UFXSgL%2FqhH8X8Aug%3D -->
      <source
        src="http://otaup.aiskill.komect.com/skill/RY_VR/res/%E9%BB%84%E5%B1%B1%E8%AE%B0.mp4?AWSAccessKeyId=23011GA2YBECL7O214GH&Expires=1619340145&Signature=Jyfh6T%2BjcvXAyZRD0kBBSAi0nSI%3D"
        id="videoVr-${contId}"
        type="video/mp4"
      />
    </video>
  </div>
</template>

<script>
import videojs from "video.js";
import videojsVr from "videojs-vr";
import "video.js/dist/video-js.css";
export default {
  name: "",
  components: {},
  props: {},
  data() {
    return {};
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {
    var player = (window.player = videojs("videojs"));
    // player.mediainfo = player.mediainfo || {};
    // player.mediainfo.projection = "360";
    //debug 为此插件启用调试日志记录
    //使用此属性将Omnitone库对象传递给插件。请注意,Omnitone库不包含在生成文件中。
    // AUTO is the default and looks at mediainfo
    //forceCardboard 强制硬纸板按钮在所有设备上显示,即使我们认为它们不支持它
    var vr = (window.vr = player.vr({
      projection: "360",
      debug: true,
      forceCardboard: false,
    }));
  },
  methods: {},
};
</script>

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

Logo

前往低代码交流专区

更多推荐