Live audio streaming from Java server to browser (Flash,HTML5) - java

For a project, I need to be able to stream live audio from a Java server to the browser on the client. My first guess was to use RTMP with a Flash player, my second guess to make use of the HTML5 audio tag. But so far, I've failed to find anything useful (like a library), so does anyone have any pointers on how to do this?
Here's the setup: The sound comes in from a VoIP server as a bunch of PCM samples. From there, it has to go to get to the client, while usually only one client listens to one stream. So I need to be able to send many VoIP streams to several clients, a simple form of authentication would also be nice (like a token or a secret URL where the stream is located at).
So far, I've looked at Red5 (looks to me like one-to-many streaming only) and searched for Java-based RTMP libraries. Any help is gladly appreciated!

Related

TeamSpeak 3 MusicBot in Java

I want to make a TeamSpeak 3 Musicbot in Java. But I don't find any Protocol from Teamspeak for the Voice transmission. And after searching for a Client API, for Java, I didn't find anything. Only for a ServerQuery but that doesn't help me I think.
I only want the Client to connect to the Server and then plays a Song, though that wouldn't be that hard!
Maybe you Guys can help me?
Teamspeak does not have an official client-api. You can only use the Query-API and create plugins. As the Query-API does not support any voice-communication, that's not the way you should go. The (most) official way of creating a Teamspeak3 MusicBot would be to run a client on your server which has a plugin installed which allows you to play music (more or less a soundboard). Sinusbot is exactly built this way.
Another "unofficial" option would be to make use of unofficial reverses of the teamspeak-protocol and built you own client from these. If you want more information about this, this repository might help you (and look for other projects the creator pushed, they might help you too).
I'm not quite sure if this helps, but have been developing a TeamSpeak 3 music bot using Kotlin, which is compatible with Java as it runs on the JVM (Java Virtual Machine)
The way it works is that it first launches the TeamSpeak client and connects to the desired server and channel, then it starts monitoring the chat log -> the bot can be controlled by entering commands into the chat.
The bot uses the TeamSpeak ClientQuery via Netcat to send messages to the chat.
It is completely client-side so you don't need to be server admin to get it working.
The bot currently supports Spotify, YouTube, and SoundCloud.
You can check it out at https://gitlab.com/Bettehem/ts3-musicbot

C++ to Java socket audio streaming

Hello, I'm trying to build client-server audio streaming app. Server has to be written in C and communicate with client using sockets (TCP). Client will be written in javafx (actually tornadofx, but that doesn't relate to the problem)
My doubts concern the streaming part. Server has several audio files. I want to be able to start, stop, rewind, skip to another song in the client app. Java has AFAIK two classes to play audio - Clip and SourceDataLine. I don't think sending the whole song before playing is the way to go (Clip, large sound files) so I guess I should stick with SourceDataLine. My simple guess is that I should send fairly small portion of audio every time the client comes close to listening the last portion he received. (e.g I send 30 seconds and when client is on 25th second he sends request for more) Is that right? Is that doable in previously mentioned technologies?
Maybe something like ffmpeg could be useful here
https://github.com/avTranscoder/avTranscoder
But again, I have to communicate over tcp sockets only.

RTSP Media Server Using Netty

After carrying out some research I have found out that an RTSP media server for develivering video and audio can be implemeneted in java using Netty. After consulting the web site and veiwing the documentation I have still not found any real help on how an RTSP media server can be implemeneted using it. I have been stucktrying to solve this problem for a while now and I am well aware of the RTSP protocol, other streaming protocols and all the issues that come with streaming media. Could someone please piont me at a place to start so that I can slowly work my way through the implemenattion of an RTSP server in java (Netty). Any online documentation or source code that is reasonably close to this issue, or shows the very basics would be a great help. Thank you.
You could take a look at flazr which is Netty implementation for streaming protocols like RTMP. Another place where you might find relevant information is the related projects page of Netty.
I think the best way to solve it is to create a new Netty project and make a HTTP server and client, then modify it into a RTSP server and client.

Red5 Streaming dynamic Content

I'm getting my feet wet with red5 and am trying to make a basic app that will stream a random video to the client.
Let's say I have 3 flvs on my server, I'd like a client to connect to my red5 app and have 1 of these 3 videos streamed to them. The only streaming i've been able to figure out so far uses netStream.play("video.flv"), this doesn't work for me, I wan't the server to decide on the file to stream rather than the client, any help is really appreciated, thanks in advance.
We've made a first-pass at supporting dynamic streaming and you can read my post about it here: http://gregoire.org/2011/07/19/dynamic-streaming-with-red5/

Are there any good APIs for maintaining an open connection between Flash <--> Java

I have a flash app which will send/receive a constant stream of data.
the flash app should open a connection to the Java server, keep it open, and attempt to reconnect on socket failure.
Are there any good APIs that offer this functionality? Smartfox Server is one option, but if I had my way I'd embed an API in my app rather than contort my app to run under Smartfox.
Ideally it would offer an API on the flash end, another on the Java end, and efficiently (java nio preferably) handle the network component in between. I would just define handlers on both the client & server.
You could use BlazeDS. It's an open source RTMP server from Adobe written in Java. You don't need any special library on the client side as RTMP is native in Flash.
There are many examples on the web: here , here.

Categories