-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't use Buffer in browser #37
Comments
See #14 (comment) |
@jlkiri Have you figured out how to use it in browser? @guest271314 Where does Thanks! |
If I recollect correctly I built it using browserify.
Unminified, at the end of the script version: '2.0.2' |
Great, thanks! Any chance to recover the build script/config used to build it? The file has a bunch of unused strings including the entire README. I would not mind repackaging it.
Yes, I see it now, thanks! |
I created that some time ago. If I recollect correctly I used a Unfortunately the I think we can re-write the entire script without using |
Yes, that's exactly why I'm here :)
I don't think I understand it well enough to try. Another option is to import |
You are already trying, right now. The first step is identifying the issue, then proposing solutions, then testing proposed solutions.
For me the idea is to get away from Node.js specific code, not continue those patterns. I use QuickJS and Deno without any package.json file just to import Ecmascript modules. Is there an issue with just using the minified code I already published to gist? |
See https://cdn.jsdelivr.net/npm/[email protected]/src/buffer-type.d.ts for ts-ebml TypeScript version of extending |
Kind of. First, as I said before, it includes a lot of unused strings, including the entire README file. It would be nice to get rid of them. Second, I want to be able to rebuild it if ts-ebml changes. Then it's also a bit of a black box. I would have to explain it to my users which I really can't other than "I hope it's OK".
Thanks! If I understand correctly, the |
BTW, there is also this https://github.com/buynao/webm-duration-fix which solves the same problem. I have not tried it yet. |
I think you can safely remove the commented lines 6265-6269 here https://plnkr.co/edit/QijGTcjFreeNvnKd?open=lib%2Fscript.js&preview.
On the readme.mf of this repository it is stated https://github.com/legokichi/ts-ebml#fork-of-node-ebml
which is here https://cdn.jsdelivr.net/npm/ebml.
The readme part that is commented in the linked plnkr (above) explains what the ts-ebml does, and why it was necessary to create.
There is also https://github.com/davedoesdev/webm-muxer.js. Really depends on what you are trying to do. Technically it is possible to record Opus audio and VP8/VP9 without a WebM (Matroska) container, and play back the file https://github.com/guest271314/WebCodecsOpusRecorder. |
Here is EBML.js https://github.com/davedoesdev/webm-muxer.js/blob/main/EBML.js, commented. |
Yes, but it's basically a binary which no one can recreate. Sure, it's acceptable as a last resort. Just not great.
I'm recording in Chrome and want to playback in iOS and Android without recoding on the server. This is the project: https://github.com/tinode/webapp
Thanks! |
VLC cannot play the records it produces. |
We can re-write the code, without using You can parse the file and programmatically extract the I would just use the minified ts-ebml gist. That is what I do here https://github.com/guest271314/captureSystemAudio/blob/0a13aff6bb45850bd8ae55f9c68dd3b35c1bc4b6/native_messaging/capture_system_audio/background.js#L80-L95
If you want to understand the source code there is no substitute for reading every line of the code. The why is a non-short list of Chromium bug reports and specification issues.
Cool. I have no experience with iOS. |
Yes, I know. I wrote the algorithm to write Opus audio produced by WebCodecs to a single file and the algorithm to play back the file using Media Source Extensions or converting the file to a WAV. There was no roadmap for how to do that. There is no media container, e.g., WebM (Matroska) involved. Record your microphone, save the file, then upload the file back to the site for playback. |
@or-else Is there any reason you just don't explain in your README.md that Chrome/Chromium does not setting duration of WebM files produced by W3C specified |
I'm sure someone can. I cannot. Not without spending a week or two on figuring out how it all works.
It's not about explaining it in the README. As an open source project admin I want to use open source dependencies. Not just de-jure, but also de-facto, i.e. no cryptic binary blobs even if they are technically open source.
There is no problem with iOS (kind of). iOS flat out does not support webm. I use VLC there. VLC has no issues with these webm files. |
Then take the time to figure it out.
There is nothing cryptic going on here. Chrome refuses to support writing duration to WebM files produced by their implementation of
There are multiple options available. Perhaps begin your understanding and familiarity of the issue by reading the relevant specification and Chrome bugs listed in readme of this repository. There is also mpv.js https://github.com/Kagami/mpv.js, and a variety of other ways to playback WebM files. I would just use the minified file or for a full fledged library that is well-maintained https://github.com/davedoesdev/webm-muxer.js. |
@or-else Note, since you are evidently using, or considering using native applications, you can also write the duration with |
Which I would definitely do if I had unlimited time.
I'm taking about ts-eblm-min.js. It's minified js, pretty much unreadable and unmodifiable. That makes it cryptic in my book.
Yes, I know that. If you look at the ExoPlayer bug I filed and linked here, it describes this problem with Chrome.
Yes, that's a problem too. It's hard to choose a path which solves the problem with minimum effort. Nothing seems to work without issues. |
That is not true. You can unminify and mofigy the script right in Chrome DevTools sources panel.
ts-ebml works. |
It's software, so anything is possible. It's all about the amount of effort. The
I'm sure it does, just not without issues. For example, it depends on
As I said in the previous message: Nothing seems to work without issues. |
I linked to the unminified version yesterday https://plnkr.co/plunk/QijGTcjFreeNvnKd. How was that error generated? |
Thanks!
https://github.com/tinode/webapp/blob/eblm/src/widgets/audio-recorder.jsx#L275 |
You didn't use the minified script I compiled, which includes I am not sure why you are hesitant to just use the script I invested time to compile? |
I did not use it because, as I explained before, it's not truly open source.
I'm not hesitant. You told me about it just half an hour ago. I will try it. Thanks again. |
Yes, it is. Why do you think the code is not FOSS?
No. I linked to the code yesterday. And posted a pull request in this repository some time ago. |
As I explained before, "Open Source" means the source is open, i.e. readable and modifiable. A minified JS is not particularly readable or modifiable.
I found out about it 30 minutes ago when you said so in this conversation. |
Yes. That file is readable and modifiable.
Sure it is.
Then you havn't really been reading this issue or following links herein. See et al. |
Just for your own edification, on Chrome or Chromium browsers you can copy/paste or load a local file in DevTools: Sources => Snippets => New snippet, then paste the code, then click the icon |
I'm very very sorry that I disappointed you. |
You ain't disappointing me. I'm trying to help you. |
|
@or-else This is the original version of ts-ebml-min.js I compiled https://github.com/guest271314/MediaFragmentRecorder/tree/169d5ffc690604e9a6c94956c1b0a28a00d20984/ts-ebml. |
This https://bundle.run/[email protected] is the lastest release that I could find of https://github.com/feross/buffer. Then you can do something like https://plnkr.co/edit/uI2OMJE2klrD89yF?preview
|
It looks like https://github.com/buynao/webm-duration-fix works as is. |
Still uses |
The source code in the online demo uses the same code I do in ts-ebml-min.js
|
@or-else The source code for Your concern expressed earlier in this issue was that the minified ts-ebml-min.js I cobbled together in 2017 was "cryptic". It looks like https://media-recorder-demo.vercel.app/assets/index.edf6e09e.js includes the So, the claim that ts-ebml-min.js is "cryptic" must also apply to the code linked above. |
Buffer
is a node thing and while I know it's possible to use it in browser viabrowserify
I was wondering if there are other workarounds that do not make me usebrowserify
just to use this library.The text was updated successfully, but these errors were encountered: