我使用的角度6连同视频am记录插件。我在项目中配置了以下依赖项。
npm install --save video.js
npm install --save videojs-record稍后,我使用以下import语句引用了视频the插件。
import videojs from 'video.js';
import 'webrtc-adapter';
import RecordRTC from 'recordrtc';
import Record from 'videojs-record/dist/videojs.record.js';虽然编译时没有报告错误,但当我点击浏览器时,会在控制台中得到以下错误。
Uncaught ReferenceError: global is not defined
at Object../node_modules/webrtc-adapter/src/js/adapter_core.js (adapter_core.js:13)
at __webpack_require__ (bootstrap:78)
at Module../src/app/app.component.ts (main.js:93)
at __webpack_require__ (bootstrap:78)
at Module../src/app/app.module.ts (app.component.ts:13)
at __webpack_require__ (bootstrap:78)
at Module../src/main.ts (main.ts:1)
at __webpack_require__ (bootstrap:78)
at Object.0 (main.ts:12)
at __webpack_require__ (bootstrap:78)请告诉我,我在这里错过了什么?
版本信息:
"video.js": "^7.2.3",
"videojs-record": "^2.4.1",
"@angular/compiler": "^6.0.3",
"@angular/core": "^6.0.3",更新-1:如果我更改webrtc-适配器导入从
import 'webrtc-adapter'至
import 'webrtc-adapter/out/adapter_no_global.js';如果出现以下错误,视频the将失败。
ERROR Error: plugin "record" does not exist
at Player.<anonymous> (video.es.js:19615)
at Array.forEach (<anonymous>)
at new Player (video.es.js:19611)
at videojs$1 (video.es.js:24059)
at AppComponent.push../src/app/app.component.ts.AppComponent.startRecording (app.component.ts:43)
at Object.eval [as handleEvent] (AppComponent.html:5)
at handleEvent (core.js:10251)
at callWithDebugContext (core.js:11344)
at Object.debugHandleEvent [as handleEvent] (core.js:11047)
at dispatchEvent (core.js:7710)更新-2:
我尝试使用角cli自定义器(https://github.com/nfriend/angular-cli-customizer),并遵循https://github.com/collab-project/videojs-record/wiki/Angular中指定的指令。
不幸的是,这也不起作用
发布于 2019-05-24 12:52:08
我也有同样的问题,但是我用下面的方法解决了它,您的"videojs-record/dist/videojs.record.js"文件没有加载到特定的组件上,所以请尝试从component.ts文件动态加载它
有关更多参考资料,请参见下面的链接Dynamically load external javascript file from Angular component
https://stackoverflow.com/questions/52686889
复制相似问题