diff options
Diffstat (limited to 'client/src/app/videos')
12 files changed, 32 insertions, 27 deletions
diff --git a/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts b/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts index a2c9237ad..796fbe531 100644 --- a/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts +++ b/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts | |||
@@ -5,6 +5,7 @@ import { VideoCaptionsValidatorsService } from '@app/shared/forms/form-validator | |||
5 | import { ServerService } from '@app/core' | 5 | import { ServerService } from '@app/core' |
6 | import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' | 6 | import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' |
7 | import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap' | 7 | import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap' |
8 | import { VideoConstant } from '../../../../../../shared' | ||
8 | 9 | ||
9 | @Component({ | 10 | @Component({ |
10 | selector: 'my-video-caption-add-modal', | 11 | selector: 'my-video-caption-add-modal', |
@@ -19,7 +20,7 @@ export class VideoCaptionAddModalComponent extends FormReactive implements OnIni | |||
19 | 20 | ||
20 | @ViewChild('modal') modal: ElementRef | 21 | @ViewChild('modal') modal: ElementRef |
21 | 22 | ||
22 | videoCaptionLanguages: any = [] | 23 | videoCaptionLanguages: VideoConstant<string>[] = [] |
23 | 24 | ||
24 | private openedModal: NgbModalRef | 25 | private openedModal: NgbModalRef |
25 | private closingModal = false | 26 | private closingModal = false |
@@ -73,7 +74,7 @@ export class VideoCaptionAddModalComponent extends FormReactive implements OnIni | |||
73 | this.hide() | 74 | this.hide() |
74 | 75 | ||
75 | const languageId = this.form.value[ 'language' ] | 76 | const languageId = this.form.value[ 'language' ] |
76 | const languageObject = this.videoCaptionLanguages.find((l: any) => l.id === languageId) | 77 | const languageObject = this.videoCaptionLanguages.find(l => l.id === languageId) |
77 | 78 | ||
78 | this.captionAdded.emit({ | 79 | this.captionAdded.emit({ |
79 | language: languageObject, | 80 | language: languageObject, |
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts index 9a50e2ab2..e13c06ce9 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { Component, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' | 1 | import { Component, ElementRef, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' |
2 | import { Router } from '@angular/router' | 2 | import { Router } from '@angular/router' |
3 | import { NotificationsService } from 'angular2-notifications' | 3 | import { NotificationsService } from 'angular2-notifications' |
4 | import { VideoPrivacy, VideoUpdate } from '../../../../../../shared/models/videos' | 4 | import { VideoPrivacy, VideoUpdate } from '../../../../../../shared/models/videos' |
@@ -23,7 +23,7 @@ import { VideoImportService } from '@app/shared/video-import' | |||
23 | }) | 23 | }) |
24 | export class VideoImportTorrentComponent extends VideoSend implements OnInit, CanComponentDeactivate { | 24 | export class VideoImportTorrentComponent extends VideoSend implements OnInit, CanComponentDeactivate { |
25 | @Output() firstStepDone = new EventEmitter<string>() | 25 | @Output() firstStepDone = new EventEmitter<string>() |
26 | @ViewChild('torrentfileInput') torrentfileInput: any | 26 | @ViewChild('torrentfileInput') torrentfileInput: ElementRef<HTMLInputElement> |
27 | 27 | ||
28 | videoFileName: string | 28 | videoFileName: string |
29 | magnetUri = '' | 29 | magnetUri = '' |
@@ -64,7 +64,7 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca | |||
64 | } | 64 | } |
65 | 65 | ||
66 | fileChange () { | 66 | fileChange () { |
67 | const torrentfile = this.torrentfileInput.nativeElement.files[0] as File | 67 | const torrentfile = this.torrentfileInput.nativeElement.files[0] |
68 | if (!torrentfile) return | 68 | if (!torrentfile) return |
69 | 69 | ||
70 | this.importVideo(torrentfile) | 70 | this.importVideo(torrentfile) |
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-send.ts b/client/src/app/videos/+video-edit/video-add-components/video-send.ts index cf9d47cbe..1bf22e1a9 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-send.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-send.ts | |||
@@ -3,7 +3,6 @@ import { LoadingBarService } from '@ngx-loading-bar/core' | |||
3 | import { NotificationsService } from 'angular2-notifications' | 3 | import { NotificationsService } from 'angular2-notifications' |
4 | import { catchError, switchMap, tap } from 'rxjs/operators' | 4 | import { catchError, switchMap, tap } from 'rxjs/operators' |
5 | import { FormReactive } from '@app/shared' | 5 | import { FormReactive } from '@app/shared' |
6 | import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service' | ||
7 | import { VideoConstant, VideoPrivacy } from '../../../../../../shared' | 6 | import { VideoConstant, VideoPrivacy } from '../../../../../../shared' |
8 | import { AuthService, ServerService } from '@app/core' | 7 | import { AuthService, ServerService } from '@app/core' |
9 | import { VideoService } from '@app/shared/video/video.service' | 8 | import { VideoService } from '@app/shared/video/video.service' |
@@ -11,8 +10,9 @@ import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.m | |||
11 | import { VideoCaptionService } from '@app/shared/video-caption' | 10 | import { VideoCaptionService } from '@app/shared/video-caption' |
12 | import { VideoEdit } from '@app/shared/video/video-edit.model' | 11 | import { VideoEdit } from '@app/shared/video/video-edit.model' |
13 | import { populateAsyncUserVideoChannels } from '@app/shared/misc/utils' | 12 | import { populateAsyncUserVideoChannels } from '@app/shared/misc/utils' |
13 | import { CanComponentDeactivateResult } from '@app/shared/guards/can-deactivate-guard.service' | ||
14 | 14 | ||
15 | export abstract class VideoSend extends FormReactive implements OnInit, CanComponentDeactivate { | 15 | export abstract class VideoSend extends FormReactive implements OnInit { |
16 | userVideoChannels: { id: number, label: string, support: string }[] = [] | 16 | userVideoChannels: { id: number, label: string, support: string }[] = [] |
17 | videoPrivacies: VideoConstant<VideoPrivacy>[] = [] | 17 | videoPrivacies: VideoConstant<VideoPrivacy>[] = [] |
18 | videoCaptions: VideoCaptionEdit[] = [] | 18 | videoCaptions: VideoCaptionEdit[] = [] |
@@ -30,7 +30,7 @@ export abstract class VideoSend extends FormReactive implements OnInit, CanCompo | |||
30 | protected videoService: VideoService | 30 | protected videoService: VideoService |
31 | protected videoCaptionService: VideoCaptionService | 31 | protected videoCaptionService: VideoCaptionService |
32 | 32 | ||
33 | abstract canDeactivate (): any | 33 | abstract canDeactivate (): CanComponentDeactivateResult |
34 | 34 | ||
35 | ngOnInit () { | 35 | ngOnInit () { |
36 | this.buildForm({}) | 36 | this.buildForm({}) |
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts index fa6ee0c23..8e2d0deaf 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { HttpEventType, HttpResponse } from '@angular/common/http' | 1 | import { HttpEventType, HttpResponse } from '@angular/common/http' |
2 | import { Component, EventEmitter, OnDestroy, OnInit, Output, ViewChild } from '@angular/core' | 2 | import { Component, ElementRef, EventEmitter, OnDestroy, OnInit, Output, ViewChild } from '@angular/core' |
3 | import { Router } from '@angular/router' | 3 | import { Router } from '@angular/router' |
4 | import { LoadingBarService } from '@ngx-loading-bar/core' | 4 | import { LoadingBarService } from '@ngx-loading-bar/core' |
5 | import { NotificationsService } from 'angular2-notifications' | 5 | import { NotificationsService } from 'angular2-notifications' |
@@ -25,7 +25,7 @@ import { VideoCaptionService } from '@app/shared/video-caption' | |||
25 | }) | 25 | }) |
26 | export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy, CanComponentDeactivate { | 26 | export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy, CanComponentDeactivate { |
27 | @Output() firstStepDone = new EventEmitter<string>() | 27 | @Output() firstStepDone = new EventEmitter<string>() |
28 | @ViewChild('videofileInput') videofileInput: any | 28 | @ViewChild('videofileInput') videofileInput: ElementRef<HTMLInputElement> |
29 | 29 | ||
30 | // So that it can be accessed in the template | 30 | // So that it can be accessed in the template |
31 | readonly SPECIAL_SCHEDULED_PRIVACY = VideoEdit.SPECIAL_SCHEDULED_PRIVACY | 31 | readonly SPECIAL_SCHEDULED_PRIVACY = VideoEdit.SPECIAL_SCHEDULED_PRIVACY |
@@ -110,7 +110,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
110 | } | 110 | } |
111 | 111 | ||
112 | uploadFirstStep () { | 112 | uploadFirstStep () { |
113 | const videofile = this.videofileInput.nativeElement.files[0] as File | 113 | const videofile = this.videofileInput.nativeElement.files[0] |
114 | if (!videofile) return | 114 | if (!videofile) return |
115 | 115 | ||
116 | // Cannot upload videos > 8GB for now | 116 | // Cannot upload videos > 8GB for now |
diff --git a/client/src/app/videos/+video-watch/comment/linkifier.service.ts b/client/src/app/videos/+video-watch/comment/linkifier.service.ts index 9ad419a69..4f4ec1e5d 100644 --- a/client/src/app/videos/+video-watch/comment/linkifier.service.ts +++ b/client/src/app/videos/+video-watch/comment/linkifier.service.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | import { Injectable } from '@angular/core' | 1 | import { Injectable } from '@angular/core' |
2 | import { getAbsoluteAPIUrl } from '@app/shared/misc/utils' | 2 | import { getAbsoluteAPIUrl } from '@app/shared/misc/utils' |
3 | // FIXME: use @types/linkify when https://github.com/DefinitelyTyped/DefinitelyTyped/pull/29682/files is merged? | ||
3 | const linkify = require('linkifyjs') | 4 | const linkify = require('linkifyjs') |
4 | const linkifyHtml = require('linkifyjs/html') | 5 | const linkifyHtml = require('linkifyjs/html') |
5 | 6 | ||
diff --git a/client/src/app/videos/+video-watch/comment/video-comment.component.ts b/client/src/app/videos/+video-watch/comment/video-comment.component.ts index 982470786..00f0460a1 100644 --- a/client/src/app/videos/+video-watch/comment/video-comment.component.ts +++ b/client/src/app/videos/+video-watch/comment/video-comment.component.ts | |||
@@ -26,7 +26,7 @@ export class VideoCommentComponent implements OnInit, OnChanges { | |||
26 | @Output() resetReply = new EventEmitter() | 26 | @Output() resetReply = new EventEmitter() |
27 | 27 | ||
28 | sanitizedCommentHTML = '' | 28 | sanitizedCommentHTML = '' |
29 | newParentComments: any = [] | 29 | newParentComments: VideoComment[] = [] |
30 | 30 | ||
31 | constructor ( | 31 | constructor ( |
32 | private linkifierService: LinkifierService, | 32 | private linkifierService: LinkifierService, |
diff --git a/client/src/app/videos/+video-watch/comment/video-comment.service.ts b/client/src/app/videos/+video-watch/comment/video-comment.service.ts index 7d9c2d0ad..921447d5b 100644 --- a/client/src/app/videos/+video-watch/comment/video-comment.service.ts +++ b/client/src/app/videos/+video-watch/comment/video-comment.service.ts | |||
@@ -30,9 +30,9 @@ export class VideoCommentService { | |||
30 | const url = VideoCommentService.BASE_VIDEO_URL + videoId + '/comment-threads' | 30 | const url = VideoCommentService.BASE_VIDEO_URL + videoId + '/comment-threads' |
31 | const normalizedComment = lineFeedToHtml(comment, 'text') | 31 | const normalizedComment = lineFeedToHtml(comment, 'text') |
32 | 32 | ||
33 | return this.authHttp.post(url, normalizedComment) | 33 | return this.authHttp.post<{ comment: VideoCommentServerModel }>(url, normalizedComment) |
34 | .pipe( | 34 | .pipe( |
35 | map((data: any) => this.extractVideoComment(data['comment'])), | 35 | map(data => this.extractVideoComment(data.comment)), |
36 | catchError(err => this.restExtractor.handleError(err)) | 36 | catchError(err => this.restExtractor.handleError(err)) |
37 | ) | 37 | ) |
38 | } | 38 | } |
@@ -41,9 +41,9 @@ export class VideoCommentService { | |||
41 | const url = VideoCommentService.BASE_VIDEO_URL + videoId + '/comments/' + inReplyToCommentId | 41 | const url = VideoCommentService.BASE_VIDEO_URL + videoId + '/comments/' + inReplyToCommentId |
42 | const normalizedComment = lineFeedToHtml(comment, 'text') | 42 | const normalizedComment = lineFeedToHtml(comment, 'text') |
43 | 43 | ||
44 | return this.authHttp.post(url, normalizedComment) | 44 | return this.authHttp.post<{ comment: VideoCommentServerModel }>(url, normalizedComment) |
45 | .pipe( | 45 | .pipe( |
46 | map((data: any) => this.extractVideoComment(data[ 'comment' ])), | 46 | map(data => this.extractVideoComment(data.comment)), |
47 | catchError(err => this.restExtractor.handleError(err)) | 47 | catchError(err => this.restExtractor.handleError(err)) |
48 | ) | 48 | ) |
49 | } | 49 | } |
diff --git a/client/src/app/videos/+video-watch/comment/video-comments.component.html b/client/src/app/videos/+video-watch/comment/video-comments.component.html index 42e129d65..44016d8ad 100644 --- a/client/src/app/videos/+video-watch/comment/video-comments.component.html +++ b/client/src/app/videos/+video-watch/comment/video-comments.component.html | |||
@@ -4,7 +4,7 @@ | |||
4 | Comments | 4 | Comments |
5 | </div> | 5 | </div> |
6 | 6 | ||
7 | <my-video-feed [syndicationItems]="syndicationItems"></my-video-feed> | 7 | <my-feed [syndicationItems]="syndicationItems"></my-feed> |
8 | </div> | 8 | </div> |
9 | 9 | ||
10 | <ng-template [ngIf]="video.commentsEnabled === true"> | 10 | <ng-template [ngIf]="video.commentsEnabled === true"> |
diff --git a/client/src/app/videos/+video-watch/comment/video-comments.component.scss b/client/src/app/videos/+video-watch/comment/video-comments.component.scss index dbb44c66c..575e331e4 100644 --- a/client/src/app/videos/+video-watch/comment/video-comments.component.scss +++ b/client/src/app/videos/+video-watch/comment/video-comments.component.scss | |||
@@ -23,7 +23,7 @@ | |||
23 | margin-right: 0; | 23 | margin-right: 0; |
24 | } | 24 | } |
25 | 25 | ||
26 | my-video-feed { | 26 | my-feed { |
27 | display: inline-block; | 27 | display: inline-block; |
28 | margin-left: 5px; | 28 | margin-left: 5px; |
29 | } | 29 | } |
diff --git a/client/src/app/videos/+video-watch/comment/video-comments.component.ts b/client/src/app/videos/+video-watch/comment/video-comments.component.ts index 4c1bdf2dd..8850eccd8 100644 --- a/client/src/app/videos/+video-watch/comment/video-comments.component.ts +++ b/client/src/app/videos/+video-watch/comment/video-comments.component.ts | |||
@@ -12,6 +12,7 @@ import { VideoDetails } from '../../../shared/video/video-details.model' | |||
12 | import { VideoComment } from './video-comment.model' | 12 | import { VideoComment } from './video-comment.model' |
13 | import { VideoCommentService } from './video-comment.service' | 13 | import { VideoCommentService } from './video-comment.service' |
14 | import { I18n } from '@ngx-translate/i18n-polyfill' | 14 | import { I18n } from '@ngx-translate/i18n-polyfill' |
15 | import { Syndication } from '@app/shared/video/syndication.model' | ||
15 | 16 | ||
16 | @Component({ | 17 | @Component({ |
17 | selector: 'my-video-comments', | 18 | selector: 'my-video-comments', |
@@ -35,7 +36,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { | |||
35 | threadComments: { [ id: number ]: VideoCommentThreadTree } = {} | 36 | threadComments: { [ id: number ]: VideoCommentThreadTree } = {} |
36 | threadLoading: { [ id: number ]: boolean } = {} | 37 | threadLoading: { [ id: number ]: boolean } = {} |
37 | 38 | ||
38 | syndicationItems: any = [] | 39 | syndicationItems: Syndication[] = [] |
39 | 40 | ||
40 | private sub: Subscription | 41 | private sub: Subscription |
41 | 42 | ||
diff --git a/client/src/app/videos/+video-watch/video-watch.component.scss b/client/src/app/videos/+video-watch/video-watch.component.scss index f31e4694a..2586a2204 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.scss +++ b/client/src/app/videos/+video-watch/video-watch.component.scss | |||
@@ -162,7 +162,7 @@ $other-videos-width: 260px; | |||
162 | } | 162 | } |
163 | } | 163 | } |
164 | 164 | ||
165 | my-video-feed { | 165 | my-feed { |
166 | margin-left: 5px; | 166 | margin-left: 5px; |
167 | margin-top: 1px; | 167 | margin-top: 1px; |
168 | } | 168 | } |
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 | |||
7 | import { MetaService } from '@ngx-meta/core' | 7 | import { MetaService } from '@ngx-meta/core' |
8 | import { NotificationsService } from 'angular2-notifications' | 8 | import { NotificationsService } from 'angular2-notifications' |
9 | import { forkJoin, Subscription } from 'rxjs' | 9 | import { forkJoin, Subscription } from 'rxjs' |
10 | const videojs = require('video.js') | 10 | // FIXME: something weird with our path definition in tsconfig and typings |
11 | // @ts-ignore | ||
12 | import videojs from 'video.js' | ||
11 | import 'videojs-hotkeys' | 13 | import 'videojs-hotkeys' |
12 | import { Hotkey, HotkeysService } from 'angular2-hotkeys' | 14 | import { Hotkey, HotkeysService } from 'angular2-hotkeys' |
13 | import * as WebTorrent from 'webtorrent' | 15 | import * 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 | ||