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

Unified 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, 9 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: native_client_sdk/src/examples/api/media_stream_video/example.js
diff --git a/native_client_sdk/src/examples/api/media_stream_video/example.js b/native_client_sdk/src/examples/api/media_stream_video/example.js
index dfd3eb9e4368f0dff6343528a511bb46f74a8d5a..5195ddf9cb402ea0bfeb491e88dae32231c5b57f 100644
--- a/native_client_sdk/src/examples/api/media_stream_video/example.js
+++ b/native_client_sdk/src/examples/api/media_stream_video/example.js
@@ -6,13 +6,45 @@ var stream;
function success(s) {
stream = s;
- common.naclModule.postMessage({track: stream.getVideoTracks()[0]});
+ common.naclModule.postMessage({
+ command: 'init',
+ track: stream.getVideoTracks()[0]
+ });
}
function failure(e) {
common.logMessage("Error: " + e);
}
+function changeFormat(format) {
+ common.naclModule.postMessage({command:'format', format: format});
+}
+
+function changeSize(width, height) {
+ common.naclModule.postMessage({command:'size', width: width, height: height});
+}
+
function moduleDidLoad() {
navigator.webkitGetUserMedia({'video': true}, success, failure);
}
+
+function attachListeners() {
+ document.getElementById('YV12').addEventListener(
+ 'click', function() { changeFormat('YV12'); });
+ document.getElementById('I420').addEventListener(
+ 'click', function() { changeFormat('I420'); });
+ document.getElementById('BGRA').addEventListener(
+ 'click', function() { changeFormat('BGRA'); });
+ document.getElementById('DEFAULT').addEventListener(
+ 'click', function() { changeFormat('DEFAULT'); });
+
+ document.getElementById('S72X72').addEventListener(
+ 'click', function() { changeSize(72, 72); });
+ document.getElementById('S640X360').addEventListener(
+ 'click', function() { changeSize(640, 360); });
+ document.getElementById('S1280X720').addEventListener(
+ 'click', function() { changeSize(1280, 720); });
+ document.getElementById('SDEFAULT').addEventListener(
+ 'click', function() { changeSize(0, 0); });
+
+}
« 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