aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/+video-watch/video-watch.component.ts
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2019-12-20 17:49:57 +0100
committerRigel Kent <sendmemail@rigelk.eu>2019-12-20 17:49:57 +0100
commit223b24e618146f85b20b5bf365bc18d14a5964cd (patch)
tree236fde34d190fa5d0d9a44c6760c0161594dd872 /client/src/app/videos/+video-watch/video-watch.component.ts
parent1dc240a9488c66ad38205d08fcfdb32d35efceaa (diff)
downloadPeerTube-223b24e618146f85b20b5bf365bc18d14a5964cd.tar.gz
PeerTube-223b24e618146f85b20b5bf365bc18d14a5964cd.tar.zst
PeerTube-223b24e618146f85b20b5bf365bc18d14a5964cd.zip
Fix upnext, refactor avatar menu, add to playlist overflow
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, 14 insertions, 2 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 bad0144bf..dcceb1400 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/videos/+video-watch/video-watch.component.ts
@@ -37,7 +37,7 @@ import { PluginService } from '@app/core/plugins/plugin.service'
37import { HooksService } from '@app/core/plugins/hooks.service' 37import { HooksService } from '@app/core/plugins/hooks.service'
38import { PlatformLocation } from '@angular/common' 38import { PlatformLocation } from '@angular/common'
39import { RecommendedVideosComponent } from '../recommendations/recommended-videos.component' 39import { RecommendedVideosComponent } from '../recommendations/recommended-videos.component'
40import { scrollToTop } from '@app/shared/misc/utils' 40import { scrollToTop, isInViewport, isXPercentInViewport } from '@app/shared/misc/utils'
41 41
42@Component({ 42@Component({
43 selector: 'my-video-watch', 43 selector: 'my-video-watch',
@@ -478,12 +478,18 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
478 478
479 /** 479 /**
480 * replaces this.player.one('ended') 480 * replaces this.player.one('ended')
481 * define 'condition(next)' to return true to wait, false to stop 481 * 'condition()': true to make the upnext functionality trigger,
482 * false to disable the upnext functionality
483 * go to the next video in 'condition()' if you don't want of the timer.
484 * 'next': function triggered at the end of the timer.
485 * 'suspended': function used at each clic of the timer checking if we need
486 * to reset progress and wait until 'suspended' becomes truthy again.
482 */ 487 */
483 this.player.upnext({ 488 this.player.upnext({
484 timeout: 10000, // 10s 489 timeout: 10000, // 10s
485 headText: this.i18n('Up Next'), 490 headText: this.i18n('Up Next'),
486 cancelText: this.i18n('Cancel'), 491 cancelText: this.i18n('Cancel'),
492 suspendedText: this.i18n('Autoplay is suspended'),
487 getTitle: () => this.nextVideoTitle, 493 getTitle: () => this.nextVideoTitle,
488 next: () => this.zone.run(() => this.autoplayNext()), 494 next: () => this.zone.run(() => this.autoplayNext()),
489 condition: () => { 495 condition: () => {
@@ -496,6 +502,12 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
496 return true // upnext will trigger 502 return true // upnext will trigger
497 } 503 }
498 return false // upnext will not trigger, and instead leave the video stopping 504 return false // upnext will not trigger, and instead leave the video stopping
505 },
506 suspended: () => {
507 return (
508 !isXPercentInViewport(this.player.el(), 80) ||
509 !document.getElementById('content').contains(document.activeElement)
510 )
499 } 511 }
500 }) 512 })
501 513