Reader small image

You're reading from  Learning WebRTC

Product typeBook
Published inJun 2015
Reading LevelBeginner
Publisher
ISBN-139781783983667
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Daniel M. Ristic
Daniel M. Ristic
author image
Daniel M. Ristic

Dan Ristic is a frontend engineer and evangelist for Open Web. He strives to push the Web forward with new and creative ideas using the latest technologies. He attended the University of Advancing Technology, Arizona, where he furthered his engineering knowledge and fueled his passion for the Web. He has been writing applications on the Web ever since. He currently lives and works in San Francisco as a senior software engineer at Sony Network Entertainment International. At Sony, he is responsible for managing the frontend application architecture and delivering the PlayStation Store to millions of users. In his free time, he can be found hiking, exploring, working on projects, and attending events.
Read more about Daniel M. Ristic

Right arrow

Constraining the media stream


Now that we know how to get a stream from the browser, we will cover configuring this stream using the first parameter of the getUserMedia API. This parameter expects an object of keys and values telling the browser how to look for and process streams coming from the connected devices. The first options we will cover are simply turning on or off the video or audio streams:

navigator.getUserMedia({ video: false, audio: true }, function (stream) {
  // Now our stream does not contain any video!
});

When you add this stream to the <video> element, it will now not show any video coming from the camera. You can also do the opposite and get just a video feed and no audio. This is great while developing a WebRTC application when you do not want to listen to yourself talk all day!

Tip

Typically, you will be calling yourself a lot while developing the WebRTC applications. This creates the phenomenon known as audio feedback where you are being recorded through the microphone...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Learning WebRTC
Published in: Jun 2015Publisher: ISBN-13: 9781783983667

Author (1)

author image
Daniel M. Ristic

Dan Ristic is a frontend engineer and evangelist for Open Web. He strives to push the Web forward with new and creative ideas using the latest technologies. He attended the University of Advancing Technology, Arizona, where he furthered his engineering knowledge and fueled his passion for the Web. He has been writing applications on the Web ever since. He currently lives and works in San Francisco as a senior software engineer at Sony Network Entertainment International. At Sony, he is responsible for managing the frontend application architecture and delivering the PlayStation Store to millions of users. In his free time, he can be found hiking, exploring, working on projects, and attending events.
Read more about Daniel M. Ristic