1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import {Component, OnInit} from '@angular/core';
import {ActivatedRoute, Params} from '@angular/router';
import {HttpService, LogService} from '../app.service';
import {Video, DataStore} from '../globals';
@Component({
selector: 'app-replay-page',
templateUrl: './replay-page.component.html',
styleUrls: ['./replay-page.component.css']
})
export class ReplayPageComponent implements OnInit {
constructor(private activatedRoute: ActivatedRoute,
private _http: HttpService,
private _logger: LogService) {
// this.video = {'type': 'none'};
DataStore.NavShow = false;
}
ngOnInit() {
let token: string;
this.activatedRoute.params.subscribe((params: Params) => {
token = params['token'];
});
this._http.get_replay(token)
.subscribe(
data => {
Video.type = 'json';
Video.json = data;
Video.timelist = Object.keys(Video.json).map(Number);
Video.timelist = Video.timelist.sort(function (a, b) {
return a - b;
});
Video.totalTime = Video.timelist[Video.timelist.length - 1] * 1000;
},
err => {
alert('无法下载');
this._logger.error(err);
},
);
}
}