Working Note:WebRTC II JSEP

WebRTC applications need to do several things;
1.get streaming audio,video or other data
2.get network information such as IP addresses and ports, and exchange this with other WebRTC clients to enable connection errors and initiate or close sessions information about media and client capability
5.communicate streaming audio,video or data

The MediaStream API is one part of the webRTC.
Each MediaStream has an input,which might be a media stream generated by navigator.getUserMedia().


navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia;

var constraints = {audio: false, video: true};
var video = document.querySelector(“video”);

function successCallback(stream) { = stream; // stream available to console
  if (window.URL) {
    video.src = window.URL.createObjectURL(stream);
  } else {
    video.src = stream;

function errorCallback(error){
  console.log(“navigator.getUserMedia error: “, error);


It will take 3 parameters:
1.a constraints object
2.a success callback,which is passed a MediaStream error callback

The way to exchange the data and the offer/answer architecture is called JSEP,JavaScript Session Establishment Protocol.

Working Note:WebRTC

WebRTC is a real-time communication technique without  plugins.
This link is some basic knowledge about it :

Quick start

It seems this webRTC is especial for web video communication.
RTC: Real Time Communication

Right now,getUserMedia seem to be an important thing in webRTC.It is available in Chrome Opera and FireFox.

This website can be used as a free video communication.

To be continue…

Basic Knowledge of Regular Expression

Recently I begin  to figure regular expression is really useful but hard to remember.
So this is just a tip for reviewing some basic knowledge about  javascript RegExp.

First  here is a link of W3school

And this link is for tesing

if we want to find “test” in the string “give us a test and ” we can just use the javascript regex like this:

regex=test or regex =bt[a-z]+b or bt[a-z]{3}b  or bt[a-z]{1,3}

First one will directly find the result of “test”. The second one will find a string with the beginning of t and followed by at least one letter between a-z. The third one is to find a string beginning with t and followed by 3 letters.  The last one is to  find a string beginning with t and follow by some letters. The number of letters is  1 or 2 or 3.

Beside the most important thing when we try to avoid deadly command in webpage is to check whether this is a “;” or not.
Because “;” will give the right to use another command.
When we want to execute linux  command by using node.js,we need to be more careful about the security problem.Sometimes, there will be a error message like”fail to find the command”.
The best way to solve it is to use the direct path.For example: $which ssmtp
And it will show the path of that command ,then :/usr/bin/ssmtp ” + inviteEmail + ” </home/msg.txt
The command will be executed successfully.

And by the way,when we want to use regex in javascript, we should add “//”.
For example, “regex = /;/; “