Gstreamer server client with java - java

I'm new to gstreamer and I need some push in the right direction. I need to create a chat application that uses webcams and audio on both ends and uses java to do this. I dont want to install other stuff on the client more than my application. And the server can be used as a connection between the clients OR used on one end.

Related

Java Server and client/ RMI or Socket?

I'm developing a Desktop LAN base java server and client application
where a Client must login and also to pass some data to server.
assuming i have 10 clients that inserting record simultaneously to server.
which is the best approach in this kind of situation, should I use RMI for login and record insertion? or Sockets?
if sockets please provide a key idea for me to start with.
key points to consider
-Multithreading
-able to send back data on client
If you want to connect your server via internet (and/or firewalls) it is probably a hassle to do this with plain RMI. In the past I have used Java Simon for such tasks which is very easy to implement. However if you plan to support other clients than Java clients, then you should have a look at Apache Thrift or Google Protocoll Buffers

How can an Android application function as a remote controller to a desktop application? (Spotify)

I am in the planning stages of developing an Android application to control my Spotify player. Since I am running Debian on my system, the options that are available on the Play Store are quite limited (I can't find any functioning apps). Therefore, the programmer inside me tells me to build one. I haven't built an Android application before, but I have good experience with working with APIs so I think this could be a pretty decent starter project for me.
However, I am having some difficulties grasping some of the concepts on how I could implement this. With some research of the Spotify API documentation, I believe the Spotify Apps API is the one I should be using to control playback on the desktop.
On the Android side of things, I would imagine I would use the Spotify Apps API in conjunction with the Libspotify API to receive metadata and display what the application is getting from the desktop playback.
What I am having troubles understanding is how does the Android application talk with the Spotify desktop client? I have a few ideas, but I am unsure...
My thought process so far is as follows:
have a local webserver on the desktop open up and begin listening
on the Android application, connect to the desktop's webserver (how do you do this?)
once connected, the desktop sends metadata/other information to populate the Android application
from the Android UI, hitting a UI button will send a request to the webserver, where it parses the data, completes an action, and then returns the response to the Android application
I am a little lost on what tools I need to learn and use to get this working. Any suggestions to the implementation are greatly appreciated!
Thank you!
Your approach is correct.
On host (desktop), open a socket and listen on port 80 (or another port if you wish) and listen. It doesn't need to be a full web server.
On client (Android), to start with send an http request to the desktop' ip address. Desktop responds with a simple web page.
That's how you get the two communicating.
Then you can start POSTing data to the desktop and returning data in the web page.
Then you can move to communicating using JSON rather than web pages.
You can program both the host and client using Qt. You can develop both on the desktop and move the client to Android (or iPad) when you have got it working.
Yes, you are on the right track. If you know java then you can use Java Sockets to connect android and desktop. It should work on Debian. On the server side, you need to create a socket on specified port.
ServerSocket serverSocket = new ServerSocket(PORT);
Then wait for a client to connect
Socket clientSocket = serverSocket.accept();
On the client side, create a socket and connect to the server using IP and port
InetAddress serverAddr = InetAddress.getByName(“SERVER_IP”);
Socket socket = new Socket(serverAddr, PORT);
You can control a lot of things on your desktop using java.awt.Robot class. It let's you simulate keyboard and mouse events. So if you have some hotkeys enabled for Spotify then you don't need Spotify APIs to control it. Just simulate keyboard event. So if spacebar is a hotkey for play/pause then run this on server
robot.keyPress(KeyEvent.VK_SPACE);
This article explains this complete process by creating a simple remote control for vlc

UDP packet capturing on a servlet application running at GAE

I have a code running in router that sends UDP packets(using Sendto() function and a string of data) to a particular server whose IP address and port number I will mention in my code.
I want to deploy a server application that could receive a UDP packet and store its information on server or somewhere else not sure right now.
I have decided to use Google app Engine for hosting my server side code which most probably will be having something like recvfrom() function to receive string.
So how and by using what API's can I start developing my server side code.
Google App Engine has a Preview release of a Socket API, but it does not let you create listening sockets. See Limitations and restrictions section at https://developers.google.com/appengine/docs/python/sockets/
You cannot create a listen socket; you can only create outbound sockets.
You can use Google Compute Engine to run any reasonable software on Google's cloud platform, including programs that receive UDP datagrams. You must always pay for Compute Engine instances.
According to the newest edition of App Engine Socket docs for Java, if you're using java 8 runtime you should be able to use java sockets without limitations:
Applications in the Java 8 runtime default to using native Java
sockets with no restrictions: Google recommends that you keep this
default.
That means that it should be possible to use java.net.DatagramSocket or java.nio.channels.DatagramChannel freely to work with UDP.

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".

Java jar application and java web application communication and implementation

I have a multiplayer game server application written in Java which connects to player clients when they join the multiplayer game via a socket. The server application (a JAR running in the JVM) is listening to a port (e.g. 9999) for incoming connections from clients.
I want to add a website to minitor the entire project which contains information taken from the running game server(s). One way would be to open a socket from the site (a PHP socket for example) to the gameserver (Java) and implement a custom protocol for taking data from the server. But that method is time consuming as I need to add support for each type of datum I want to pass to the monitoring website.
I was thinking if there is a way to write the site in Java and simply communicate with my gameserver via a direct link. RMI would be a solution I assume since both my JAR and my WAR can communicate through it, but isn't there some better way to build both the web application and the gameserver application inside the same JAR file? So that when my gameserver runs, the web application runs too?
this looks to me as the fastest way to have an admin console. Just transform your server into a war application which contains both your game server with an open socket for clients and your administration pages. To start your server simply drop it into a tomcat.
A cleaner approach which does not require some self-created protocol would be to have your server use mbeans for all key objects which you would like to admin. But this needs some coding.
Cheers, Sven
You should have an embedded web server in your game server. Try Jetty (http://jetty.codehaus.org/jetty/). It's quite easy to embed in any java application.

Categories

Resources