Commit 69320967 authored by ibuler's avatar ibuler

[Update] 修改播放

parent c026b578
...@@ -6531,9 +6531,9 @@ ...@@ -6531,9 +6531,9 @@
"dev": true "dev": true
}, },
"guacamole-common-js": { "guacamole-common-js": {
"version": "0.9.14-b", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/guacamole-common-js/-/guacamole-common-js-0.9.14-b.tgz", "resolved": "https://registry.npmjs.org/guacamole-common-js/-/guacamole-common-js-1.1.0.tgz",
"integrity": "sha1-zwzjETnPNIYTqQt/lfz8z+0ZZZc=" "integrity": "sha512-X0BOOGL5DWirKk0Q+2tpr1r3yvoRlF4A76T6CfKMNWSWz3goD2/aSCQcY3I07XSop0SCjOZRNCmPPETmV/6ayg=="
}, },
"handle-thing": { "handle-thing": {
"version": "2.0.0", "version": "2.0.0",
......
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
"codemirror": "^5.42.0", "codemirror": "^5.42.0",
"core-js": "^2.5.4", "core-js": "^2.5.4",
"font-awesome": "4.7.0", "font-awesome": "4.7.0",
"guacamole-common-js": "0.9.14-b", "guacamole-common-js": "1.1.0",
"jquery": "^3.4.1", "jquery": "^3.4.1",
"metismenu": "^2.7.9", "metismenu": "^2.7.9",
"neffos.js": "^0.1.19", "neffos.js": "^0.1.19",
......
...@@ -56,6 +56,7 @@ export class ReplayGuacamoleComponent implements OnInit { ...@@ -56,6 +56,7 @@ export class ReplayGuacamoleComponent implements OnInit {
playerRef: any; playerRef: any;
displayRef: any; displayRef: any;
screenRef: any; screenRef: any;
recordingDisplay: any;
max = 100; max = 100;
percent = 0; percent = 0;
duration = '00:00'; duration = '00:00';
...@@ -74,50 +75,48 @@ export class ReplayGuacamoleComponent implements OnInit { ...@@ -74,50 +75,48 @@ export class ReplayGuacamoleComponent implements OnInit {
this.screenRef = document.getElementById('screen'); this.screenRef = document.getElementById('screen');
const tunnel = new Guacamole.StaticHTTPTunnel(this.replay.src); const tunnel = new Guacamole.StaticHTTPTunnel(this.replay.src);
this.recording = new Guacamole.SessionRecording(tunnel); this.recording = new Guacamole.SessionRecording(tunnel);
const recordingDisplay = this.recording.getDisplay(); this.recordingDisplay = this.recording.getDisplay();
const recordingElement = recordingDisplay.getElement(); const recordingElement = this.recordingDisplay.getElement();
recordingElement.style.margin = '0 auto'; recordingElement.style.margin = '0 auto';
this.screenRef.appendChild(recordingElement); this.screenRef.appendChild(recordingElement);
this.initRecording(); this.initRecording();
const that = this;
recordingDisplay.onresize = function onDisplayResize(width, height) {
// Do not scale if displayRef has no width
if (!height) {
return;
}
// Scale displayRef to fit width of container
const widthScale = that.displayRef.offsetWidth / width;
const heightScale = that.displayRef.offsetHeight / height;
console.log('old => new: ', widthScale, heightScale);
const minScale = widthScale < heightScale ? widthScale : heightScale;
recordingDisplay.scale(minScale);
// recordingDisplay.scale(that.displayRef.offsetHeigth / height);
};
// this.toggle(); // this.toggle();
} }
initRecording() { initRecording() {
const that = this;
this.recording.connect(''); this.recording.connect('');
this.recording.onplay = function() { this.recording.onplay = () => {
that.isPlaying = true; this.isPlaying = true;
}; };
this.recording.onseek = function (millis) { this.recording.onseek = (millis) => {
that.position = formatTime(millis); this.position = formatTime(millis);
that.percent = millis; this.percent = millis;
}; };
this.recording.onprogress = function (millis) { this.recording.onprogress = (millis) => {
that.duration = formatTime(millis); this.duration = formatTime(millis);
that.max = millis; this.max = millis;
that.toggle(); this.toggle();
}; };
// If paused, the play/pause button should read "Play" // If paused, the play/pause button should read "Play"
this.recording.onpause = function() { this.recording.onpause = () => {
that.isPlaying = false; this.isPlaying = false;
};
this.recordingDisplay.onresize = (width, height) => {
// Do not scale if displayRef has no width
if (!height) {
return;
}
// Scale displayRef to fit width of container
const widthScale = this.displayRef.offsetWidth / width;
const heightScale = this.displayRef.offsetHeight / height;
const minScale = widthScale < heightScale ? widthScale : heightScale;
this.recordingDisplay.scale(minScale);
}; };
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment