Skip to content

Commit

Permalink
fix: 'Record camera separately' doesn't have effect, close #358
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Sep 30, 2021
1 parent 0c4e33d commit 1b4ecbe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 0 additions & 2 deletions .vscode/settings.json
@@ -1,8 +1,6 @@
{
"prettier.enable": false,
"typescript.tsdk": "node_modules/typescript/lib",
"volar.tsPlugin": true,
"volar.tsPluginStatus": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
},
Expand Down
14 changes: 8 additions & 6 deletions packages/client/logic/recording.ts
Expand Up @@ -83,7 +83,7 @@ export function useRecording() {
return

streamCamera.value = await navigator.mediaDevices.getUserMedia({
video: currentCamera.value === 'none' || recordCamera.value === false
video: currentCamera.value === 'none' || recordCamera.value !== true
? false
: {
deviceId: currentCamera.value,
Expand Down Expand Up @@ -117,13 +117,13 @@ export function useRecording() {
const { default: Recorder } = await import('recordrtc')
await startCameraStream()

// @ts-expect-error
streamSlides.value = await navigator.mediaDevices.getDisplayMedia({
video: {
// aspectRatio: 1.6,
frameRate: 15,
width: 3840,
height: 2160,
// @ts-expect-error
cursor: 'motion',
resizeMode: 'crop-and-scale',
},
Expand Down Expand Up @@ -153,10 +153,12 @@ export function useRecording() {
async function stopRecording() {
recording.value = false
recorderCamera.value?.stopRecording(() => {
const blob = recorderCamera.value!.getBlob()
const url = URL.createObjectURL(blob)
download(getFilename('camera'), url)
window.URL.revokeObjectURL(url)
if (recordCamera.value) {
const blob = recorderCamera.value!.getBlob()
const url = URL.createObjectURL(blob)
download(getFilename('camera'), url)
window.URL.revokeObjectURL(url)
}
recorderCamera.value = undefined
if (!showAvatar.value)
closeStream(streamCamera)
Expand Down

0 comments on commit 1b4ecbe

Please sign in to comment.