diff options
author | Chocobozzz <me@florianbigard.com> | 2022-11-15 11:57:49 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-11-15 11:57:49 +0100 |
commit | 59a643aa5cf6775d27dfcc147b19c4537292d53c (patch) | |
tree | 74bc87e2f0f5581306c8ea9dd1f8acf05833a74a /client/src/assets/player/shared | |
parent | c2419476302b20e9fe3708d7a0a889ae18c95c1b (diff) | |
download | PeerTube-59a643aa5cf6775d27dfcc147b19c4537292d53c.tar.gz PeerTube-59a643aa5cf6775d27dfcc147b19c4537292d53c.tar.zst PeerTube-59a643aa5cf6775d27dfcc147b19c4537292d53c.zip |
Force autoplay when live starts
Using the mute
Diffstat (limited to 'client/src/assets/player/shared')
3 files changed, 9 insertions, 5 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 }) |