diff options
Diffstat (limited to 'client/src/app/videos/video-watch')
-rw-r--r-- | client/src/app/videos/video-watch/video-watch.component.ts | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/client/src/app/videos/video-watch/video-watch.component.ts b/client/src/app/videos/video-watch/video-watch.component.ts index 736ca7d5a..e705fa555 100644 --- a/client/src/app/videos/video-watch/video-watch.component.ts +++ b/client/src/app/videos/video-watch/video-watch.component.ts | |||
@@ -2,6 +2,7 @@ import { Component, ElementRef, NgZone, OnDestroy, OnInit, ViewChild } from '@an | |||
2 | import { ActivatedRoute } from '@angular/router'; | 2 | import { ActivatedRoute } from '@angular/router'; |
3 | 3 | ||
4 | import { ModalDirective } from 'ng2-bootstrap/components/modal'; | 4 | import { ModalDirective } from 'ng2-bootstrap/components/modal'; |
5 | import { MetaService } from 'ng2-meta'; | ||
5 | 6 | ||
6 | import { Video, VideoService } from '../shared'; | 7 | import { Video, VideoService } from '../shared'; |
7 | import { WebTorrentService } from './webtorrent.service'; | 8 | import { WebTorrentService } from './webtorrent.service'; |
@@ -33,6 +34,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
33 | private ngZone: NgZone, | 34 | private ngZone: NgZone, |
34 | private route: ActivatedRoute, | 35 | private route: ActivatedRoute, |
35 | private videoService: VideoService, | 36 | private videoService: VideoService, |
37 | private metaService: MetaService, | ||
36 | private webTorrentService: WebTorrentService | 38 | private webTorrentService: WebTorrentService |
37 | ) {} | 39 | ) {} |
38 | 40 | ||
@@ -42,6 +44,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
42 | this.videoService.getVideo(id).subscribe( | 44 | this.videoService.getVideo(id).subscribe( |
43 | video => { | 45 | video => { |
44 | this.video = video; | 46 | this.video = video; |
47 | this.setOpenGraphTags(); | ||
45 | this.loadVideo(); | 48 | this.loadVideo(); |
46 | }, | 49 | }, |
47 | error => alert(error.text) | 50 | error => alert(error.text) |
@@ -104,6 +107,25 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
104 | console.error('The video load seems to be abnormally long.'); | 107 | console.error('The video load seems to be abnormally long.'); |
105 | } | 108 | } |
106 | 109 | ||
110 | private setOpenGraphTags() { | ||
111 | this.metaService.setTag('og:type', 'video'); | ||
112 | |||
113 | this.metaService.setTag('og:title', this.video.name); | ||
114 | this.metaService.setTag('name', this.video.name); | ||
115 | |||
116 | this.metaService.setTag('og:description', this.video.description); | ||
117 | this.metaService.setTag('description', this.video.description); | ||
118 | |||
119 | this.metaService.setTag('og:image', this.video.thumbnailPath); | ||
120 | |||
121 | this.metaService.setTag('og:duration', this.video.duration); | ||
122 | |||
123 | this.metaService.setTag('og:site_name', 'PeerTube'); | ||
124 | |||
125 | this.metaService.setTag('og:url', window.location.href); | ||
126 | this.metaService.setTag('url', window.location.href); | ||
127 | } | ||
128 | |||
107 | private runInProgress(torrent: any) { | 129 | private runInProgress(torrent: any) { |
108 | // Refresh each second | 130 | // Refresh each second |
109 | this.torrentInfosInterval = setInterval(() => { | 131 | this.torrentInfosInterval = setInterval(() => { |