直接上源码,我的代码借鉴了这个老哥用Vue.js写的https://blog.csdn.net/blueXh/article/details/88955821
html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Screen Record</title>
<link rel="stylesheet" href="index.css">
</head>
<body>
<button id="start" onclick="startRecording()">录屏</button>
<button id="stop" onclick="stopRecording()">停止录屏</button>
<video id="video" controls autoplay></video>
<script src="https://cdn