-
Notifications
You must be signed in to change notification settings - Fork 2
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
browser compatibility #1
Comments
@lmick002 I don't think so. Maybe if you compile |
I'm not clear about usage. If it's not in a browser how do you use this package? |
@starapple2 You should use it in a Node.js environment. It's a shortcut to the original xiph/Icecast-libshout that's written in C.
|
@VictorQueiroz, thanks for your response. So I can include it in a project and connect to it from the browser via websockets, is that it? I am trying to get clarification on what I think @lmick002 was asking. |
@starapple2 I think the server uses TCP sockets. If I am correct, the best final solution would be to have a web socket server, that will be a proxy between the front-end and the TCP server, as it will do the translation for you. For example:
|
@VictorQueiroz, aha. Beyond the simplicity I envisaged. As is, what would be a use case? A Node.js dedktop app? |
@starapple2 In my case, I used it for creating a Node.js coimmand-line tool that would transmit the microphone audio to an Icecast server, so I could listen it from distance. |
@VictorQueiroz, in my case I want to send the mic from the browser window to Icecast. |
@starapple2 Then create the web socket server using a Node.js server and use the library to transmit whatever is sent to the websocket from the browser. You can also use a WebWorker to avoid blocking the UI thread. |
@VictorQueiroz, I have created a server and have been looking for the correct libshout package to integrate and receive the connection from the client JavaScript. Each library I've seen appears to want a file rather than a blob that the script generates. |
@starapple2 Steps I suggest are:
It's either this, or add WebSocket support for the icecast server, which is not the best choice IMHO. |
@VictorQueiroz I've just added libshout to the project and will see what's what. I am looking at the Readme and seeing a const to a directory path to a file so I imagine that would need to be amended for what is sent from the encoder. |
@starapple2 I think you can send the file by chunks however you want and the Icecast server clients will be able to play it as soon as there's something that can be decoded. This library behaves exactly as the original libshout library. It even has the same methods, so you can just read the libshout documentation for more information about usage of the library. If any method is missing, let me know, and I can add it quickly. I plan to add asynchronous functionalities to it later. |
@VictorQueiroz , I added opus-codec to the project. Is it then redundant based on what you said just now? This is what I had originally written for some library
This part I need to be clear about:
|
@starapple2 Seems about right, but read this from my opus library to be able to use it properly. For now, you can try on the UI thread first for simplicity, but the audio decoding is supposed to be done in a WebWorker to avoid blocking the UI thread. Otherwise, you might have cropped milliseconds. |
@starapple2 There's this app I developed using this opus codec library, you can take a look at it: https://github.com/rectimeproject/web It might help you on audio decoding. |
@VictorQueiroz I have been using vanilla JavaScript to save a recording from an online example. I'm not familiar with React and most of these libraries as most of my Web activity is a bit of PHP and occasionally some simple JavaScript. |
@VictorQueiroz, I can't seem to initialize libshout using "require" and "import" isn't usable in this context. I keep getting Shout is not defined. |
@starapple2 In the code you sent, you're using |
I replaced with libshout from the start.
…On Mon, Jul 3, 2023, 1:26 p.m. Victor Queiroz ***@***.***> wrote:
@starapple2 <https://github.com/starapple2> In the code you sent, you're
using shout package, not libshout. Can you try with libshout and see?
—
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIAE2PJA6MLJVAUHXCWJHXDXOL6DHANCNFSM5HWEXICA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@starapple2 Can you provide more information, like, what Node.js version you're using? |
@VictorQueiroz it could just be that I'm doing something wrong:
The error: It's Node v14.21.2. |
That accent (^) is actually pointed at "new". |
@starapple2 Try this: const { Shout } = require('libshout');
const s = new Shout();
s.setHost('localhost');
s.setProtocol(0);
s.setPort(8000);
s.setUser('source');
s.setPassword('MyPassW');
s.setMount('/stream.mp3'); Also notice that there is no |
@VictorQueiroz, the error is: |
@starapple2 Check the |
@VictorQueiroz, are you sure? What's the difference? The error message is the same. |
@starapple2 Did you try what I suggested? |
Sorry, I missed what you suggested @VictorQueiroz . Did you mean the usage example? TYhis was the message using that example: SyntaxError: Cannot use import statement outside a module |
@starapple2 No. I sent you some code here, please check and let me know. Here: #1 (comment) |
Ahh. I tried that and posted the error @VictorQueiroz: const s = new Shout(); |
@starapple2 Sorry about the delay. I think the README is wrong, but it should work like that by default, so I will change the behavior to be const Shout = require('libshout'); |
Thanks @VictorQueiroz, you've got it. Now no errors and console says "App listening at http://localhost:3000". I'll now muddle through sending data from the client, amending the code to expect data rather than searching a folder for a file. |
@VictorQueiroz, do you have an example, or can you write one, of using a playlist? I generate a playlist from files staged for upload and use the file url as their link since JavaScript cannot provide local paths in the file system. I'll work on accessing the mic stream after sorting out a playlist. |
Is it possible to use this package in a browser environment?
The text was updated successfully, but these errors were encountered: