From da932efc8199e2d9fe5d830432fb3833865a9a42 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 29 Apr 2016 14:18:14 +0200 Subject: Add loader gif when loading the video --- .../components/watch/videos-watch.component.html | 6 +++++ .../components/watch/videos-watch.component.scss | 27 ++++++++++++++++++++++ .../components/watch/videos-watch.component.ts | 3 +++ 3 files changed, 36 insertions(+) (limited to 'client') diff --git a/client/angular/videos/components/watch/videos-watch.component.html b/client/angular/videos/components/watch/videos-watch.component.html index 1ec0b1e19..f2a50eccd 100644 --- a/client/angular/videos/components/watch/videos-watch.component.html +++ b/client/angular/videos/components/watch/videos-watch.component.html @@ -1,5 +1,11 @@ + +
+
+
+
+
Download: {{ downloadSpeed | bytes }}/s
Upload: {{ uploadSpeed | bytes }}/s
diff --git a/client/angular/videos/components/watch/videos-watch.component.scss b/client/angular/videos/components/watch/videos-watch.component.scss index 27f34b33d..b6c2fc050 100644 --- a/client/angular/videos/components/watch/videos-watch.component.scss +++ b/client/angular/videos/components/watch/videos-watch.component.scss @@ -1,3 +1,30 @@ .embed-responsive { height: 100%; } + +#video-loading { + margin-top: 150px; +} + +// Thanks https://gist.github.com/alexandrevicenzi/680147013e902a4eaa5d +.glyphicon-refresh-animate { + -animation: spin .7s infinite linear; + -ms-animation: spin .7s infinite linear; + -webkit-animation: spinw .7s infinite linear; + -moz-animation: spinm .7s infinite linear; +} + +@keyframes spin { + from { transform: scale(1) rotate(0deg);} + to { transform: scale(1) rotate(360deg);} +} + +@-webkit-keyframes spinw { + from { -webkit-transform: rotate(0deg);} + to { -webkit-transform: rotate(360deg);} +} + +@-moz-keyframes spinm { + from { -moz-transform: rotate(0deg);} + to { -moz-transform: rotate(360deg);} +} diff --git a/client/angular/videos/components/watch/videos-watch.component.ts b/client/angular/videos/components/watch/videos-watch.component.ts index d2203727e..52c31fe32 100644 --- a/client/angular/videos/components/watch/videos-watch.component.ts +++ b/client/angular/videos/components/watch/videos-watch.component.ts @@ -20,6 +20,7 @@ export class VideosWatchComponent implements OnInit, CanDeactivate { downloadSpeed: number; uploadSpeed: number; numPeers: number; + loading: boolean = false; private _interval: number; private client: any; @@ -42,9 +43,11 @@ export class VideosWatchComponent implements OnInit, CanDeactivate { } loadVideo(video: Video) { + this.loading = true; this.video = video; console.log('Adding ' + this.video.magnetUri + '.'); this.client.add(this.video.magnetUri, (torrent) => { + this.loading = false; console.log('Added ' + this.video.magnetUri + '.'); torrent.files[0].appendTo(this._elementRef.nativeElement.querySelector('.embed-responsive'), (err) => { if (err) { -- cgit v1.2.3