diff options
Diffstat (limited to 'client/src/app/videos')
3 files changed, 19 insertions, 7 deletions
diff --git a/client/src/app/videos/+video-watch/video-watch.component.html b/client/src/app/videos/+video-watch/video-watch.component.html index 7a9f00a50..9e69033e1 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.html +++ b/client/src/app/videos/+video-watch/video-watch.component.html | |||
@@ -114,9 +114,9 @@ | |||
114 | ></my-video-actions-dropdown> | 114 | ></my-video-actions-dropdown> |
115 | </div> | 115 | </div> |
116 | 116 | ||
117 | <div class="video-info-likes-dislikes-bar-outerContainer"> | 117 | <div class="video-info-likes-dislikes-bar-outer-container"> |
118 | <div | 118 | <div |
119 | class="video-info-likes-dislikes-bar-innerContainer" | 119 | class="video-info-likes-dislikes-bar-inner-container" |
120 | *ngIf="video.likes !== 0 || video.dislikes !== 0" | 120 | *ngIf="video.likes !== 0 || video.dislikes !== 0" |
121 | [ngbTooltip]="likesBarTooltipText" | 121 | [ngbTooltip]="likesBarTooltipText" |
122 | placement="bottom" | 122 | placement="bottom" |
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 180b7c6ad..f9ff83c34 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.scss +++ b/client/src/app/videos/+video-watch/video-watch.component.scss | |||
@@ -297,13 +297,13 @@ $video-info-margin-left: 44px; | |||
297 | } | 297 | } |
298 | } | 298 | } |
299 | 299 | ||
300 | .video-info-likes-dislikes-bar-outerContainer { | 300 | .video-info-likes-dislikes-bar-outer-container { |
301 | position: relative; | 301 | position: relative; |
302 | } | 302 | } |
303 | 303 | ||
304 | .video-info-likes-dislikes-bar-innerContainer { | 304 | .video-info-likes-dislikes-bar-inner-container { |
305 | position: absolute; | 305 | position: absolute; |
306 | height: 30px; | 306 | height: 20px; |
307 | } | 307 | } |
308 | 308 | ||
309 | .video-info-likes-dislikes-bar { | 309 | .video-info-likes-dislikes-bar { |
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' | |||
37 | import { HooksService } from '@app/core/plugins/hooks.service' | 37 | import { HooksService } from '@app/core/plugins/hooks.service' |
38 | import { PlatformLocation } from '@angular/common' | 38 | import { PlatformLocation } from '@angular/common' |
39 | import { RecommendedVideosComponent } from '../recommendations/recommended-videos.component' | 39 | import { RecommendedVideosComponent } from '../recommendations/recommended-videos.component' |
40 | import { scrollToTop } from '@app/shared/misc/utils' | 40 | import { 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 | ||