<script setup lang="ts">
import ScreenRecorderVue from "screen-recorder-vue";
// Your other logic code...
</script>
<template>
<!-- your other components... -->
<ScreenRecorderVue />
</template>
<script setup lang="ts">
import ScreenRecorderVue from "screen-recorder-vue";
const videoOptions: MediaTrackConstraints = {
width: 1920,
height: 1080,
frameRate: 60,
};
// Your other logic code...
</script>
<template>
<!-- your other components... -->
<ScreenRecorderVue
preview
start-btn-text="🛫 start"
start-btn-style="color: #48bfa7"
end-btn-text="🛑 end"
end-btn-style="color: red;"
:video-options="videoOptions"
/>
</template>
<script setup lang="ts">
import ScreenRecorderVue from "screen-recorder-vue";
const onStart = (mediaStream: MediaStream) => {
/** Your logic code **/
}
const onError = (err: unknown) => {
/** Your logic code **/
}
const onUnsupport = () => {
/** Your logic code **/
}
const onEnd = (blobUrl: string, blob: Blob) => {
/** Your logic code **/
}
// Your other logic code...
</script>
<template>
<!-- your other components... -->
<ScreenRecorderVue
preview
@recording-start="onStart"
@recording-end="onEnd"
@recording-unsupport="onUnsupport"
@recording-error="onError"
/>
</template>
<script setup lang="ts">
import { ref } from "vue";
import ScreenRecorderVue from "screen-recorder-vue";
const recording = ref(false);
const start = (startEvent: Function) => {
startEvent();
recording.value = true;
};
const recordingEnd = (url: string) => {
recording.value = false;
console.log(url);
// to do sth for url
};
// Your other logic code...
</script>
<template>
<!-- your other components... -->
<ScreenRecorderVue preview @recording-end="recordingEnd">
<template v-slot:start="{ startEvent }">
<!-- your custom components... -->
<button v-if="!recording" @click="start(startEvent)">start</button>
</template>
<template v-slot:end="{ endEvent }">
<!-- your custom components... -->
<button v-if="recording" @click="endEvent">end</button>
</template>
<template v-slot:preview="{ mediaStream }">
<!-- your custom components... -->
<div>
<video muted autoplay width="500" :srcObject="mediaStream"></video>
</div>
</template>
</ScreenRecorderVue>
</template>