Update live page
parent
a2edf88fb1
commit
6f26bb859d
|
|
@ -1,9 +1,14 @@
|
|||
<secondary-page-component [hideSideBarOnMobile]="true" >
|
||||
<div mainContent class="mapWrapper">
|
||||
<div class="video-container">
|
||||
<h1 *ngIf="!showVideo">{{message}}</h1>
|
||||
<h2 *ngIf="!showVideo">{{message}}</h2>
|
||||
<div class="video-container" *ngIf="showVideo">
|
||||
<video [class.opacity-zero]="!showVideo" *ngIf="!error" style="width:100%" [src]="videoSrc" controls [poster]="poster" (error)="vidError()"></video>
|
||||
</div>
|
||||
</div>
|
||||
<div style="margin-top: 10px">
|
||||
<button routerLink="/video" style="margin-top:5px; width:100%;" mat-stroked-button>
|
||||
<b><i ofbicon style="margin-top:-4px; vertical-align: middle;">play_arrow</i> Click here for previous video services</b>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div sideBar ofbFadeInOnScroll>
|
||||
|
||||
|
|
|
|||
|
|
@ -29,46 +29,36 @@ export class LiveStreamComponent implements OnInit {
|
|||
|
||||
private interval;
|
||||
ngOnInit() {
|
||||
this.update();
|
||||
this.interval = setInterval(() => {
|
||||
this.http.get<VideoServices>('assets/json/videoServices.json').subscribe(res => {
|
||||
res.videos = res.videos.filter(v => v.archived === false);
|
||||
res.videos.forEach(v => v.date = DateTime.fromISO(v.date, {zone: 'America/Denver'}));
|
||||
res.videos.sort((a, b) => {
|
||||
if (a.date < b.date) return -1;
|
||||
if (a.date === b.date) return 0;
|
||||
return 1;
|
||||
});
|
||||
var service = res.videos[0];
|
||||
|
||||
if (service) {
|
||||
this.message = (<any>service).message;
|
||||
if (service.isReady === true) {
|
||||
this.showVideo = true;
|
||||
this.videoSrc = '';
|
||||
this.videoSrc = service.src;
|
||||
clearInterval(this.interval);
|
||||
}
|
||||
} else {
|
||||
this.message = 'No Live Services';
|
||||
}
|
||||
});
|
||||
}, 3000);
|
||||
|
||||
this.update();
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
public async vidError() {
|
||||
console.log('err');
|
||||
return;
|
||||
if (this.videoSrc === '') return;
|
||||
this.error = true;
|
||||
setTimeout(async () => {
|
||||
this.error = false;
|
||||
setTimeout(() => {
|
||||
if (!this.error) {
|
||||
update() {
|
||||
this.http.get<VideoServices>('assets/json/videoServices.json').subscribe(res => {
|
||||
res.videos = res.videos.filter(v => v.archived === false);
|
||||
res.videos.forEach(v => v.date = DateTime.fromISO(v.date, {zone: 'America/Denver'}));
|
||||
res.videos.sort((a, b) => {
|
||||
if (a.date < b.date) return -1;
|
||||
if (a.date === b.date) return 0;
|
||||
return 1;
|
||||
});
|
||||
var service = res.videos[0];
|
||||
|
||||
if (service) {
|
||||
this.message = (<any>service).message;
|
||||
if (service.isReady === true) {
|
||||
this.showVideo = true;
|
||||
this.videoSrc = '';
|
||||
this.videoSrc = service.src;
|
||||
clearInterval(this.interval);
|
||||
}
|
||||
}, 3000);
|
||||
}, 3000);
|
||||
|
||||
} else {
|
||||
this.message = 'No Live Services';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue