A powerful and flexible screen recording component for Vue 3 applications with TypeScript support.
- 🎥 Screen recording with audio support
- ⏯️ Pause and resume functionality
- 📊 Recording duration display
- 💾 Download recordings
- 🎛️ Configurable recording options
- 🔧 TypeScript support
- 🎨 Customizable styling
- 🔤 Customizable button labels
- 🎯 Flexible slots for custom UI
npm install vue-advanced-screen-recorder
<template>
<VueAdvancedScreenRecorder
:options="{
mimeType: 'video/webm',
videoBitsPerSecond: 2500000,
audioBitsPerSecond: 128000,
frameRate: 30,
audio: true,
buttonLabels: {
start: 'Start Recording',
stop: 'Stop Recording',
pause: 'Pause',
resume: 'Resume',
download: 'Download Recording'
}
}"
@start="onStart"
@stop="onStop"
@pause="onPause"
@resume="onResume"
@error="onError"
/>
</template>
<script setup lang="ts">
import VueAdvancedScreenRecorder from 'vue-advanced-screen-recorder'
const onStart = () => {
console.log('Recording started')
}
const onStop = (blob: Blob) => {
console.log('Recording stopped', blob)
}
const onPause = () => {
console.log('Recording paused')
}
const onResume = () => {
console.log('Recording resumed')
}
const onError = (error: Error) => {
console.error('Recording error:', error)
}
</script>
<template>
<VueAdvancedScreenRecorder>
<!-- Custom controls -->
<template #controls="{ isRecording, isPaused, startRecording, stopRecording, pauseRecording, resumeRecording }">
<div class="my-custom-controls">
<button @click="startRecording" :disabled="isRecording">
{{ isRecording ? 'Recording...' : 'Start' }}
</button>
<!-- Add other custom controls -->
</div>
</template>
<!-- Custom actions for recorded video -->
<template #actions="{ downloadRecording, recordedBlob, recordedUrl }">
<div class="my-custom-actions">
<button @click="downloadRecording">Save Recording</button>
<button @click="customHandleVideo(recordedBlob)">Process Video</button>
</div>
</template>
<!-- Custom recording status -->
<template #status="{ isRecording, duration, formattedDuration }">
<div class="my-custom-status">
Recording time: {{ formattedDuration }}
</div>
</template>
</VueAdvancedScreenRecorder>
</template>
- Type:
Object
- Optional: Yes
- Default:
{
mimeType: 'video/webm',
videoBitsPerSecond: 2500000,
audioBitsPerSecond: 128000,
frameRate: 30,
audio: true,
buttonLabels: {
start: 'Start Recording',
stop: 'Stop Recording',
pause: 'Pause',
resume: 'Resume',
download: 'Download Recording'
}
}
Slot for custom control buttons with the following props:
-
isRecording
: boolean -
isPaused
: boolean -
startRecording
: () => Promise -
stopRecording
: () => void -
pauseRecording
: () => void -
resumeRecording
: () => void
Slot for custom actions after recording with the following props:
-
downloadRecording
: () => void -
recordedBlob
: Blob | null -
recordedUrl
: string | null
Slot for custom recording status with the following props:
-
isRecording
: boolean -
duration
: number -
formattedDuration
: string
-
start
: Emitted when recording starts -
stop
: Emitted when recording stops, includes the recorded blob -
pause
: Emitted when recording is paused -
resume
: Emitted when recording is resumed -
error
: Emitted when an error occurs, includes the error object
MIT