+ }
+
+ private async initCore () {
+ const urlParts = window.location.pathname.split('/')
+ const videoId = urlParts[ urlParts.length - 1 ]
+
+ const videoPromise = this.loadVideoInfo(videoId)
+ const captionsPromise = this.loadVideoCaptions(videoId)
+ const configPromise = this.loadConfig()
+
+ const translationsPromise = TranslationsManager.getServerTranslations(window.location.origin, navigator.language)
+ const videoResponse = await videoPromise
+
+ if (!videoResponse.ok) {
+ const serverTranslations = await translationsPromise
+
+ if (videoResponse.status === 404) return this.videoNotFound(serverTranslations)
+
+ return this.videoFetchError(serverTranslations)
+ }
+
+ const videoInfo: VideoDetails = await videoResponse.json()
+ this.loadPlaceholder(videoInfo)
+
+ const PeertubePlayerManagerModulePromise = import('../../assets/player/peertube-player-manager')
+
+ const promises = [ translationsPromise, captionsPromise, configPromise, PeertubePlayerManagerModulePromise ]
+ const [ serverTranslations, captionsResponse, configResponse, PeertubePlayerManagerModule ] = await Promise.all(promises)
+
+ const PeertubePlayerManager = PeertubePlayerManagerModule.PeertubePlayerManager
+ const videoCaptions = await this.buildCaptions(serverTranslations, captionsResponse)
+
+ this.loadParams(videoInfo)
+
+ const options: PeertubePlayerManagerOptions = {
+ common: {
+ autoplay: this.autoplay,
+ controls: this.controls,
+ muted: this.muted,
+ loop: this.loop,
+ captions: videoCaptions.length !== 0,
+ startTime: this.startTime,
+ stopTime: this.stopTime,
+ subtitle: this.subtitle,
+
+ videoCaptions,
+ inactivityTimeout: 1500,
+ videoViewUrl: this.getVideoUrl(videoId) + '/views',
+
+ playerElement: this.videoElement,
+ onPlayerElementChange: (element: HTMLVideoElement) => this.videoElement = element,
+
+ videoDuration: videoInfo.duration,
+ enableHotkeys: true,
+ peertubeLink: true,
+ poster: window.location.origin + videoInfo.previewPath,
+ theaterButton: false,
+
+ serverUrl: window.location.origin,
+ language: navigator.language,
+ embedUrl: window.location.origin + videoInfo.embedPath
+ },
+
+ webtorrent: {
+ videoFiles: videoInfo.files
+ }
+ }
+
+ if (this.mode === 'p2p-media-loader') {
+ const hlsPlaylist = videoInfo.streamingPlaylists.find(p => p.type === VideoStreamingPlaylistType.HLS)