然而,这可能是一个愚蠢的问题。
我是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不是一个构造函数))
这就是我包含VideoJs文件的方式:
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::
import VREffect from 'three/examples/js/effects/VREffect.js';
import OrbitControls from 'three/examples/js/controls/OrbitControls.js';edit_2:
所以我很愚蠢,文件是存在的,videojs-vr有它自己的node_modules,这个特定的过时的三个版本。
发布于 2020-10-08 14:27:57
在最后一次尝试修复它时,发现了这个:https://fmoralesdev.com/2019/10/23/using-external-js-files-in-angular/所以它现在可以工作了,我只需要正确地包含它。
感谢您的帮助@Gytis TG
https://stackoverflow.com/questions/64247969
复制相似问题