From b9ee133acb008b507fed764226a27b76bccf4fad Mon Sep 17 00:00:00 2001 From: dan Date: Sun, 22 Mar 2020 10:25:06 -0600 Subject: [PATCH] Add vid checker --- .../live-stream/live-stream.component.html | 2 +- .../live-stream/live-stream.component.ts | 29 +++++++++++++++---- Client/src/assets/json/message.json | 4 +++ 3 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 Client/src/assets/json/message.json diff --git a/Client/src/app/components/live-stream/live-stream.component.html b/Client/src/app/components/live-stream/live-stream.component.html index 22c185b..6307d38 100644 --- a/Client/src/app/components/live-stream/live-stream.component.html +++ b/Client/src/app/components/live-stream/live-stream.component.html @@ -1,7 +1,7 @@
- +

{{message}}

diff --git a/Client/src/app/components/live-stream/live-stream.component.ts b/Client/src/app/components/live-stream/live-stream.component.ts index 65bedda..eaa55b6 100644 --- a/Client/src/app/components/live-stream/live-stream.component.ts +++ b/Client/src/app/components/live-stream/live-stream.component.ts @@ -1,6 +1,7 @@ import { BibleVerseService } from './../../services/bible-verse.service'; import { Component, OnInit } from '@angular/core'; import { Router } from '@angular/router'; +import { HttpClient } from '@angular/common/http'; @Component({ selector: 'live-stream-component', @@ -13,6 +14,8 @@ export class LiveStreamComponent implements OnInit { public sermonVideo: string = 'https://ofbbutte.com/static/media/video/sermon.mp4'; public pleaseWait: string = 'https://ofbbutte.com/static/media/video/PleaseWait.jpg'; public clickToPlay: string = 'https://ofbbutte.com/static/media/video/ClickToPlay.jpg'; + public message: string = "Please Wait"; + public isReady: boolean = false; public videoSrc: string = this.sermonVideo; @@ -20,17 +23,33 @@ export class LiveStreamComponent implements OnInit { public error: boolean = false; public showVideo: boolean = false; - constructor() { } + constructor(private http: HttpClient) { } + private interval; ngOnInit() { + this.interval = setInterval(() => { + this.http.get('assets/json/message.json').subscribe(res => { + console.log(res); + this.message = (res).message; + this.isReady= (res).isReady; + if (this.isReady === true) { + this.showVideo = true; + } + }); + }, 3000); + setTimeout(() => { - if (!this.error) { - this.showVideo = true; - } - }, 3000) + this.isReady = true; + this.showVideo = true; + this.videoSrc = ''; + this.videoSrc = this.videoSrc; + clearInterval(this.interval); + }, 12000) } public async vidError() { + console.log('err'); + return; if (this.videoSrc === '') return; this.error = true; setTimeout(async () => { diff --git a/Client/src/assets/json/message.json b/Client/src/assets/json/message.json new file mode 100644 index 0000000..f4375cf --- /dev/null +++ b/Client/src/assets/json/message.json @@ -0,0 +1,4 @@ +{ + "isReady":false, + "message": "Please Wait..." + } \ No newline at end of file