aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/assets/player')
-rw-r--r--client/src/assets/player/shared/manager-options/manager-options-builder.ts8
-rw-r--r--client/src/assets/player/shared/peertube/peertube-plugin.ts2
-rw-r--r--client/src/assets/player/shared/webtorrent/webtorrent-plugin.ts4
-rw-r--r--client/src/assets/player/types/manager-options.ts2
-rw-r--r--client/src/assets/player/types/peertube-videojs-typings.ts4
5 files changed, 13 insertions, 7 deletions
diff --git a/client/src/assets/player/shared/manager-options/manager-options-builder.ts b/client/src/assets/player/shared/manager-options/manager-options-builder.ts
index 2d96c9410..4d227eb2a 100644
--- a/client/src/assets/player/shared/manager-options/manager-options-builder.ts
+++ b/client/src/assets/player/shared/manager-options/manager-options-builder.ts
@@ -105,10 +105,12 @@ export class ManagerOptionsBuilder {
105 Object.assign(videojsOptions, { language: commonOptions.language }) 105 Object.assign(videojsOptions, { language: commonOptions.language })
106 } 106 }
107 107
108 console.log(videojsOptions)
109
108 return videojsOptions 110 return videojsOptions
109 } 111 }
110 112
111 private getAutoPlayValue (autoplay: any, alreadyPlayed: boolean) { 113 private getAutoPlayValue (autoplay: videojs.Autoplay, alreadyPlayed: boolean) {
112 if (autoplay !== true) return autoplay 114 if (autoplay !== true) return autoplay
113 115
114 // On first play, disable autoplay to avoid issues 116 // On first play, disable autoplay to avoid issues
@@ -117,7 +119,9 @@ export class ManagerOptionsBuilder {
117 return alreadyPlayed ? 'play' : false 119 return alreadyPlayed ? 'play' : false
118 } 120 }
119 121
120 return 'play' 122 return this.options.common.forceAutoplay
123 ? 'any'
124 : 'play'
121 } 125 }
122 126
123 getContextMenuOptions (player: videojs.Player, commonOptions: CommonOptions) { 127 getContextMenuOptions (player: videojs.Player, commonOptions: CommonOptions) {
diff --git a/client/src/assets/player/shared/peertube/peertube-plugin.ts b/client/src/assets/player/shared/peertube/peertube-plugin.ts
index 56de66998..ec8fbb320 100644
--- a/client/src/assets/player/shared/peertube/peertube-plugin.ts
+++ b/client/src/assets/player/shared/peertube/peertube-plugin.ts
@@ -52,7 +52,7 @@ class PeerTubePlugin extends Plugin {
52 this.videoCaptions = options.videoCaptions 52 this.videoCaptions = options.videoCaptions
53 this.initialInactivityTimeout = this.player.options_.inactivityTimeout 53 this.initialInactivityTimeout = this.player.options_.inactivityTimeout
54 54
55 if (options.autoplay) this.player.addClass('vjs-has-autoplay') 55 if (options.autoplay !== false) this.player.addClass('vjs-has-autoplay')
56 56
57 this.player.on('autoplay-failure', () => { 57 this.player.on('autoplay-failure', () => {
58 this.player.removeClass('vjs-has-autoplay') 58 this.player.removeClass('vjs-has-autoplay')
diff --git a/client/src/assets/player/shared/webtorrent/webtorrent-plugin.ts b/client/src/assets/player/shared/webtorrent/webtorrent-plugin.ts
index 658b7c867..46d009410 100644
--- a/client/src/assets/player/shared/webtorrent/webtorrent-plugin.ts
+++ b/client/src/assets/player/shared/webtorrent/webtorrent-plugin.ts
@@ -25,7 +25,7 @@ class WebTorrentPlugin extends Plugin {
25 25
26 private readonly playerElement: HTMLVideoElement 26 private readonly playerElement: HTMLVideoElement
27 27
28 private readonly autoplay: boolean = false 28 private readonly autoplay: boolean | string = false
29 private readonly startTime: number = 0 29 private readonly startTime: number = 0
30 private readonly savePlayerSrcFunction: videojs.Player['src'] 30 private readonly savePlayerSrcFunction: videojs.Player['src']
31 private readonly videoDuration: number 31 private readonly videoDuration: number
@@ -449,7 +449,7 @@ class WebTorrentPlugin extends Plugin {
449 return 449 return
450 } 450 }
451 451
452 if (this.autoplay) { 452 if (this.autoplay !== false) {
453 this.player.posterImage.hide() 453 this.player.posterImage.hide()
454 454
455 return this.updateVideoFile(undefined, { forcePlay: true, seek: this.startTime }) 455 return this.updateVideoFile(undefined, { forcePlay: true, seek: this.startTime })
diff --git a/client/src/assets/player/types/manager-options.ts b/client/src/assets/player/types/manager-options.ts
index 9da8fedf8..3057a5adb 100644
--- a/client/src/assets/player/types/manager-options.ts
+++ b/client/src/assets/player/types/manager-options.ts
@@ -36,6 +36,8 @@ export interface CommonOptions extends CustomizationOptions {
36 onPlayerElementChange: (element: HTMLVideoElement) => void 36 onPlayerElementChange: (element: HTMLVideoElement) => void
37 37
38 autoplay: boolean 38 autoplay: boolean
39 forceAutoplay: boolean
40
39 p2pEnabled: boolean 41 p2pEnabled: boolean
40 42
41 nextVideo?: () => void 43 nextVideo?: () => void
diff --git a/client/src/assets/player/types/peertube-videojs-typings.ts b/client/src/assets/player/types/peertube-videojs-typings.ts
index f02673a66..3d9d5270e 100644
--- a/client/src/assets/player/types/peertube-videojs-typings.ts
+++ b/client/src/assets/player/types/peertube-videojs-typings.ts
@@ -91,7 +91,7 @@ type VideoJSCaption = {
91type PeerTubePluginOptions = { 91type PeerTubePluginOptions = {
92 mode: PlayerMode 92 mode: PlayerMode
93 93
94 autoplay: boolean 94 autoplay: videojs.Autoplay
95 videoDuration: number 95 videoDuration: number
96 96
97 videoViewUrl: string 97 videoViewUrl: string
@@ -143,7 +143,7 @@ type PeerTubeP2PInfoButtonOptions = {
143type WebtorrentPluginOptions = { 143type WebtorrentPluginOptions = {
144 playerElement: HTMLVideoElement 144 playerElement: HTMLVideoElement
145 145
146 autoplay: boolean 146 autoplay: videojs.Autoplay
147 videoDuration: number 147 videoDuration: number
148 148
149 videoFiles: VideoFile[] 149 videoFiles: VideoFile[]