How can I create video player like facebook's

I think to create video player to play video from server.
There are many video player in the page and I want to play only one video at a time.
Like Facebook, when the screen scrolled, playing video has stop automatically.
How can I create that video group?