aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+videos/+video-watch/video-watch.component.ts
diff options
context:
space:
mode:
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.ts11
1 files changed, 6 insertions, 5 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 067d3bc84..f13c885f2 100644
--- a/client/src/app/+videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/+videos/+video-watch/video-watch.component.ts
@@ -1,6 +1,6 @@
1import { Hotkey, HotkeysService } from 'angular2-hotkeys' 1import { Hotkey, HotkeysService } from 'angular2-hotkeys'
2import { forkJoin, map, Observable, of, Subscription, switchMap } from 'rxjs' 2import { forkJoin, map, Observable, of, Subscription, switchMap } from 'rxjs'
3import { isP2PEnabled } from 'src/assets/player/utils' 3import { VideoJsPlayer } from 'video.js'
4import { PlatformLocation } from '@angular/common' 4import { PlatformLocation } from '@angular/common'
5import { Component, ElementRef, Inject, LOCALE_ID, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core' 5import { Component, ElementRef, Inject, LOCALE_ID, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core'
6import { ActivatedRoute, Router } from '@angular/router' 6import { ActivatedRoute, Router } from '@angular/router'
@@ -24,6 +24,7 @@ import { Video, VideoCaptionService, VideoDetails, VideoService } from '@app/sha
24import { SubscribeButtonComponent } from '@app/shared/shared-user-subscription' 24import { SubscribeButtonComponent } from '@app/shared/shared-user-subscription'
25import { LiveVideoService } from '@app/shared/shared-video-live' 25import { LiveVideoService } from '@app/shared/shared-video-live'
26import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist' 26import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist'
27import { isP2PEnabled } from '@root-helpers/video'
27import { timeToInt } from '@shared/core-utils' 28import { timeToInt } from '@shared/core-utils'
28import { 29import {
29 HTMLServerConfig, 30 HTMLServerConfig,
@@ -58,7 +59,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
58 @ViewChild('videoWatchPlaylist', { static: true }) videoWatchPlaylist: VideoWatchPlaylistComponent 59 @ViewChild('videoWatchPlaylist', { static: true }) videoWatchPlaylist: VideoWatchPlaylistComponent
59 @ViewChild('subscribeButton') subscribeButton: SubscribeButtonComponent 60 @ViewChild('subscribeButton') subscribeButton: SubscribeButtonComponent
60 61
61 player: any 62 player: VideoJsPlayer
62 playerElement: HTMLVideoElement 63 playerElement: HTMLVideoElement
63 playerPlaceholderImgSrc: string 64 playerPlaceholderImgSrc: string
64 theaterEnabled = false 65 theaterEnabled = false
@@ -418,8 +419,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
418 this.zone.runOutsideAngular(async () => { 419 this.zone.runOutsideAngular(async () => {
419 this.player = await PeertubePlayerManager.initialize(playerMode, playerOptions, player => this.player = player) 420 this.player = await PeertubePlayerManager.initialize(playerMode, playerOptions, player => this.player = player)
420 421
421 this.player.on('customError', ({ err }: { err: any }) => { 422 this.player.on('customError', (_e, data: any) => {
422 this.zone.run(() => this.handleGlobalError(err)) 423 this.zone.run(() => this.handleGlobalError(data.err))
423 }) 424 })
424 425
425 this.player.on('timeupdate', () => { 426 this.player.on('timeupdate', () => {
@@ -458,7 +459,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
458 459
459 suspended: () => { 460 suspended: () => {
460 return ( 461 return (
461 !isXPercentInViewport(this.player.el(), 80) || 462 !isXPercentInViewport(this.player.el() as HTMLElement, 80) ||
462 !document.getElementById('content').contains(document.activeElement) 463 !document.getElementById('content').contains(document.activeElement)
463 ) 464 )
464 } 465 }