| OLD | NEW |
| 1 /** | 1 /** |
| 2 * Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 * Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * The ID of the video tag from which frames are captured. | 8 * The ID of the video tag from which frames are captured. |
| 9 * @private | 9 * @private |
| 10 */ | 10 */ |
| 11 var gVideoId = 'remote_view'; | 11 var gVideoId = 'remote-view'; |
| 12 | 12 |
| 13 /** | 13 /** |
| 14 * Counts the number of frames that have been captured. Used in timeout | 14 * Counts the number of frames that have been captured. Used in timeout |
| 15 * adjustments. | 15 * adjustments. |
| 16 * @private | 16 * @private |
| 17 */ | 17 */ |
| 18 var gFrameCounter = 0; | 18 var gFrameCounter = 0; |
| 19 | 19 |
| 20 /** | 20 /** |
| 21 * The gStartOfTime when the capturing begins. Used for timeout adjustments. | 21 * The gStartOfTime when the capturing begins. Used for timeout adjustments. |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 * Captures an image frame from the provided video element. | 100 * Captures an image frame from the provided video element. |
| 101 * | 101 * |
| 102 * @param {Video} video HTML5 video element from where the image frame will | 102 * @param {Video} video HTML5 video element from where the image frame will |
| 103 * be captured. | 103 * be captured. |
| 104 * @param {Number} The width of the video/canvas area to be captured. | 104 * @param {Number} The width of the video/canvas area to be captured. |
| 105 * @param {Number} The height of the video/canvas area to be captured. | 105 * @param {Number} The height of the video/canvas area to be captured. |
| 106 * | 106 * |
| 107 * @return {Canvas} | 107 * @return {Canvas} |
| 108 */ | 108 */ |
| 109 function capture(video, width, height) { | 109 function capture(video, width, height) { |
| 110 var canvas = document.getElementById('remote_canvas'); | 110 var canvas = document.getElementById('remote-canvas'); |
| 111 var ctx = canvas.getContext('2d'); | 111 var ctx = canvas.getContext('2d'); |
| 112 ctx.drawImage(video, 0, 0, width, height); | 112 ctx.drawImage(video, 0, 0, width, height); |
| 113 return canvas; | 113 return canvas; |
| 114 } | 114 } |
| 115 | 115 |
| 116 /** | 116 /** |
| 117 * The function which is called at the end of every gFrameCaptureInterval. Gets | 117 * The function which is called at the end of every gFrameCaptureInterval. Gets |
| 118 * the current frame from the video and extracts the data from it. Then it saves | 118 * the current frame from the video and extracts the data from it. Then it saves |
| 119 * it in the frames array and adjusts the capture interval (timers in JavaScript | 119 * it in the frames array and adjusts the capture interval (timers in JavaScript |
| 120 * aren't precise). | 120 * aren't precise). |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 }; | 234 }; |
| 235 | 235 |
| 236 gWebSocket.onerror = function (error) { | 236 gWebSocket.onerror = function (error) { |
| 237 console.log('WebSocket Error ' + error); | 237 console.log('WebSocket Error ' + error); |
| 238 }; | 238 }; |
| 239 | 239 |
| 240 gWebSocket.onmessage = function (e) { | 240 gWebSocket.onmessage = function (e) { |
| 241 console.log('Server says: ' + e.data); | 241 console.log('Server says: ' + e.data); |
| 242 }; | 242 }; |
| 243 } | 243 } |
| OLD | NEW |