Send a crash report when a hung process is detected.
[chromium-blink-merge.git] / native_client_sdk / src / examples / api / media_stream_video / example.js
blob5195ddf9cb402ea0bfeb491e88dae32231c5b57f
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 var stream;
7 function success(s) {
8 stream = s;
9 common.naclModule.postMessage({
10 command: 'init',
11 track: stream.getVideoTracks()[0]
12 });
15 function failure(e) {
16 common.logMessage("Error: " + e);
19 function changeFormat(format) {
20 common.naclModule.postMessage({command:'format', format: format});
23 function changeSize(width, height) {
24 common.naclModule.postMessage({command:'size', width: width, height: height});
27 function moduleDidLoad() {
28 navigator.webkitGetUserMedia({'video': true}, success, failure);
31 function attachListeners() {
32 document.getElementById('YV12').addEventListener(
33 'click', function() { changeFormat('YV12'); });
34 document.getElementById('I420').addEventListener(
35 'click', function() { changeFormat('I420'); });
36 document.getElementById('BGRA').addEventListener(
37 'click', function() { changeFormat('BGRA'); });
38 document.getElementById('DEFAULT').addEventListener(
39 'click', function() { changeFormat('DEFAULT'); });
41 document.getElementById('S72X72').addEventListener(
42 'click', function() { changeSize(72, 72); });
43 document.getElementById('S640X360').addEventListener(
44 'click', function() { changeSize(640, 360); });
45 document.getElementById('S1280X720').addEventListener(
46 'click', function() { changeSize(1280, 720); });
47 document.getElementById('SDEFAULT').addEventListener(
48 'click', function() { changeSize(0, 0); });