justin avatar image
justin posted

What are the new WebView features in Lollipop?   


From the release of Android 5.0, WebView based on Chromium M37 release adds support for WebRTC, WebAudio and WebGL. For full features of WebView update, you can go visit the following forum article that we have put up.

New features in the WebView Update

What is WebRTC?

Web Real-Time Communication (WebRTC) is an API definition created by W3C that supports browser-to-browser applications for voice calling, video chat, and P2P file sharing without the need for external plugins. WebRTC has three main parts. - Acquiring audio and video ( - Communicating audio and video ( - Communicating arbitrary data (

MediaStream API

MediaStream represents synchronized streams of media. It allows access to local multimedia devices, such as microphones or video cameras, and provides control where these multimedia stream data are consumed.

var constraints = {video: true};
function successCallback(stream) {
    var video = document.querySelector("video");
    video.src = windo.URL.createObjectURL(stream);
}navigator.getUserMedia(contraints, successCallback, errorCallback);

You can get full sample code from Using Constraints, you get a general control to the contents (media type, resolution, frame rate, etc) of the MediaStream.

video: {
     mandatory: {
          minWidth: 640,
          minHeight: 360
     optional [{
          minWidth: 1280,
          minHeight: 720

Using combination of MediaStream and WebAudio API, you can get the audio from your microphone or other audio input source to the MediaStream.

(getUserMedia + Web Audio)

navigator.webkitGetUserMedia({audtio:true}, gotStream); // Success callback when requesting audio input stream
function gotStream(stream) {
     var audioContext = new webkitAudioContext(); // Create an AudioNode from the stream
     var mediaStreamSource = audioContext.createMediaStreamSource(stream);
     // Connect it to the destination

For details, go to

WebCamToy does a good job of using MediaStream API for their service:


RTCPeerConnection handles stable and efficient communication of streaming data between peers. Main tasks are signal processing, codec handling, peer to peer communication, security, and bandwidth management.

pc = new RTCPeerConnection(null);
pc.onaddstream = gotRemoteStream;

function gotOffer(desc) {

function gotAnswer(desc) {

function gotRemoteStream(e) {


WebRTC supports other types of data to real-time communication. RTCDataChannel API enables peer-to-peer exchange of arbitrary data with low latency and high throughput. Some use cases for this API could be gaming, text chat, file transfer, remote desktop application.

For details: go to

So what do these new features mean to you as an app developer?

You can now create WebApps with real-time communication features with simple Camera/Microphone integration. You will only need to know JavaScript to implement this and there are many resources online.

Getting Started with WebRTC -

WebRTC Code and API -

WebRTC Samples:

Real-time communication with WebRTC; Google I/O 2013(VIDEO) -

Keywords: Lollipop, WebRTC, WebAudio, WebGL, WebView, MediaStream, RTCPeerConnection, RTCDataChannel, WebApps


10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.



rossbria contributed to this article Justin@Amazon contributed to this article