From 7c3600adb07789c673148a88b830aa2db623f517 Mon Sep 17 00:00:00 2001 From: Aidan Timson Date: Sat, 16 Dec 2023 22:51:59 +0000 Subject: [PATCH] FIx --- src-tauri/tauri.conf.json | 2 +- src/lib/audioRecorder.ts | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index f27408f..851893d 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -33,7 +33,7 @@ ] }, "security": { - "csp": "default-src blob: data: filesystem: ws: http: https: 'unsafe-eval' 'unsafe-inline'" + "csp": null }, "systemTray": { "iconPath": "icons/icon.png", diff --git a/src/lib/audioRecorder.ts b/src/lib/audioRecorder.ts index 1cf5c2d..63025e6 100644 --- a/src/lib/audioRecorder.ts +++ b/src/lib/audioRecorder.ts @@ -1,4 +1,4 @@ -import { error } from "tauri-plugin-log-api"; +import { error, info } from "tauri-plugin-log-api"; export class AudioRecorder { private _active = false; @@ -73,14 +73,20 @@ export class AudioRecorder { private async _createContext() { // @ts-ignore-next-line this._context = new (window.AudioContext || window.webkitAudioContext)(); + info("Created audio context"); this._stream = await navigator.mediaDevices.getUserMedia({ audio: true }); + info("Created stream"); + info(`url: ${import.meta.url}`); await this._context.audioWorklet.addModule( new URL("./recorder.worklet.js", import.meta.url) ); + info("Added worklet"); this._source = this._context.createMediaStreamSource(this._stream); + info("Created source"); this._recorder = new AudioWorkletNode(this._context, "recorder.worklet"); + info("Created recorder"); this._recorder.port.onmessage = (e) => { if (!this._active) { @@ -90,5 +96,6 @@ export class AudioRecorder { }; this._active = true; this._source.connect(this._recorder); + info("Connected source to recorder"); } }