diff options
author | Chocobozzz <me@florianbigard.com> | 2021-12-15 15:58:10 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-12-16 10:08:55 +0100 |
commit | a9bfa85d2cdf13670aaced740da5b493fbeddfce (patch) | |
tree | 3781c9218d4cc7786b6589365c0efbed2151703d /client/src/app/+videos | |
parent | c77fdc605b3ccc1ab6890f889d8200fbe9372949 (diff) | |
download | PeerTube-a9bfa85d2cdf13670aaced740da5b493fbeddfce.tar.gz PeerTube-a9bfa85d2cdf13670aaced740da5b493fbeddfce.tar.zst PeerTube-a9bfa85d2cdf13670aaced740da5b493fbeddfce.zip |
Add ability for admins to set default p2p policy
Diffstat (limited to 'client/src/app/+videos')
4 files changed, 68 insertions, 88 deletions
diff --git a/client/src/app/+videos/+video-watch/shared/information/privacy-concerns.component.ts b/client/src/app/+videos/+video-watch/shared/information/privacy-concerns.component.ts index bbc81d46d..24030df3e 100644 --- a/client/src/app/+videos/+video-watch/shared/information/privacy-concerns.component.ts +++ b/client/src/app/+videos/+video-watch/shared/information/privacy-concerns.component.ts | |||
@@ -1,9 +1,8 @@ | |||
1 | import { Component, Input, OnInit } from '@angular/core' | 1 | import { Component, Input, OnInit } from '@angular/core' |
2 | import { ServerService } from '@app/core' | 2 | import { ServerService, User, UserService } from '@app/core' |
3 | import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' | 3 | import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' |
4 | import { HTMLServerConfig, Video } from '@shared/models' | 4 | import { HTMLServerConfig, Video } from '@shared/models' |
5 | import { getStoredP2PEnabled } from '../../../../../assets/player/peertube-player-local-storage' | 5 | import { isP2PEnabled } from '../../../../../assets/player/utils' |
6 | import { isWebRTCDisabled } from '../../../../../assets/player/utils' | ||
7 | 6 | ||
8 | @Component({ | 7 | @Component({ |
9 | selector: 'my-privacy-concerns', | 8 | selector: 'my-privacy-concerns', |
@@ -15,33 +14,32 @@ export class PrivacyConcernsComponent implements OnInit { | |||
15 | 14 | ||
16 | @Input() video: Video | 15 | @Input() video: Video |
17 | 16 | ||
18 | display = true | 17 | display = false |
19 | 18 | ||
20 | private serverConfig: HTMLServerConfig | 19 | private serverConfig: HTMLServerConfig |
21 | 20 | ||
22 | constructor ( | 21 | constructor ( |
23 | private serverService: ServerService | 22 | private serverService: ServerService, |
23 | private userService: UserService | ||
24 | ) { } | 24 | ) { } |
25 | 25 | ||
26 | ngOnInit () { | 26 | ngOnInit () { |
27 | this.serverConfig = this.serverService.getHTMLConfig() | 27 | this.serverConfig = this.serverService.getHTMLConfig() |
28 | 28 | ||
29 | if (isWebRTCDisabled() || this.isTrackerDisabled() || this.isP2PDisabled() || this.alreadyAccepted()) { | 29 | this.userService.getAnonymousOrLoggedUser() |
30 | this.display = false | 30 | .subscribe(user => this.updateDisplay(user)) |
31 | } | ||
32 | } | 31 | } |
33 | 32 | ||
34 | acceptedPrivacyConcern () { | 33 | acceptedPrivacyConcern () { |
35 | peertubeLocalStorage.setItem(PrivacyConcernsComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY, 'true') | 34 | peertubeLocalStorage.setItem(PrivacyConcernsComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY, 'true') |
36 | this.display = false | ||
37 | } | ||
38 | 35 | ||
39 | private isTrackerDisabled () { | 36 | this.display = false |
40 | return this.video.isLocal && this.serverConfig.tracker.enabled === false | ||
41 | } | 37 | } |
42 | 38 | ||
43 | private isP2PDisabled () { | 39 | private updateDisplay (user: User) { |
44 | return getStoredP2PEnabled() === false | 40 | if (isP2PEnabled(this.video, this.serverConfig, user.p2pEnabled) && !this.alreadyAccepted()) { |
41 | this.display = true | ||
42 | } | ||
45 | } | 43 | } |
46 | 44 | ||
47 | private alreadyAccepted () { | 45 | private alreadyAccepted () { |
diff --git a/client/src/app/+videos/+video-watch/shared/playlist/video-watch-playlist.component.ts b/client/src/app/+videos/+video-watch/shared/playlist/video-watch-playlist.component.ts index b2863fed6..fbf9a3687 100644 --- a/client/src/app/+videos/+video-watch/shared/playlist/video-watch-playlist.component.ts +++ b/client/src/app/+videos/+video-watch/shared/playlist/video-watch-playlist.component.ts | |||
@@ -1,16 +1,9 @@ | |||
1 | import { Component, EventEmitter, Input, Output } from '@angular/core' | 1 | import { Component, EventEmitter, Input, Output } from '@angular/core' |
2 | import { Router } from '@angular/router' | 2 | import { Router } from '@angular/router' |
3 | import { | 3 | import { AuthService, ComponentPagination, HooksService, Notifier, SessionStorageService, UserService } from '@app/core' |
4 | AuthService, | ||
5 | ComponentPagination, | ||
6 | HooksService, | ||
7 | LocalStorageService, | ||
8 | Notifier, | ||
9 | SessionStorageService, | ||
10 | UserService | ||
11 | } from '@app/core' | ||
12 | import { VideoPlaylist, VideoPlaylistElement, VideoPlaylistService } from '@app/shared/shared-video-playlist' | 4 | import { VideoPlaylist, VideoPlaylistElement, VideoPlaylistService } from '@app/shared/shared-video-playlist' |
13 | import { peertubeLocalStorage, peertubeSessionStorage } from '@root-helpers/peertube-web-storage' | 5 | import { peertubeSessionStorage } from '@root-helpers/peertube-web-storage' |
6 | import { getBoolOrDefault } from '@root-helpers/local-storage-utils' | ||
14 | import { VideoPlaylistPrivacy } from '@shared/models' | 7 | import { VideoPlaylistPrivacy } from '@shared/models' |
15 | 8 | ||
16 | @Component({ | 9 | @Component({ |
@@ -19,8 +12,7 @@ import { VideoPlaylistPrivacy } from '@shared/models' | |||
19 | styleUrls: [ './video-watch-playlist.component.scss' ] | 12 | styleUrls: [ './video-watch-playlist.component.scss' ] |
20 | }) | 13 | }) |
21 | export class VideoWatchPlaylistComponent { | 14 | export class VideoWatchPlaylistComponent { |
22 | static LOCAL_STORAGE_AUTO_PLAY_NEXT_VIDEO_PLAYLIST = 'auto_play_video_playlist' | 15 | static SESSION_STORAGE_LOOP_PLAYLIST = 'loop_playlist' |
23 | static SESSION_STORAGE_AUTO_PLAY_NEXT_VIDEO_PLAYLIST = 'loop_playlist' | ||
24 | 16 | ||
25 | @Input() playlist: VideoPlaylist | 17 | @Input() playlist: VideoPlaylist |
26 | 18 | ||
@@ -47,19 +39,15 @@ export class VideoWatchPlaylistComponent { | |||
47 | private auth: AuthService, | 39 | private auth: AuthService, |
48 | private notifier: Notifier, | 40 | private notifier: Notifier, |
49 | private videoPlaylist: VideoPlaylistService, | 41 | private videoPlaylist: VideoPlaylistService, |
50 | private localStorageService: LocalStorageService, | ||
51 | private sessionStorage: SessionStorageService, | 42 | private sessionStorage: SessionStorageService, |
52 | private router: Router | 43 | private router: Router |
53 | ) { | 44 | ) { |
54 | // defaults to true | 45 | this.userService.getAnonymousOrLoggedUser() |
55 | this.autoPlayNextVideoPlaylist = this.auth.isLoggedIn() | 46 | .subscribe(user => this.autoPlayNextVideoPlaylist = user.autoPlayNextVideoPlaylist) |
56 | ? this.auth.getUser().autoPlayNextVideoPlaylist | ||
57 | : this.localStorageService.getItem(VideoWatchPlaylistComponent.LOCAL_STORAGE_AUTO_PLAY_NEXT_VIDEO_PLAYLIST) !== 'false' | ||
58 | 47 | ||
59 | this.setAutoPlayNextVideoPlaylistSwitchText() | 48 | this.setAutoPlayNextVideoPlaylistSwitchText() |
60 | 49 | ||
61 | // defaults to false | 50 | this.loopPlaylist = getBoolOrDefault(this.sessionStorage.getItem(VideoWatchPlaylistComponent.SESSION_STORAGE_LOOP_PLAYLIST), false) |
62 | this.loopPlaylist = this.sessionStorage.getItem(VideoWatchPlaylistComponent.SESSION_STORAGE_AUTO_PLAY_NEXT_VIDEO_PLAYLIST) === 'true' | ||
63 | this.setLoopPlaylistSwitchText() | 51 | this.setLoopPlaylistSwitchText() |
64 | } | 52 | } |
65 | 53 | ||
@@ -201,16 +189,9 @@ export class VideoWatchPlaylistComponent { | |||
201 | this.autoPlayNextVideoPlaylist = !this.autoPlayNextVideoPlaylist | 189 | this.autoPlayNextVideoPlaylist = !this.autoPlayNextVideoPlaylist |
202 | this.setAutoPlayNextVideoPlaylistSwitchText() | 190 | this.setAutoPlayNextVideoPlaylistSwitchText() |
203 | 191 | ||
204 | peertubeLocalStorage.setItem( | 192 | const details = { autoPlayNextVideoPlaylist: this.autoPlayNextVideoPlaylist } |
205 | VideoWatchPlaylistComponent.LOCAL_STORAGE_AUTO_PLAY_NEXT_VIDEO_PLAYLIST, | ||
206 | this.autoPlayNextVideoPlaylist.toString() | ||
207 | ) | ||
208 | 193 | ||
209 | if (this.auth.isLoggedIn()) { | 194 | if (this.auth.isLoggedIn()) { |
210 | const details = { | ||
211 | autoPlayNextVideoPlaylist: this.autoPlayNextVideoPlaylist | ||
212 | } | ||
213 | |||
214 | this.userService.updateMyProfile(details) | 195 | this.userService.updateMyProfile(details) |
215 | .subscribe({ | 196 | .subscribe({ |
216 | next: () => { | 197 | next: () => { |
@@ -219,6 +200,8 @@ export class VideoWatchPlaylistComponent { | |||
219 | 200 | ||
220 | error: err => this.notifier.error(err.message) | 201 | error: err => this.notifier.error(err.message) |
221 | }) | 202 | }) |
203 | } else { | ||
204 | this.userService.updateMyAnonymousProfile(details) | ||
222 | } | 205 | } |
223 | } | 206 | } |
224 | 207 | ||
@@ -227,7 +210,7 @@ export class VideoWatchPlaylistComponent { | |||
227 | this.setLoopPlaylistSwitchText() | 210 | this.setLoopPlaylistSwitchText() |
228 | 211 | ||
229 | peertubeSessionStorage.setItem( | 212 | peertubeSessionStorage.setItem( |
230 | VideoWatchPlaylistComponent.SESSION_STORAGE_AUTO_PLAY_NEXT_VIDEO_PLAYLIST, | 213 | VideoWatchPlaylistComponent.SESSION_STORAGE_LOOP_PLAYLIST, |
231 | this.loopPlaylist.toString() | 214 | this.loopPlaylist.toString() |
232 | ) | 215 | ) |
233 | } | 216 | } |
diff --git a/client/src/app/+videos/+video-watch/shared/recommendations/recommended-videos.component.ts b/client/src/app/+videos/+video-watch/shared/recommendations/recommended-videos.component.ts index dfc296d15..97f742499 100644 --- a/client/src/app/+videos/+video-watch/shared/recommendations/recommended-videos.component.ts +++ b/client/src/app/+videos/+video-watch/shared/recommendations/recommended-videos.component.ts | |||
@@ -1,10 +1,9 @@ | |||
1 | import { Observable } from 'rxjs' | 1 | import { Observable } from 'rxjs' |
2 | import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core' | 2 | import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core' |
3 | import { AuthService, Notifier, SessionStorageService, User, UserService } from '@app/core' | 3 | import { AuthService, Notifier, User, UserService } from '@app/core' |
4 | import { Video } from '@app/shared/shared-main' | 4 | import { Video } from '@app/shared/shared-main' |
5 | import { MiniatureDisplayOptions } from '@app/shared/shared-video-miniature' | 5 | import { MiniatureDisplayOptions } from '@app/shared/shared-video-miniature' |
6 | import { VideoPlaylist } from '@app/shared/shared-video-playlist' | 6 | import { VideoPlaylist } from '@app/shared/shared-video-playlist' |
7 | import { UserLocalStorageKeys } from '@root-helpers/users' | ||
8 | import { RecommendationInfo } from './recommendation-info.model' | 7 | import { RecommendationInfo } from './recommendation-info.model' |
9 | import { RecommendedVideosStore } from './recommended-videos.store' | 8 | import { RecommendedVideosStore } from './recommended-videos.store' |
10 | 9 | ||
@@ -39,24 +38,14 @@ export class RecommendedVideosComponent implements OnInit, OnChanges { | |||
39 | private userService: UserService, | 38 | private userService: UserService, |
40 | private authService: AuthService, | 39 | private authService: AuthService, |
41 | private notifier: Notifier, | 40 | private notifier: Notifier, |
42 | private store: RecommendedVideosStore, | 41 | private store: RecommendedVideosStore |
43 | private sessionStorageService: SessionStorageService | ||
44 | ) { | 42 | ) { |
45 | this.videos$ = this.store.recommendations$ | 43 | this.videos$ = this.store.recommendations$ |
46 | this.hasVideos$ = this.store.hasRecommendations$ | 44 | this.hasVideos$ = this.store.hasRecommendations$ |
47 | this.videos$.subscribe(videos => this.gotRecommendations.emit(videos)) | 45 | this.videos$.subscribe(videos => this.gotRecommendations.emit(videos)) |
48 | 46 | ||
49 | if (this.authService.isLoggedIn()) { | 47 | this.userService.getAnonymousOrLoggedUser() |
50 | this.autoPlayNextVideo = this.authService.getUser().autoPlayNextVideo | 48 | .subscribe(user => this.autoPlayNextVideo = user.autoPlayNextVideo) |
51 | } else { | ||
52 | this.autoPlayNextVideo = this.sessionStorageService.getItem(UserLocalStorageKeys.SESSION_STORAGE_AUTO_PLAY_NEXT_VIDEO) === 'true' | ||
53 | |||
54 | this.sessionStorageService.watch([ UserLocalStorageKeys.SESSION_STORAGE_AUTO_PLAY_NEXT_VIDEO ]).subscribe( | ||
55 | () => { | ||
56 | this.autoPlayNextVideo = this.sessionStorageService.getItem(UserLocalStorageKeys.SESSION_STORAGE_AUTO_PLAY_NEXT_VIDEO) === 'true' | ||
57 | } | ||
58 | ) | ||
59 | } | ||
60 | 49 | ||
61 | this.autoPlayNextVideoTooltip = $localize`When active, the next video is automatically played after the current one.` | 50 | this.autoPlayNextVideoTooltip = $localize`When active, the next video is automatically played after the current one.` |
62 | } | 51 | } |
@@ -77,13 +66,9 @@ export class RecommendedVideosComponent implements OnInit, OnChanges { | |||
77 | } | 66 | } |
78 | 67 | ||
79 | switchAutoPlayNextVideo () { | 68 | switchAutoPlayNextVideo () { |
80 | this.sessionStorageService.setItem(UserLocalStorageKeys.SESSION_STORAGE_AUTO_PLAY_NEXT_VIDEO, this.autoPlayNextVideo.toString()) | 69 | const details = { autoPlayNextVideo: this.autoPlayNextVideo } |
81 | 70 | ||
82 | if (this.authService.isLoggedIn()) { | 71 | if (this.authService.isLoggedIn()) { |
83 | const details = { | ||
84 | autoPlayNextVideo: this.autoPlayNextVideo | ||
85 | } | ||
86 | |||
87 | this.userService.updateMyProfile(details) | 72 | this.userService.updateMyProfile(details) |
88 | .subscribe({ | 73 | .subscribe({ |
89 | next: () => { | 74 | next: () => { |
@@ -92,6 +77,8 @@ export class RecommendedVideosComponent implements OnInit, OnChanges { | |||
92 | 77 | ||
93 | error: err => this.notifier.error(err.message) | 78 | error: err => this.notifier.error(err.message) |
94 | }) | 79 | }) |
80 | } else { | ||
81 | this.userService.updateMyAnonymousProfile(details) | ||
95 | } | 82 | } |
96 | } | 83 | } |
97 | } | 84 | } |
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 fd61bcbf0..d542f243c 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.ts +++ b/client/src/app/+videos/+video-watch/video-watch.component.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | import { Hotkey, HotkeysService } from 'angular2-hotkeys' | 1 | import { Hotkey, HotkeysService } from 'angular2-hotkeys' |
2 | import { forkJoin, Subscription } from 'rxjs' | 2 | import { forkJoin, Subscription } from 'rxjs' |
3 | import { isP2PEnabled } from 'src/assets/player/utils' | ||
3 | import { PlatformLocation } from '@angular/common' | 4 | import { PlatformLocation } from '@angular/common' |
4 | import { Component, ElementRef, Inject, LOCALE_ID, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core' | 5 | import { Component, ElementRef, Inject, LOCALE_ID, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core' |
5 | import { ActivatedRoute, Router } from '@angular/router' | 6 | import { ActivatedRoute, Router } from '@angular/router' |
@@ -14,6 +15,7 @@ import { | |||
14 | RestExtractor, | 15 | RestExtractor, |
15 | ScreenService, | 16 | ScreenService, |
16 | ServerService, | 17 | ServerService, |
18 | User, | ||
17 | UserService | 19 | UserService |
18 | } from '@app/core' | 20 | } from '@app/core' |
19 | import { HooksService } from '@app/core/plugins/hooks.service' | 21 | import { HooksService } from '@app/core/plugins/hooks.service' |
@@ -237,31 +239,34 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
237 | 'filter:api.video-watch.video.get.result' | 239 | 'filter:api.video-watch.video.get.result' |
238 | ) | 240 | ) |
239 | 241 | ||
240 | forkJoin([ videoObs, this.videoCaptionService.listCaptions(videoId) ]) | 242 | forkJoin([ |
241 | .subscribe({ | 243 | videoObs, |
242 | next: ([ video, captionsResult ]) => { | 244 | this.videoCaptionService.listCaptions(videoId), |
243 | const queryParams = this.route.snapshot.queryParams | 245 | this.userService.getAnonymousOrLoggedUser() |
246 | ]).subscribe({ | ||
247 | next: ([ video, captionsResult, loggedInOrAnonymousUser ]) => { | ||
248 | const queryParams = this.route.snapshot.queryParams | ||
244 | 249 | ||
245 | const urlOptions = { | 250 | const urlOptions = { |
246 | resume: queryParams.resume, | 251 | resume: queryParams.resume, |
247 | 252 | ||
248 | startTime: queryParams.start, | 253 | startTime: queryParams.start, |
249 | stopTime: queryParams.stop, | 254 | stopTime: queryParams.stop, |
250 | 255 | ||
251 | muted: queryParams.muted, | 256 | muted: queryParams.muted, |
252 | loop: queryParams.loop, | 257 | loop: queryParams.loop, |
253 | subtitle: queryParams.subtitle, | 258 | subtitle: queryParams.subtitle, |
254 | 259 | ||
255 | playerMode: queryParams.mode, | 260 | playerMode: queryParams.mode, |
256 | peertubeLink: false | 261 | peertubeLink: false |
257 | } | 262 | } |
258 | 263 | ||
259 | this.onVideoFetched(video, captionsResult.data, urlOptions) | 264 | this.onVideoFetched({ video, videoCaptions: captionsResult.data, loggedInOrAnonymousUser, urlOptions }) |
260 | .catch(err => this.handleGlobalError(err)) | 265 | .catch(err => this.handleGlobalError(err)) |
261 | }, | 266 | }, |
262 | 267 | ||
263 | error: err => this.handleRequestError(err) | 268 | error: err => this.handleRequestError(err) |
264 | }) | 269 | }) |
265 | } | 270 | } |
266 | 271 | ||
267 | private loadPlaylist (playlistId: string) { | 272 | private loadPlaylist (playlistId: string) { |
@@ -323,11 +328,14 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
323 | this.notifier.error(errorMessage) | 328 | this.notifier.error(errorMessage) |
324 | } | 329 | } |
325 | 330 | ||
326 | private async onVideoFetched ( | 331 | private async onVideoFetched (options: { |
327 | video: VideoDetails, | 332 | video: VideoDetails |
328 | videoCaptions: VideoCaption[], | 333 | videoCaptions: VideoCaption[] |
329 | urlOptions: URLOptions | 334 | urlOptions: URLOptions |
330 | ) { | 335 | loggedInOrAnonymousUser: User |
336 | }) { | ||
337 | const { video, videoCaptions, urlOptions, loggedInOrAnonymousUser } = options | ||
338 | |||
331 | this.subscribeToLiveEventsIfNeeded(this.video, video) | 339 | this.subscribeToLiveEventsIfNeeded(this.video, video) |
332 | 340 | ||
333 | this.video = video | 341 | this.video = video |
@@ -346,7 +354,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
346 | if (res === false) return this.location.back() | 354 | if (res === false) return this.location.back() |
347 | } | 355 | } |
348 | 356 | ||
349 | this.buildPlayer(urlOptions) | 357 | this.buildPlayer(urlOptions, loggedInOrAnonymousUser) |
350 | .catch(err => console.error('Cannot build the player', err)) | 358 | .catch(err => console.error('Cannot build the player', err)) |
351 | 359 | ||
352 | this.setOpenGraphTags() | 360 | this.setOpenGraphTags() |
@@ -359,7 +367,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
359 | this.hooks.runAction('action:video-watch.video.loaded', 'video-watch', hookOptions) | 367 | this.hooks.runAction('action:video-watch.video.loaded', 'video-watch', hookOptions) |
360 | } | 368 | } |
361 | 369 | ||
362 | private async buildPlayer (urlOptions: URLOptions) { | 370 | private async buildPlayer (urlOptions: URLOptions, loggedInOrAnonymousUser: User) { |
363 | // Flush old player if needed | 371 | // Flush old player if needed |
364 | this.flushPlayer() | 372 | this.flushPlayer() |
365 | 373 | ||
@@ -380,6 +388,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
380 | video: this.video, | 388 | video: this.video, |
381 | videoCaptions: this.videoCaptions, | 389 | videoCaptions: this.videoCaptions, |
382 | urlOptions, | 390 | urlOptions, |
391 | loggedInOrAnonymousUser, | ||
383 | user: this.user | 392 | user: this.user |
384 | } | 393 | } |
385 | const { playerMode, playerOptions } = await this.hooks.wrapFun( | 394 | const { playerMode, playerOptions } = await this.hooks.wrapFun( |
@@ -517,9 +526,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
517 | video: VideoDetails | 526 | video: VideoDetails |
518 | videoCaptions: VideoCaption[] | 527 | videoCaptions: VideoCaption[] |
519 | urlOptions: CustomizationOptions & { playerMode: PlayerMode } | 528 | urlOptions: CustomizationOptions & { playerMode: PlayerMode } |
529 | loggedInOrAnonymousUser: User | ||
520 | user?: AuthUser | 530 | user?: AuthUser |
521 | }) { | 531 | }) { |
522 | const { video, videoCaptions, urlOptions, user } = params | 532 | const { video, videoCaptions, urlOptions, loggedInOrAnonymousUser, user } = params |
523 | 533 | ||
524 | const getStartTime = () => { | 534 | const getStartTime = () => { |
525 | const byUrl = urlOptions.startTime !== undefined | 535 | const byUrl = urlOptions.startTime !== undefined |
@@ -547,6 +557,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
547 | const options: PeertubePlayerManagerOptions = { | 557 | const options: PeertubePlayerManagerOptions = { |
548 | common: { | 558 | common: { |
549 | autoplay: this.isAutoplay(), | 559 | autoplay: this.isAutoplay(), |
560 | p2pEnabled: isP2PEnabled(video, this.serverConfig, loggedInOrAnonymousUser.p2pEnabled), | ||
561 | |||
550 | nextVideo: () => this.playNextVideoInAngularZone(), | 562 | nextVideo: () => this.playNextVideoInAngularZone(), |
551 | 563 | ||
552 | playerElement: this.playerElement, | 564 | playerElement: this.playerElement, |