angular - Angular VideoJs VR 导入问题
问题描述
然而,这可能是一个愚蠢的问题。
我对 Angular 有点陌生,目前在尝试使用 VideoJs VR 时遇到了一些问题。虽然 VideoJs 工作正常,但当尝试将 VR 用于 360 度视频时,控制台中会出现以下错误:(( video.es.js:97 VIDEOJS: ERROR: TypeError: three_examples_js_effects_VReffect_js__WEBPACK_IMPORTED_MODULE_8___default.a is not a constructor ))
这就是我包含 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});
}
}
编辑_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';
编辑_2:
所以我很愚蠢,文件是存在的,videojs-vr 有它自己的 node_modules 和这个特定的过时的三个版本。
解决方案
在最后一次尝试修复它时,如果发现这个:https ://fmoralesdev.com/2019/10/23/using-external-js-files-in-angular/ 所以是的,它现在可以工作了,我只需要包括它正确。
感谢您帮助@Gytis TG
推荐阅读
- postgresql - 远程 postgres 数据库在 azure 上经常断开连接
- amazon-web-services - 用于读取 CSV 文件的 Python Lambda 函数
- angular - 从 Nebular NbTreeGridComponent 更改列的宽度
- android - 权限拒绝:SurfaceFlinger 无法识别请求代码:1128 - Unity,Android
- android - 尝试将照片上传到烧瓶服务器
- http - 如何在詹金斯的脚本代码中添加允许的方法签名
- python - 减少 Django 视图和表单中的代码量
- ios - 用一个开关切换两个枚举
- excel - 循环遍历范围内的每个单元格,更快地替换值并添加评论
- php - 在第 3 方插件的快速视图中隐藏价格并添加到购物车按钮