diff --git a/.gitignore b/.gitignore
index 3a91facb4..fbf8fdf3c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -37,6 +37,8 @@
/scripts/i18n/generate-iso639-target.ts
# Other
+/dump.rdb
+/.theia/
/profiling/
/*.zip
/*.tar.xz
diff --git a/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html b/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html
index a11238925..06fd9833a 100644
--- a/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html
+++ b/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html
@@ -47,6 +47,11 @@
inputName="autoPlayVideo" formControlName="autoPlayVideo"
i18n-labelText labelText="Automatically plays video"
>
+
+
diff --git a/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.ts b/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.ts
index 4fb828082..99eee23b8 100644
--- a/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.ts
+++ b/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.ts
@@ -36,6 +36,7 @@ export class MyAccountVideoSettingsComponent extends FormReactive implements OnI
nsfwPolicy: null,
webTorrentEnabled: null,
autoPlayVideo: null,
+ autoPlayNextVideo: null,
videoLanguages: null
})
@@ -57,6 +58,7 @@ export class MyAccountVideoSettingsComponent extends FormReactive implements OnI
nsfwPolicy: this.user.nsfwPolicy,
webTorrentEnabled: this.user.webTorrentEnabled,
autoPlayVideo: this.user.autoPlayVideo === true,
+ autoPlayNextVideo: this.user.autoPlayNextVideo,
videoLanguages
})
})
@@ -66,6 +68,7 @@ export class MyAccountVideoSettingsComponent extends FormReactive implements OnI
const nsfwPolicy = this.form.value[ 'nsfwPolicy' ]
const webTorrentEnabled = this.form.value['webTorrentEnabled']
const autoPlayVideo = this.form.value['autoPlayVideo']
+ const autoPlayNextVideo = this.form.value['autoPlayNextVideo']
let videoLanguages: string[] = this.form.value['videoLanguages']
if (Array.isArray(videoLanguages)) {
@@ -84,6 +87,7 @@ export class MyAccountVideoSettingsComponent extends FormReactive implements OnI
nsfwPolicy,
webTorrentEnabled,
autoPlayVideo,
+ autoPlayNextVideo,
videoLanguages
}
diff --git a/client/src/app/shared/users/user.model.ts b/client/src/app/shared/users/user.model.ts
index 656b73dd2..e0b3f1faf 100644
--- a/client/src/app/shared/users/user.model.ts
+++ b/client/src/app/shared/users/user.model.ts
@@ -16,6 +16,7 @@ export class User implements UserServerModel {
adminFlags?: UserAdminFlag
autoPlayVideo: boolean
+ autoPlayNextVideo: boolean
webTorrentEnabled: boolean
videosHistoryEnabled: boolean
videoLanguages: string[]
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 6a02f630a..cd60c407f 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.html
+++ b/client/src/app/videos/+video-watch/video-watch.component.html
@@ -199,7 +199,11 @@
-
+
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 21a24113f..1e7991738 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/videos/+video-watch/video-watch.component.ts
@@ -35,6 +35,7 @@ import { getStoredTheater } from '../../../assets/player/peertube-player-local-s
import { PluginService } from '@app/core/plugins/plugin.service'
import { HooksService } from '@app/core/plugins/hooks.service'
import { PlatformLocation } from '@angular/common'
+import { randomInt } from '@shared/core-utils/miscs/miscs'
@Component({
selector: 'my-video-watch',
@@ -69,6 +70,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
remoteServerDown = false
hotkeys: Hotkey[]
+ private nextVideoUuid = ''
private currentTime: number
private paramsSub: Subscription
private queryParamsSub: Subscription
@@ -217,6 +219,13 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
return this.video.tags
}
+ onRecommendations (videos: Video[]) {
+ if (videos.length > 0) {
+ // Pick a random video until the recommendations are improved
+ this.nextVideoUuid = videos[randomInt(0,videos.length - 1)].uuid
+ }
+ }
+
onVideoRemoved () {
this.redirectService.redirectToHomepage()
}
@@ -477,6 +486,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
this.player.one('ended', () => {
if (this.playlist) {
this.zone.run(() => this.videoWatchPlaylist.navigateToNextPlaylistVideo())
+ } else if (this.user && this.user.autoPlayNextVideo) {
+ this.zone.run(() => this.autoplayNext())
}
})
@@ -500,6 +511,12 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
this.hooks.runAction('action:video-watch.video.loaded', 'video-watch')
}
+ private autoplayNext () {
+ if (this.nextVideoUuid) {
+ this.router.navigate([ '/videos/watch', this.nextVideoUuid ])
+ }
+ }
+
private setRating (nextRating: UserVideoRateType) {
const ratingMethods: { [id in UserVideoRateType]: (id: number) => Observable
} = {
like: this.videoService.setVideoLike,
diff --git a/client/src/app/videos/recommendations/recommended-videos.component.ts b/client/src/app/videos/recommendations/recommended-videos.component.ts
index 68fd750cc..7e0fb8856 100644
--- a/client/src/app/videos/recommendations/recommended-videos.component.ts
+++ b/client/src/app/videos/recommendations/recommended-videos.component.ts
@@ -1,4 +1,4 @@
-import { Component, Input, OnChanges } from '@angular/core'
+import { Component, Input, Output, OnChanges, EventEmitter } from '@angular/core'
import { Observable } from 'rxjs'
import { Video } from '@app/shared/video/video.model'
import { RecommendationInfo } from '@app/shared/video/recommendation-info.model'
@@ -12,6 +12,7 @@ import { User } from '@app/shared'
export class RecommendedVideosComponent implements OnChanges {
@Input() inputRecommendation: RecommendationInfo
@Input() user: User
+ @Output() gotRecommendations = new EventEmitter