aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/+video-watch/video-watch.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-10-18 14:35:31 +0200
committerChocobozzz <me@florianbigard.com>2018-10-18 14:35:31 +0200
commitc199c427d4ae586339822320f20f512a7a19dc3f (patch)
tree9cbe8bebc25e97d2e8086c41bcd7180dd752dbac /client/src/app/videos/+video-watch/video-watch.component.ts
parentcdf4cb9eaf5f6bc71f7c1e1963c07575f1d2593d (diff)
downloadPeerTube-c199c427d4ae586339822320f20f512a7a19dc3f.tar.gz
PeerTube-c199c427d4ae586339822320f20f512a7a19dc3f.tar.zst
PeerTube-c199c427d4ae586339822320f20f512a7a19dc3f.zip
Better typings
Diffstat (limited to 'client/src/app/videos/+video-watch/video-watch.component.ts')
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.ts16
1 files changed, 9 insertions, 7 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 ed5e723c9..65b974037 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/videos/+video-watch/video-watch.component.ts
@@ -7,7 +7,9 @@ import { VideoSupportComponent } from '@app/videos/+video-watch/modal/video-supp
7import { MetaService } from '@ngx-meta/core' 7import { MetaService } from '@ngx-meta/core'
8import { NotificationsService } from 'angular2-notifications' 8import { NotificationsService } from 'angular2-notifications'
9import { forkJoin, Subscription } from 'rxjs' 9import { forkJoin, Subscription } from 'rxjs'
10const videojs = require('video.js') 10// FIXME: something weird with our path definition in tsconfig and typings
11// @ts-ignore
12import videojs from 'video.js'
11import 'videojs-hotkeys' 13import 'videojs-hotkeys'
12import { Hotkey, HotkeysService } from 'angular2-hotkeys' 14import { Hotkey, HotkeysService } from 'angular2-hotkeys'
13import * as WebTorrent from 'webtorrent' 15import * as WebTorrent from 'webtorrent'
@@ -45,7 +47,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
45 @ViewChild('videoBlacklistModal') videoBlacklistModal: VideoBlacklistComponent 47 @ViewChild('videoBlacklistModal') videoBlacklistModal: VideoBlacklistComponent
46 @ViewChild('subscribeButton') subscribeButton: SubscribeButtonComponent 48 @ViewChild('subscribeButton') subscribeButton: SubscribeButtonComponent
47 49
48 player: any 50 player: videojs.Player
49 playerElement: HTMLVideoElement 51 playerElement: HTMLVideoElement
50 userRating: UserVideoRateType = null 52 userRating: UserVideoRateType = null
51 video: VideoDetails = null 53 video: VideoDetails = null
@@ -435,7 +437,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
435 this.zone.runOutsideAngular(async () => { 437 this.zone.runOutsideAngular(async () => {
436 videojs(this.playerElement, videojsOptions, function () { 438 videojs(this.playerElement, videojsOptions, function () {
437 self.player = this 439 self.player = this
438 this.on('customError', (data: any) => self.handleError(data.err)) 440 this.on('customError', ({ err }: { err: any }) => self.handleError(err))
439 441
440 addContextMenu(self.player, self.video.embedUrl) 442 addContextMenu(self.player, self.video.embedUrl)
441 }) 443 })
@@ -448,7 +450,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
448 this.checkUserRating() 450 this.checkUserRating()
449 } 451 }
450 452
451 private setRating (nextRating: string) { 453 private setRating (nextRating: VideoRateType) {
452 let method 454 let method
453 switch (nextRating) { 455 switch (nextRating) {
454 case 'like': 456 case 'like':
@@ -466,11 +468,11 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
466 .subscribe( 468 .subscribe(
467 () => { 469 () => {
468 // Update the video like attribute 470 // Update the video like attribute
469 this.updateVideoRating(this.userRating, nextRating as VideoRateType) 471 this.updateVideoRating(this.userRating, nextRating)
470 this.userRating = nextRating as UserVideoRateType 472 this.userRating = nextRating
471 }, 473 },
472 474
473 (err: any) => this.notificationsService.error(this.i18n('Error'), err.message) 475 (err: { message: string }) => this.notificationsService.error(this.i18n('Error'), err.message)
474 ) 476 )
475 } 477 }
476 478