What Protocol to use for chat? webRTC or Websockets - javascript

I'm creating a Chat site that will be able to do, Video, Audio and Text Chatting. I'm currently using Websockets for Text Chatting. I need to know what is best at Video, Audio and Text Chatting. Which one is more effiecint. Should I use Websockets for all of them or webRTC for Video and Audio and Websockets for Text Chat. I can do both and wouldn't like to have to re-write my text chat for webRTC but if it is a better option then I will.
EDIT: I've just found out about binaryJS, Is this a better and easier alternative to webRTC?
Thanks,
#_C1D

By embedding your video and audio streams in websockets, you'll have a simpler system but everything will have to pass through your server.
WebRTC allows for a direct connection between pairs, so you'd get much better results using it.
Note also, but you probably know it already, that everything webRTC is just emerging.
Regarding the question in edit, about binaryJS : I never tried that but it doesn't look like a deal changer, just a facility for using websockets.

Related

Streaming/playing the video from the user's filesystem

The user has a video file on his system. Now, on the webpage there is an option to select a video file from his computer itself. I am seeking a way to directly stream the video on a html5 video tag(or any other player for that matter) from his/her computer on the fly. Please help.
This is a bad question and I do not see any effort from your part. Please check how to pose a question: https://stackoverflow.com/help/how-to-ask
Assuming you only need to support Web Browsers that support HTML5 then try
WebRTC (http://www.webrtc.org/home)
WebRTC is a free, open project that enables web browsers with
Real-Time Communications (RTC) capabilities via simple JavaScript
APIs. The WebRTC components have been optimized to best serve this
purpose.
It is important to note that this is just my personal preference.
Edit:
If you want to steam a file then take a look at VideoLAN (or VideoLAN Server). http://www.videolan.org/index.html

How to implement WebRTC recording to Node.js server

I would like to create an easy video blogging solution utilizing WebRTC technology to enable recording of video/audio directly from the browser, similar to Youtube's My_Webcam. The server component should be based on Node.js.
I found some Node.js libraries for general WebRTC connection managment (webRTC.io, Holla, EasyRTC), but it seems they don't enable recording of streams on the server.
What's the best way to implement server-side recording? Are there libraries and tutorials available?
This guy has a ton of interesting WebRTC experiments, including audio/video recording: https://github.com/muaz-khan/
Here's a demo of recording: https://www.webrtc-experiment.com/RTCMultiConnection-v1.4-Demos/RecordRTC-and-RTCMultiConnection.html
It collects the audio and video streams on the client and gives you a blob of audio and a blob of video that you can then upload/splice together.
Not exactly what you were hoping for, I think, but could probably get the job done. Hope that helps.
You may use node-webkit to achieve this. Node webkit is essentially a browser in node.js.

Are there any programs to record through a microphone that work inside a web browser?

I had a someone ask me if it were possible to record a person's voice inside of a web-browser - similar to what can be done on many operating systems. Is this possible through javascript or flash? Are there any programs that let you do this, and have the wav/mp3 of the recorded audio uploaded to the server? I'd prefer the solution to not use Flash if it can be avoided.
Thanks
You could use WAMI-Recorder. It still uses flash, but is designed to work with Javascript and data can be sent with HTTP POST. However, there's no way to access the microphone with Javascript alone.
At the moment, Chrome is the only browser that supports x-webkit-speech which is what they use to allow users to use voice to search Google on their desktop. HTML5 has getUserMedia, but support for that is also minimal and if your project is for mass consumption then it's unlikely to be a suitable.
Hey check out this post where i replied to a guy with a similar question as you.
How do I embed a Flash audio recorder in my site
I have done extensive research into client side only microphone recording and could not come up with any solution other than flash. If you follow my correct answer in the thread i posted, you can record audio from a microphone on the client side and then you can modify the code yourself and upload the audio to your server, its not that hard just a simple POST call.
If you do find a non-flash way to record let us know!

Can I use microphone and sound with javascript?

I would like to develop a very small application using javascript... this application should pass the voice recorded from a microphone to the sound.
Is it possible?
I know that i can access to microphone using Flash, but i would like to use javascript if possible.
Thank you!
Keep an eye on HTML5's implementation of getUserMedia. For a work-around using flash see:
https://code.google.com/p/wami-recorder/
That example actually passes audio to a server via an HTTP post (so no need for a Flash Media Server), but you could easily adapt it to keep the audio on the client side.
In this question about video streaming via web sockets it is possible to stream video. Theoretically it might be possible to write a client side application that creates a local TCP socket for microphone and audio, to which the browser and Javascript then listen.
I don't know if this has ever been attempted, and it would require significant code outside the browser to make happen.
You don't gain much either by doing it this way, over say, Flash since you still have client-side dependencies.
Nope. This is not possible. Javascript is not meant to access devices. you will need some abstraction technology like flash or silverlight that can help you with this otherwise javascript engine runs under the browser and it has no strings attached to the client-machine on which the browser is running.

Video streaming over websockets using JavaScript

What is the fastest way to stream live video using JavaScript? Is WebSockets over TCP a fast enough protocol to stream a video of, say, 30fps?
Is WebSockets over TCP a fast enough protocol to stream a video of, say, 30fps?
Yes.. it is, take a look at this project. Websockets can easily handle HD videostreaming.. However, you should go for Adaptive Streaming. I explain here how you could implement it.
Currently we're working on a webbased instant messaging application with chat, filesharing and video/webcam support. With some bits and tricks we got streaming media through websockets (used HTML5 Media Capture to get the stream from our webcams).
You need to build a stream API and a Media Stream Transceiver to control the related media processing and transport.
The Media Source Extensions has been proposed which would allow for Adaptive Bitrate Streaming implementations.
To answer the question:
What is the fastest way to stream live video using JavaScript? Is
WebSockets over TCP a fast enough protocol to stream a video of, say,
30fps?
Yes, Websocket can be used to transmit over 30 fps and even 60 fps.
The main issue with Websocket is that it is low-level and you have to deal with may other issues than just transmitting video chunks. All in all it's a great transport for video and also audio.
It's definitely conceivable but I am not sure we're there yet. In the meantime, I'd recommend using something like Silverlight with IIS Smooth Streaming. Silverlight is plugin-based, but it works on Windows/OSX/Linux. Some day the HTML5 <video> element will be the way to go, but that will lack support for a little while.

Categories