Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(376)

Side by Side Diff: native_client_sdk/src/examples/api/media_stream_video/example.js

Issue 212533007: Sync NaCl MediaStream Video example with ppapi/examples/media_stream_video (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix review issue Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | native_client_sdk/src/examples/api/media_stream_video/index.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var stream; 5 var stream;
6 6
7 function success(s) { 7 function success(s) {
8 stream = s; 8 stream = s;
9 common.naclModule.postMessage({track: stream.getVideoTracks()[0]}); 9 common.naclModule.postMessage({
10 command: 'init',
11 track: stream.getVideoTracks()[0]
12 });
10 } 13 }
11 14
12 function failure(e) { 15 function failure(e) {
13 common.logMessage("Error: " + e); 16 common.logMessage("Error: " + e);
14 } 17 }
15 18
19 function changeFormat(format) {
20 common.naclModule.postMessage({command:'format', format: format});
21 }
22
23 function changeSize(width, height) {
24 common.naclModule.postMessage({command:'size', width: width, height: height});
25 }
26
16 function moduleDidLoad() { 27 function moduleDidLoad() {
17 navigator.webkitGetUserMedia({'video': true}, success, failure); 28 navigator.webkitGetUserMedia({'video': true}, success, failure);
18 } 29 }
30
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'); });
40
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); });
49
50 }
OLDNEW
« no previous file with comments | « no previous file | native_client_sdk/src/examples/api/media_stream_video/index.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698