We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<template> <div class="video-recorder"> <video ref="video" controls crossorigin="anonymous"> <source src="http://127.0.0.1:8888/test.mp4" type="video/mp4" /> </video> <div class="controls"> <button @click="startRecording">start</button> <button @click="stopRecording">stop</button> </div> <video v-if="downloadLink" controls :src="downloadLink"></video> </div> </template> <script> import RecordRTC from "recordrtc"; export default { data() { return { recorder: null, downloadLink: null, stream: null, }; }, methods: { async startRecording() { this.downloadLink = null; const videoElement = this.$refs.video; videoElement.play(); this.stream = await videoElement.captureStream(); const options = { type: 'video', mimeType: 'video/webm', frameRate: 10 }; this.recorder = RecordRTC(this.stream, options); this.recorder.startRecording(); }, stopRecording() { if (this.recorder) { this.recorder.stopRecording( (() => { const blob = this.recorder.getBlob(); this.downloadLink = URL.createObjectURL(blob); if (this.stream) { this.stream.getTracks().forEach((track) => track.stop()); } }).bind(this) ); } }, }, }; </script>
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The code is as follows
The text was updated successfully, but these errors were encountered: