vue/uniapp实现浏览器录屏功能(视频+音频)

RecordRTC使用

安装

npm install recordrtc -S
import RecordRTC from 'recordrtc';

代码:







引入

import screenRecording from '@/components/screen-recording/screen-recording';

注册…

组件:


开启录屏:

//开始录制
this.$refs['screen-recording'].startRecording((start)=>{
	this.start= start;
});

结束录屏:

this.fileName =`${this.mNm}-录屏-${this.$util.dateFormat(new Date())}`;
this.$refs['screen-recording'].stopRecording((start)=>{
	this.start= start;
});

监听关闭:

//流停止监听
streamStop(){
	if(this.start){
		this.fileName =`${this.mNm}-录屏-${this.$util.dateFormat(new Date())}`;
		this.$refs['screen-recording'].stopRecording((start)=>{
			this.start= start;
		});
	}
},

Demo
https://www.webrtc-experiment.com/

你可能感兴趣的:(uniapp,vue,vue,uni-app,node.js)