Commit b84de8ff authored by ibuler's avatar ibuler

[Update] 修改录像播放

parent 41d6c90d
...@@ -30,7 +30,6 @@ export class ElementGuacamoleComponent implements OnInit { ...@@ -30,7 +30,6 @@ export class ElementGuacamoleComponent implements OnInit {
if (!this.target) { if (!this.target) {
const base = window.btoa(this.host.id + '\0' + 'c' + '\0' + 'jumpserver'); const base = window.btoa(this.host.id + '\0' + 'c' + '\0' + 'jumpserver');
if (environment.production) { if (environment.production) {
console.log('env', environment, 'pro');
if (DataStore.guacamole_token) { if (DataStore.guacamole_token) {
this._http.guacamole_add_asset(User.id, this.host.id, this.userid).subscribe( this._http.guacamole_add_asset(User.id, this.host.id, this.userid).subscribe(
data => { data => {
...@@ -41,7 +40,6 @@ export class ElementGuacamoleComponent implements OnInit { ...@@ -41,7 +40,6 @@ export class ElementGuacamoleComponent implements OnInit {
} }
); );
} else { } else {
console.log('env', environment, 'dev');
this._http.get_guacamole_token(User.id, '').subscribe( this._http.get_guacamole_token(User.id, '').subscribe(
data => { data => {
// /guacamole/client will redirect to http://guacamole/#/client // /guacamole/client will redirect to http://guacamole/#/client
...@@ -65,8 +63,6 @@ export class ElementGuacamoleComponent implements OnInit { ...@@ -65,8 +63,6 @@ export class ElementGuacamoleComponent implements OnInit {
this.target = this._cookie.get('guacamole'); this.target = this._cookie.get('guacamole');
} }
} }
console.log('Target: ', this.target);
NavList.List[this.index].Rdp = this.el.nativeElement; NavList.List[this.index].Rdp = this.el.nativeElement;
} }
......
...@@ -17,8 +17,6 @@ export class PagesMonitorComponent implements OnInit { ...@@ -17,8 +17,6 @@ export class PagesMonitorComponent implements OnInit {
this.activatedRoute.params.subscribe((params: Params) => { this.activatedRoute.params.subscribe((params: Params) => {
Monitor.token = params['token']; Monitor.token = params['token'];
Monitor.type = 'term'; Monitor.type = 'term';
console.log(Monitor);
}); });
} }
} }
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
<button id="play-pause" class="btn" (click)="toggle()"> <button id="play-pause" class="btn" (click)="toggle()">
<i class="fa" [ngClass]="{'fa-play':!isPlaying,'fa-pause': isPlaying}"></i> <i class="fa" [ngClass]="{'fa-play':!isPlaying,'fa-pause': isPlaying}"></i>
</button> </button>
<button type="button" class="btn" (click)="restart()">
<i class="fa fa-repeat" aria-hidden="true"></i>
</button>
<input id="position-slider" type="range" [(ngModel)]="percent" [attr.max]="max" (mouseup)="runFrom()"> <input id="position-slider" type="range" [(ngModel)]="percent" [attr.max]="max" (mouseup)="runFrom()">
<span id="position">{{ position }}</span> <span id="position">{{ position }}</span>
<span>/</span> <span>/</span>
......
#player { #player {
width: 640px; width: 800px;
} }
#display { #display {
......
import { Component, OnInit, Input } from '@angular/core'; import { Component, OnInit, Input } from '@angular/core';
import * as Guacamole from 'guacamole-common-js/dist/guacamole-common'; import * as Guacamole from 'guacamole-common-js/dist/guacamole-common';
// import { Replay } from '../replay.model'; import { Replay } from '../replay.model';
function zeroPad(num, minLength) { function zeroPad(num, minLength) {
let str = num.toString(); let str = num.toString();
...@@ -59,6 +59,7 @@ export class ReplayGuacamoleComponent implements OnInit { ...@@ -59,6 +59,7 @@ export class ReplayGuacamoleComponent implements OnInit {
// Scale displayRef to fit width of container // Scale displayRef to fit width of container
recordingDisplay.scale(that.displayRef.offsetWidth / width); recordingDisplay.scale(that.displayRef.offsetWidth / width);
}; };
// this.toggle();
} }
initRecording() { initRecording() {
...@@ -76,6 +77,7 @@ export class ReplayGuacamoleComponent implements OnInit { ...@@ -76,6 +77,7 @@ export class ReplayGuacamoleComponent implements OnInit {
this.recording.onprogress = function (millis) { this.recording.onprogress = function (millis) {
that.duration = formatTime(millis); that.duration = formatTime(millis);
that.max = millis; that.max = millis;
that.toggle();
}; };
// If paused, the play/pause button should read "Play" // If paused, the play/pause button should read "Play"
...@@ -84,6 +86,11 @@ export class ReplayGuacamoleComponent implements OnInit { ...@@ -84,6 +86,11 @@ export class ReplayGuacamoleComponent implements OnInit {
}; };
} }
restart() {
this.percent = 0;
this.runFrom();
}
runFrom() { runFrom() {
this.recording.seek(this.percent, () => this.recording.seek(this.percent, () =>
this.playerRef.className = '' this.playerRef.className = ''
......
...@@ -31,26 +31,26 @@ export class PagesReplayComponent implements OnInit { ...@@ -31,26 +31,26 @@ export class PagesReplayComponent implements OnInit {
this.replay.type = data['type']; this.replay.type = data['type'];
this.replay.src = data['src']; this.replay.src = data['src'];
this.replay.id = data['id']; this.replay.id = data['id'];
},
err => {
this._http.get_replay(token)
.subscribe(
data => {
this.replay.type = 'json';
this.replay.json = data;
this.replay.src = 'READY';
this.replay.timelist = Object.keys(this.replay.json).map(Number);
this.replay.timelist = this.replay.timelist.sort(function (a, b) {
return a - b;
});
this.replay.totalTime = this.replay.timelist[this.replay.timelist.length - 1] * 1000;
}, err2 => {
alert('无法下载');
this._logger.error(err2);
},
);
} }
// err => {
// this._http.get_replay(token)
// .subscribe(
// data => {
// this.replay.type = 'json';
// this.replay.json = data;
// this.replay.src = 'READY';
// this.replay.timelist = Object.keys(this.replay.json).map(Number);
// this.replay.timelist = this.replay.timelist.sort(function (a, b) {
// return a - b;
// });
// this.replay.totalTime = this.replay.timelist[this.replay.timelist.length - 1] * 1000;
//
// }, err2 => {
// alert('无法下载');
// this._logger.error(err2);
// },
// );
// }
); );
} }
......
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