javascript - 屏幕共享 VideoJs-record 中未触发开始/停止共享按钮
问题描述
我已经集成了 videojs-record 插件以在 Angular 中与音频共享屏幕录制。在进行屏幕录制时,我可以进行屏幕录制,但需要单击两次开始按钮进行录制并且不会触发停止共享按钮。有什么帮助吗?下面是我的代码。
html文件:
<video id="video_{{idx}}" class="video-js vjs-default-skin text-center" playsinline></video>
组件.ts 文件
idx = 'clip1';
config: any;
player: any;
plugin: any;
constructor() {
this.setDefaultSetupOfVideo();
}
ngAfterViewInit() {
this.loadVideoSetup();
}
loadVideoSetup() {
// ID with which to access the template's video element
const el = 'video_' + this.idx;
// setup the player via the unique element ID
this.player = videoJs(document.getElementById(el), this.config, () => {
console.log('player ready! id:', el);
// print version information at startup
const msg = 'Using video.js ' + videoJs.VERSION +
' with videoJs-record ' + videoJs.getPluginVersion('record') +
' and recordrtc ' + RecordRTC.version;
videoJs.log(msg);
});
// device is ready
this.player.on('deviceReady', () => {
console.log('device is ready!');
});
// user clicked the record button and started recording
this.player.on('startRecord', () => {
console.log('started recording!');
});
// user completed recording and stream is available
this.player.on('finishRecord', () => {
// recordedData is a blob object containing the recorded data that
// can be downloaded by the user, stored on server etc.
console.log('finished recording: ', this.player.recordedData);
});
// error handling
this.player.on('error', (element, error) => {
console.warn(error);
});
this.player.on('deviceError', () => {
console.error('device error:', this.player.deviceErrorCode);
});
}
setDefaultSetupOfVideo() {
this.player = false;
// save reference to plugin (so it initializes)
this.plugin = Record;
// video.js configuration
this.config = {
controls: true,
autoplay: false,
fluid: false,
loop: false,
width: 506,
height: 380,
bigPlayButton: true,
controlBar: {
volumePanel: true
},
plugins: {
// configure videojs-record plugin
record: {
screen: true,
displayMilliseconds: false,
audio: true,
debug: true,
maxLength: 60,
}
}
};
}
解决方案
推荐阅读
- android - 由于空格 android,AWS S3 预签名 url 导致 SignatureDoesNotMatch 错误
- sql - SQL查询按最大日期分组
- windows - Windows 10 powershell ise 压缩归档文件在根 .in .zip
- python - 如何优雅地做出自定义断言错误?
- delphi - Delphi 应用程序在 Windows 10 系统上检索不正确的日期格式
- java - 从最大稳定极值区域中提取识别文本
- kotlin - 从数据库读取的缓存属性
- python - 如何为某些用户显示表单 Odoo 10
- r - 如何翻译参考文献/参考书目部分的标题?
- kotlin - 调用具有多个边界的泛型函数?