fix(whispering): fixed the issue with audio files on linux#1529
Open
Github11200 wants to merge 3 commits intoEpicenterHQ:mainfrom
Open
fix(whispering): fixed the issue with audio files on linux#1529Github11200 wants to merge 3 commits intoEpicenterHQ:mainfrom
Github11200 wants to merge 3 commits intoEpicenterHQ:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the issue where audio elements just showed some text saying error and weren't able to be played on Linux.
Changelog
Type of Change
feat: New featurefix: Bug fixdocs: Documentation updaterefactor: Code refactoring (no functional changes)perf: Performance improvementtest: Test additions or changeschore: Maintenance tasksstyle: Code style changesRelated Issue
Closes #1260
Changes Made
Inside an
$effectblock I first take the audio playback URL (something likeasset://localhost/%2Fpath%2Fto%2Faudio%2Ffile) and change it to be/path/to/some/file. This is done with the following code:With this file path, I then extract the raw blob data and create the
blobUrlfrom that as shown below:This
blobUrlis then directly used inside thesrcproperty for theaudioelement. This same process is used inside theRenderAudioUrl.sveltefile as well.The reason I convert the file to a blob and put in as the
srcproperty is because directly using theasset://localhostgives a 403 forbidden error on Linux. I believe this is an issue with Webkit2GTK as outlined in the following issue on Tauri, tauri-apps/tauri#3725.Testing
I ran
bun testand tested it on Linux. However, I am not certain that this same code works on other platforms as well so it would be great if someone tested it out.Desktop App Testing
General Testing
Checklist
typeinstead ofinterfacein TypeScriptAdditional Notes
The following snippet of code is duplicated across two files (
apps/whispering/src/routes/(app)/+page.svelteandapps/whispering/src/routes/(app)/(config)/recordings/RenderAudioUrl.svelte):Obviously, this is not very ideal and I'm planning on extracting the logic inside of the
$effectblock elsewhere. However, I was wondering where this logic could be placed (is there a utility file that already exists that could hold the code?). If anyone has other suggestions on how it could be refactored then I would love to know!