- this.metaService.setTag('og:description', this.video.description);
- this.metaService.setTag('description', this.video.description);
+ err => this.notificationsService.error('Error', err.message)
+ )
+ }
+
+ private onVideoFetched (video: Video) {
+ this.video = video
+
+ let observable
+ if (this.video.isVideoNSFWForUser(this.authService.getUser())) {
+ observable = this.confirmService.confirm('This video is not safe for work. Are you sure you want to watch it?', 'NSFW')
+ } else {
+ observable = Observable.of(true)
+ }
+
+ observable.subscribe(
+ res => {
+ if (res === false) {
+ return this.router.navigate([ '/videos/list' ])
+ }
+
+ this.playerElement = this.elementRef.nativeElement.querySelector('#video-container')
+
+ const videojsOptions = {
+ controls: true,
+ autoplay: true,
+ plugins: {
+ peertube: {
+ videoFiles: this.video.files,
+ playerElement: this.playerElement,
+ autoplay: true,
+ peerTubeLink: false
+ }
+ }
+ }
+
+ const self = this
+ videojs(this.playerElement, videojsOptions, function () {
+ self.player = this
+ this.on('customError', (event, data) => {
+ self.handleError(data.err)
+ })
+
+ this.on('torrentInfo', (event, data) => {
+ self.downloadSpeed = data.downloadSpeed
+ self.numPeers = data.numPeers
+ self.uploadSpeed = data.uploadSpeed
+ })
+ })
+
+ this.setOpenGraphTags()
+ this.checkUserRating()
+ }
+ )
+ }