diff options
author | Chocobozzz <me@florianbigard.com> | 2022-05-31 14:18:41 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-05-31 14:24:07 +0200 |
commit | d3f4689bded2a6f5b589fe79c3f8b6082d553d9e (patch) | |
tree | 94008e70583444cae96941b6d474f7b6bbd513d1 /client/src/standalone/videos/embed.ts | |
parent | f1a0f3b701e005a9533f09b7913c615376e42f32 (diff) | |
download | PeerTube-d3f4689bded2a6f5b589fe79c3f8b6082d553d9e.tar.gz PeerTube-d3f4689bded2a6f5b589fe79c3f8b6082d553d9e.tar.zst PeerTube-d3f4689bded2a6f5b589fe79c3f8b6082d553d9e.zip |
Add live autostart/messages in embed
Diffstat (limited to 'client/src/standalone/videos/embed.ts')
-rw-r--r-- | client/src/standalone/videos/embed.ts | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/client/src/standalone/videos/embed.ts b/client/src/standalone/videos/embed.ts index c5d017d4a..0a2b0ccbd 100644 --- a/client/src/standalone/videos/embed.ts +++ b/client/src/standalone/videos/embed.ts | |||
@@ -4,12 +4,12 @@ import '../../assets/player/shared/dock/peertube-dock-plugin' | |||
4 | import videojs from 'video.js' | 4 | import videojs from 'video.js' |
5 | import { peertubeTranslate } from '../../../../shared/core-utils/i18n' | 5 | import { peertubeTranslate } from '../../../../shared/core-utils/i18n' |
6 | import { HTMLServerConfig, LiveVideo, ResultList, VideoDetails, VideoPlaylist, VideoPlaylistElement } from '../../../../shared/models' | 6 | import { HTMLServerConfig, LiveVideo, ResultList, VideoDetails, VideoPlaylist, VideoPlaylistElement } from '../../../../shared/models' |
7 | import { PeertubePlayerManager } from '../../assets/player' | ||
7 | import { TranslationsManager } from '../../assets/player/translations-manager' | 8 | import { TranslationsManager } from '../../assets/player/translations-manager' |
8 | import { getParamString } from '../../root-helpers' | 9 | import { getParamString } from '../../root-helpers' |
9 | import { PeerTubeEmbedApi } from './embed-api' | 10 | import { PeerTubeEmbedApi } from './embed-api' |
10 | import { AuthHTTP, PeerTubePlugin, PlayerManagerOptions, PlaylistFetcher, PlaylistTracker, VideoFetcher } from './shared' | 11 | import { AuthHTTP, LiveManager, PeerTubePlugin, PlayerManagerOptions, PlaylistFetcher, PlaylistTracker, VideoFetcher } from './shared' |
11 | import { PlayerHTML } from './shared/player-html' | 12 | import { PlayerHTML } from './shared/player-html' |
12 | import { PeertubePlayerManager } from '../../assets/player' | ||
13 | 13 | ||
14 | export class PeerTubeEmbed { | 14 | export class PeerTubeEmbed { |
15 | player: videojs.Player | 15 | player: videojs.Player |
@@ -26,6 +26,7 @@ export class PeerTubeEmbed { | |||
26 | private readonly peertubePlugin: PeerTubePlugin | 26 | private readonly peertubePlugin: PeerTubePlugin |
27 | private readonly playerHTML: PlayerHTML | 27 | private readonly playerHTML: PlayerHTML |
28 | private readonly playerManagerOptions: PlayerManagerOptions | 28 | private readonly playerManagerOptions: PlayerManagerOptions |
29 | private readonly liveManager: LiveManager | ||
29 | 30 | ||
30 | private playlistTracker: PlaylistTracker | 31 | private playlistTracker: PlaylistTracker |
31 | 32 | ||
@@ -37,6 +38,7 @@ export class PeerTubeEmbed { | |||
37 | this.peertubePlugin = new PeerTubePlugin(this.http) | 38 | this.peertubePlugin = new PeerTubePlugin(this.http) |
38 | this.playerHTML = new PlayerHTML(videoWrapperId) | 39 | this.playerHTML = new PlayerHTML(videoWrapperId) |
39 | this.playerManagerOptions = new PlayerManagerOptions(this.playerHTML, this.videoFetcher, this.peertubePlugin) | 40 | this.playerManagerOptions = new PlayerManagerOptions(this.playerHTML, this.videoFetcher, this.peertubePlugin) |
41 | this.liveManager = new LiveManager(this.playerHTML) | ||
40 | 42 | ||
41 | try { | 43 | try { |
42 | this.config = JSON.parse(window['PeerTubeServerConfig']) | 44 | this.config = JSON.parse(window['PeerTubeServerConfig']) |
@@ -235,6 +237,17 @@ export class PeerTubeEmbed { | |||
235 | } | 237 | } |
236 | 238 | ||
237 | this.peertubePlugin.getPluginsManager().runHook('action:embed.player.loaded', undefined, { player: this.player, videojs, video }) | 239 | this.peertubePlugin.getPluginsManager().runHook('action:embed.player.loaded', undefined, { player: this.player, videojs, video }) |
240 | |||
241 | if (video.isLive) { | ||
242 | this.liveManager.displayInfoAndListenForChanges({ | ||
243 | video, | ||
244 | translations, | ||
245 | onPublishedVideo: () => { | ||
246 | this.liveManager.stopListeningForChanges(video) | ||
247 | this.loadVideoAndBuildPlayer(video.uuid) | ||
248 | } | ||
249 | }) | ||
250 | } | ||
238 | } | 251 | } |
239 | 252 | ||
240 | private resetPlayerElement () { | 253 | private resetPlayerElement () { |