Synchronized streaming - java

I am working on website to upload movie and watch with others. Also, I am working on cloud.
Until know I did how upload movie and stream it on website but I`m thinking if end-user want to watch movie in synchronizing way, how could I do that?
I mean, If I want watch movie with my friend, in two different location and both of us can play movie or pause it at a same time...
Do you have any idea?

Let's assume the client is a webbrowser.
You'd have to keep both (or all) clients in sync.
You cannot really initiate communication from the server, so your clients need to periodically "ask" the the server (maybe using AJAX) something similar to "should the movie be playing right now?" and take the accoring action on the client (which are using JavaScript perhaps?).
You could put this as a property in an object on the server to which all clients have access. You'd need to figure out how to share that object amongst all client sessions.

Related

how to send post data continuosly to web and mobile

I am going to develop uber-like application.Here I have to send latitude and longitude to web and mobile devices continuously with my service,What I have do to get this.
Can anyone please give some idea.
You should start by designing how the application is to be used, seen from all the different users perspectives.
For instance is this a web app, or a native app, or both?
Then from that knowledge, you need to define a communication protocol.
You should be able to determine if the client will be polling for data, or if you need to push it from the server onto the clients.
This also goes for the data that travels the other way.
From here you choose a language for programming, and then start doing some proof of concept tests.
The choice will depend on the chosen underlying technologies
(web / native / os / available libraries)
After some test work you may have something that works, then you need to review or add security to the communication, cause we do not want everyone collecting location data from everyone that has the app installed.
Then run beta trials and eliminate the worst bugs, and then release the app.
You'll want some sort of asynchronous task which can get new data from your server and refresh the mobile and web content to reflect the content of the server. You'll also want to notify the server whenever you make local changes to content and want to reflect those changes. Android provides the SyncAdapter pattern as a way to easily solve this pattern. You'll need to register user accounts, and then Android will perform lots of magic for you, and allow you to automatically sync. Here's a good tutorial: http://www.c99.org/2010/01/23/writing-an-android-sync-provider-part-1/

How to create immediate Notification System in website

I am implementing a small social networking website, and I am trying to implement notifications.
Notifications have the following requirements
All users will receive notifications whenever users they follow do
certain events (like a post, create a post,leave a comment, etc...
When a set of notifications for a user is unread, just like on facebook, the user will
continue to see a read notification icon on their navbar.
Problem : I am taking an example to describe my problem for better understanding for everyone.
Suppose there are two users A and B. A & B are friends and A post something, suddenly B like the post of A then A should have to receive the notification immediately.
So how can i achieve this immediately receiving of notification process?
Should i send a call to server on each millisecond to check whether there is any unread notification is available for A user ? In this case thousand millions of call creating for multiple user. It is feasible solution ?
(I think it create unnecessary load on my website. As i think facebook and stackoverflow do not use this way).
Provide me a suitable solution just like fb and other webiste using.
Technology Using in my project: Java and MYSQL
You should use JavaScript (client side) along with Java - MySql (Server side), and more specifically Ajax. You will need some time to understand the concept and the usage but it does exactly what you want.
To give more details, what you need is to create a partial view where the notifications will appear, and update this partial view async (with AJAX).
Dont reinvent the wheel.
Use ajax call to server at each interval and check your server and update nav acc.
1.So how can i achieve this immediately receiving of notification process?
2) Should i send a call to server on each millisecond to check whether there is any unread notification is available for A user ?
Your above both questions answers solve through GWTEventService implementation.
Through it you can write code that will avoid client to server round trip.
GWTEventService is an event-based client-server communication framework. It uses GWT-RPC and the Comet / server-push technique. The client side offers a high-level API with opportunities to register listeners to the server like to a GUI component. Events can be added to a context/domain on the server side and the listeners on the client side get informed about the incoming events. The server side is completely independent of the client implementation and is highly configurable. Domains can be defined to decide which events are important for the different contexts.
Refer link: https://code.google.com/p/gwteventservice/

Best practice / best services for going online and interactive with a mobile (Android) game

I would like to create a multiplayer turn game, in which users authenticate (through a Facebook account) and eventually play some games against other players.
I assume I need a server that, through some sql query, keeps specular authentication on its side and can store and retrieve information about the ongoing matches and whatever else. There's no need to any web server, so the server would actually only have these two roles: authenticate and store information.
I actually already have the game and I already authenticate with FB, but don't go further as soon as I currently don't have any dedicated server for this.
As soon as this - I suppose - is a very common situation for anyone that would like to make interactive his own mobile game, before starting this long journey I was wondering if there is something already made: libraries that I could use both on server and on client side, or even online services ready to be used, with facebook synced authentication and a few commands to enter the very few information that is needed for my game to run, without having to fight with security problems, syncronization issues and whatever else may arise.
Also templates, tutorials or complete examples (both sides, server and client) are welcome
Thank you very much.
There are actually a lot of full solutions for your game.
You will need a strong server side and a lot of server logic. But again you can use existing services that handle the server side for you. http://www.skiller-games.com/ has good support and monetization features.
Others:
http://www.scoreloop.com/
http://www.exitgames.com/
If you really want to make everything your own, you need to read up on some networking.
how to make Multiplayer Game

Connect multiple desktop apps to one online database

I'm starting a new project. It consists of:
Java desktop application downloadable from the internet with a client database.
PHP website on the internet with a server database.
The user who downloaded the app will use it to add items (not important what are they now) to the local database offline. When/If he is online, the item will be added to the server database so other connected users (through the desktop app or through the website) will see it.
I googled the issue and found it's more complected than I guess. One of the solution is to use some ready tools like SymmetricDS and Daffodil to gain in term of security, performance and scalability, but they're difficult to configure and install in both client and server side, and need the access to command prompt which requires me to pass to a dedicated host (well, that is not a real problem). Also, all what I want is just what I've described, not all what these tools actually provide.
Can I achieve that by myself within my Java application and maybe with the help of
the web server PHP?
I'm using MySQL for the info.
Edit: what really matters is to send items to the server database. Reading it can be less tricky using RSS Feed reading, for example.
Basically, you can use HTTP/HTTPS API. When a user online, send items to your php file and mark the items "sended" at local database. But you have to control edited or deleted statuses. So, yes that is much complicated but a solution.
Well the easiest solution that comes to my mind would be to save for each item a last edit date (on the server as well as on the client). Additionaly you have to keep track when a client got his last update from the server.
So whenever a client goes online the server sends him all updates.
But for that you have to make sure that the time on the client and the server are the same, and it doesn't solve the problem what happens if two clients edit the same item.
CouchDB solves the distributed synchronization problem very nicely, but it is a NoSQL DB. Depending on what your application should do, using it would boil down to using instances of CouchDB both locally inside very application, and on the central server.
You'd have to deal with conflicts nevertheless. The only thing CouchDB will support you with is easier detection of conflicts, and the data of both conflicting edits, so your application can work it out either automatically, or with user help.
On the other hand, generatin a unique id on the central server can be as easy as adding the creating user's id to each item id.

How to manage online users in IM applications such as GTalk, Skype etc

Do they keep an online user list in a database and update it with every login and logout event, and run queries for online friends?
What about scalability?
Are there better solutions?
If you try to either store presence in a traditional database, or poll for changes to anything, you're going to have a tough time scaling your presence system. Start with one of the open source XMPP servers, pull it apart, and see how it works. Each one of them scales differently, but at least you'll understand more about where you need to start.

Categories

Resources