Commit Graph
13 Commits
Author SHA1 Message Date
JonnyBurger 26c1debb7a Update docs for getRetryDelay() 2025-09-30 15:03:29 +02:00
JonnyBurger 548ca74c93 getRetryDelay() takes src as well 2025-09-30 14:59:48 +02:00
JonnyBurger 249d9444ce remove extra newline added 2025-09-30 14:11:48 +02:00
JonnyBurger d58b638277 Stop retrying UrlSource if CORS error is suspected 2025-09-30 14:11:17 +02:00
d426d36386 FLAC container support (#95)
* add a test

* recognize as input format

* scaffold flac demuxer

* implement getting metadata

* Implement mime type

* read all metadata + deduplicate stubs

* Read first packet

* copyright headers

* read the first packet

* Get entire first packet, work on advancing

* iterate over all samples

* testable with bun

* stub out metadata support

* parse descriptive metadata

* All in 1 file

seems more appropriate to the philosophy

* some parameters are not needed anymore all within 1 class

* skip over bytes we are sure are not the syncword

* run prettier

* timestamp is determined based on passed blocks, not maximumBlockSize

* no binary search needed!

* simplifications

* Finish demuxer reading sequentially

* more tests + add a file with a seektable

* don't throw if (this.audioInfo.minimumBlockSize !== this.audioInfo.maximumBlockSize

* Add docs

* Update format compatibility table

* Simplification

* confirm conversion is working

* Finish

* Resolve TODO comment

* Support images (read-only)

* Returning description as Uint8Array

* Cleanup of demuxer

* Misc renames

* Object on same line

* Resolve first batch of comments

* Throw errors on corrupt blocks, correctly use requestSlice()

* Fix description field

* Explain why last frame is a bit shorter

* Add FLAC to README

* Put track backings below demuxer

* convert to methods

* Reorder container checking

* getBlockSize() -> readBlockSize()

* bitStream -> bitstream

* better naming for bytes

* use .skip()

* Don't return blockSize twice in readFlacFrameHeader

* Use enum + switch to distinguish Flac block types

* Use else-if

* Use else-if

* Compressed switch statement

* readCodedNumber

* Update flac-misc.ts

* We don't need the bits variable at all

* reorder functions in flac-demuxer

* Handle gracefully not being able to load another sample

* Update flac-demuxer.ts

* blockingbit null

* use async instead of promise.resolve

* use binary search

* Replace recursion with while loop

* Add mutex to getPacket()

* Load more data not in getPacketAtIndex, but outside

* Apply suggestion from @Vanilagy

Co-authored-by: David P. <[email protected]>

* computeDuration() reads last packet

* Update flac-demuxer.ts

* share vorbis comment reading logic

* reuse vorbis comment writing logic, set vendor always to "Mediabunny"

* flush after writign

* Use FileSlice.tempFromBytes

* assert !== null

* fixing nitpicks

* apply suggestions

* fix ogg

* We are now muxing images

* apply suggestion

* Update src/flac/flac-muxer.ts

Co-authored-by: David P. <[email protected]>

* apply suggestion

* readSampleRate()

* seek outside writeHeader()

* mention vorbis metadata +  add to metadatatags comment

* should be able to -> can

* Add test in metadata tags

* Add test for packets being byte identical after remuxing

* compare to null

* no casting to uint8array

* make test pass

* Update flac-muxer.ts

* Call validateAudioChunkMetadata() and validateAndNormalizeTimestamp()

* `onFrame` option

* emit frames using onFrame

* Run prettier over files

* Fix FLAC PICTURE block logic, small other changes

* Update docs

* Remove .only modifier

* fix remuxing and add test

* Don't throw error if parsing fails in header, since hitting a syncword might just be coincidential

* Fix remaining type errors

---------

Co-authored-by: David P. <[email protected]>
2025-09-18 21:05:09 +02:00
Jonny Burger 4c313ad2a6 Enable headless mode for browser tests 2025-09-18 10:55:42 +02:00
Jonny BurgerandGitHub 667bc6888c Enable ESLint as formatter (#87)
* Enable ESLint as formatter

I was working on a different computer today, and the formatting on save did not work out of the box for me.

I had to manually enable this setting, most people have it probably but explicitly enabling it for this project makes it easier for contributors.

* Update settings.json
2025-09-03 18:14:05 +02:00
Jonny BurgerandGitHub f13a2e6732 Merge pull request #86 from JonnyBurger/url-source-allow-reading-small-files
Do not make UrlSource fail if the size of the file is smaller than 512kb (+ add a Vitest browser mode test)
2025-09-03 18:13:42 +02:00
Jonny BurgerandGitHub 0e6cddc941 Add a test (#77)
* Match Prettier style

This way, people who have Prettier as their default formatter in their Editor (probably the majority of people) will not have the code re-formatted to double quotes if they are saving

* Add trailing-comma option

* Instruct .vscode to use ESLint as a default formatter

* Discard changes to package.json

* Add a first test

* Setup CI

* Rename to test

* move tsconfig hacks to local tsconfig.json

* Better test title

* rename file

* Fix ts setup
2025-08-27 09:12:49 +02:00
Jonny BurgerandGitHub ffdaf2dacb Discard changes to package.json 2025-08-26 15:10:27 +02:00
JonnyBurger 448e43cbfc Instruct .vscode to use ESLint as a default formatter 2025-08-26 15:10:13 +02:00
JonnyBurger ef2094b0db Add trailing-comma option 2025-08-26 15:07:12 +02:00
JonnyBurger daa6bdbe1d Match Prettier style
This way, people who have Prettier as their default formatter in their Editor (probably the majority of people) will not have the code re-formatted to double quotes if they are saving
2025-08-26 15:03:54 +02:00