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

Unified Diff: remoting/webapp/client_session.js

Issue 386853002: Add a Record button to the web-app if the host supports video recording. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move code out into OptionsMenu and VideoFrameRecorder Created 6 years, 4 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
Index: remoting/webapp/client_session.js
diff --git a/remoting/webapp/client_session.js b/remoting/webapp/client_session.js
index f53898bd8d1f74bc1938e0fed93918c70d3721ca..e33be882d8e286189317852e0a7a0744a887f582 100644
--- a/remoting/webapp/client_session.js
+++ b/remoting/webapp/client_session.js
@@ -176,6 +176,9 @@ remoting.ClientSession = function(container, hostDisplayName, accessCode,
/** @type {remoting.CastExtensionHandler} @private */
this.castExtensionHandler_ = null;
+ /** @type {remoting.VideoFrameRecorder} @private */
+ this.videoFrameRecorder_ = null;
+
if (this.mode_ == remoting.ClientSession.Mode.IT2ME) {
// Resize-to-client is not supported for IT2Me hosts.
this.resizeToClientButton_.hidden = true;
@@ -185,6 +188,7 @@ remoting.ClientSession = function(container, hostDisplayName, accessCode,
this.fullScreenButton_.addEventListener(
'click', this.callToggleFullScreen_, false);
+
this.defineEvents(Object.keys(remoting.ClientSession.Events));
};
@@ -1054,6 +1058,10 @@ remoting.ClientSession.prototype.onSetCapabilities_ = function(capabilities) {
clientArea.height,
window.devicePixelRatio);
}
+ if (this.hasCapability_(
+ remoting.ClientSession.Capability.VIDEO_RECORDER)) {
+ this.videoFrameRecorder_ = new remoting.VideoFrameRecorder(this.plugin_);
+ }
};
/**
@@ -1593,3 +1601,39 @@ remoting.ClientSession.prototype.createCastExtensionHandler_ = function() {
}
};
+/**
+ * Returns true if the ClientSession can record video frames to a file.
+ */
+remoting.ClientSession.prototype.canRecordVideo = function() {
+ return !!this.videoFrameRecorder_;
+}
+
+/**
+ * Returns true if the ClientSession is currently recording video frames.
+ */
+remoting.ClientSession.prototype.isRecordingVideo = function() {
+ if (!this.videoFrameRecorder_) {
+ return false;
+ }
+ return this.videoFrameRecorder_.isRecording();
+}
+
+/**
+ * Starts or stops recording of video frames.
+ */
+remoting.ClientSession.prototype.startStopRecording = function() {
+ if (this.videoFrameRecorder_) {
+ this.videoFrameRecorder_.startStopRecording();
+ }
+}
+
+/**
+ * Handles protocol extension messages.
+ */
+remoting.ClientSession.prototype.handleExtensionMessage =
+ function(type, data) {
+ if (this.videoFrameRecorder_) {
+ return this.videoFrameRecorder_.handleMessage(type, data);
+ }
+ return false;
+}

Powered by Google App Engine
This is Rietveld 408576698