首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Angular VideoJs VR导入问题

Angular VideoJs VR导入问题
EN

Stack Overflow用户
提问于 2020-10-08 00:04:22
回答 1查看 148关注 0票数 1

然而,这可能是一个愚蠢的问题。

我是Angular的新手,目前在尝试使用VideoJs VR时遇到了一些问题。虽然three_examples_js_effects_VREffect_js__WEBPACK_IMPORTED_MODULE_8___default.a运行良好,但当尝试使用VR处理360deg视频时,控制台中出现以下错误:(( video.es.js:97 VIDEOJS: ERROR: TypeError: VideoJs不是一个构造函数))

Screenshot: Console Error

这就是我包含VideoJs文件的方式:

代码语言:javascript
复制
import {Component, OnInit} from '@angular/core';
import videojs from 'video.js';
import 'videojs-vr';

@Component({
  selector: 'app-video-player',
  templateUrl: './video-player.component.html',
  styleUrls: ['./video-player.component.scss']
})
export class VideoPlayerComponent implements OnInit {

  player: videojs.player;

  constructor() {
  }

  ngOnInit(): void {
    this.player = videojs('videojs-vr-player');
    this.player.mediainfo = this.player.mediainfo || {};
    this.player.mediainfo.projection = '360';
    this.player.vr({projection: 'AUTO', debug: true, forceCardboard: false});
  }

}

edit_1:

这些文件或更多文件可能在三个文件中不存在,该解决方案是否正在降级三个文件?如果是这样的话,我将尝试这样做并结束我的问题。

node_modules/videojs-vr/dist/videojs-vr.es.js::

代码语言:javascript
复制
import VREffect from 'three/examples/js/effects/VREffect.js';
import OrbitControls from 'three/examples/js/controls/OrbitControls.js';

edit_2:

所以我很愚蠢,文件是存在的,videojs-vr有它自己的node_modules,这个特定的过时的三个版本。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-10-08 14:27:57

在最后一次尝试修复它时,发现了这个:https://fmoralesdev.com/2019/10/23/using-external-js-files-in-angular/所以它现在可以工作了,我只需要正确地包含它。

感谢您的帮助@Gytis TG

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64247969

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档