send Stream Data to icecast - java

i want to develop client that bind to icecast server just like butt or edcast but using java, I've found some library like jshout,libshout but I cant make it work in windows ;(, so I'm thinking not depend to some library, I got some information how to stream to icecast server from this link Icecast 2: protocol description, streaming to it using C# , my question is how o send the binary stream data to icecast server? should i using socket or there's another way to do that?
Thx

It's a simple HTTP 1.1 PUT request (just for now without chunked encoding) if you are running Icecast 2.4.0 or newer.
Once the connection is established, you just keep sending data from your encoder/muxer.
If you want to know what headers to send etc, then looking at libshout sources should help.

Related

How to send message from backend(java) to frontend(react)

Hi Im still learning how to use react and java. I am creating a project where the front end is in react and the backend is in java.
I was wondering if someone would be able to point me in the right direction or give me an example of java sending a message to the front end in react. What Im essentially trying to do is give the user a message after the backend receives a file they submit. I already have the part where the backend is processing the file.
Ive tried looking at a lot of sites but theres not a lot of documentation out there for react and java as the backend.
thank you
What you need is Websocket, he provide a full-duplex communication channels over a single TCP connection. So, when you start a comunication between client and server, a session is created, making possible to send and receive message for both side.
Some possibilities are, use javax:
https://docs.oracle.com/javaee/7/api/javax/websocket/package-summary.html
https://www.baeldung.com/java-websockets
Use spring-websocket(if are you already using spring, will be easy to use):
https://spring.io/guides/gs/messaging-stomp-websocket/
https://docs.spring.io/spring/docs/5.0.0.BUILD-SNAPSHOT/spring-framework-reference/html/websocket.html
Here is another example with javax https://www.pegaxchange.com/2018/01/28/websocket-server-java/
So, there are a lot of examples.
Websocket would open a channel between the client and the server, so you can send a server message at any time.
But, if you are already using a POST from the client to upload the file, you could just send a response to the POST.

Passing compressed JSON through socket in Java

I'm planning to split my current Java 7 application into server and client side. Server and client side should communicate using sockets.
Basically:
1) Client sends request to the server through a port.
2) Server generates JSON response and sends that response back.
3) Client should deserialize JSON.
Now, the problem is that response JSON is about 1MB in size! I have a limited experience with Java sockets and also communication with server needs to be language-agnostic so I'm not sure which type of stream should I use?
May I use GZipOutputStream (if produced results can be unzipped by GZIP lib from any language)? Should I use something else?
Please give me some advice :)
If plain socket is the only option then yes, using GZIPOutputStream is a good solution. It will generate a gzip format that is standards-compliant and thus readable by any language or tool supporting the gzip compression format.
If your client is java as well, you can use GZIPInputStream to decompress and get the json text back out.
A challenge will be implementing the socket server and (to lesser extent) the socket client code. I recommend to google for code examples and adjust them to your need.
I would recommend to use http protocol instead of plain socket. Implement your server on an application server, such tomcat or jetty. They are very easy to setup up.
To implement the client side, you can use apache http client.
An advantage of this approach is: You don't need to program http compression. You can configure it in tomcat. The http client will automatically decompress for you.

Flex : How can I get the audio stream on server side(tomcat)?

One of my web applications have developed in java and using tomcat server. Now I want add one more feature in my application that is peer to peer audio streaming. Actually I want that anyone speak (using microphone) on the client side and I will hear his voice on my server speakers and vice versa. Also save our communication in any file and also send the audio stream to IP intercom.
For that I am trying to use Flex Builder. Flex NetStream class is good for the streaming and we can also attached microphone. But the problem is on the server side. How can I get the audio stream on server side?
Or any other idea how can I get stream from server to client and vice versa?
I think the easiest way to do this would just be to run another client on your server. Maybe even a "special client".

rtsp server forwarding

So I am trying to stream a webcam feed from my computer to my android phone. I am using a simple forwarding server to connect the two so that I don't have to worry about home network IP firewalls ect. I am using FMJ to capture the video feed and was thinking rtsp protocol would be best because android supports reading it. My problem is I dont know how to forward the information via the server, is it as simple as forwarding UDP packets? all programs involved are implemented in java btw.
Use Netty. It is very easy to create an RTSP server with this library. For hints see the sources here.
Or you can port my library which is written in C#
http://net7mma.codeplex.com/
CodeProject article # http://www.codeproject.com/Articles/507218/Managed-Media-Aggregation-using-Rtsp-and-Rtp

how can I use multiple Players in J2ME to simulate streaming over Http

I need to connect to a http server from a phone and play a movie while downloading. I understand that you can simulate this using multiple players (Manager.createPlayer(...)) in J2ME but I dont know how.
Thanks
I just want to suggest some possible approach. But, these methods also depends on device's implementation of MMAPI.
Use RTSP protocol instead of HTTP. It needs server side support
Create new DataSource class which downloads video data by using socket
Get video data by using socket and append it to file. While downloading it pass file data to MMAPI as file:/// protocol

Categories

Resources