diff --git a/client/package.json b/client/package.json index 699f5e5b5..2407bcc06 100644 --- a/client/package.json +++ b/client/package.json @@ -84,7 +84,7 @@ "debug": "^4.3.1", "dompurify": "^3.1.6", "expect-webdriverio": "^5.1.0", - "hls.js": "~1.5.11", + "hls.js": "~1.6.7", "intl-messageformat": "^10.1.0", "jschannel": "^1.0.2", "linkify-html": "^4.0.2", diff --git a/client/src/app/+videos-publish-manage/shared-manage/common/thumbnail-manager.component.ts b/client/src/app/+videos-publish-manage/shared-manage/common/thumbnail-manager.component.ts index ee50d65c6..caf0b3f45 100644 --- a/client/src/app/+videos-publish-manage/shared-manage/common/thumbnail-manager.component.ts +++ b/client/src/app/+videos-publish-manage/shared-manage/common/thumbnail-manager.component.ts @@ -1,8 +1,18 @@ import { CommonModule } from '@angular/common' -import { Component, OnInit, forwardRef, inject, input, viewChild } from '@angular/core' +import { + Component, + EnvironmentInjector, + OnInit, + afterNextRender, + forwardRef, + inject, + input, + runInInjectionContext, + viewChild +} from '@angular/core' import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' import { DragDropDirective } from '@app/+videos-publish-manage/+video-publish/shared/drag-drop.directive' -import { ServerService } from '@app/core' +import { Notifier, ServerService } from '@app/core' import { ReactiveFileComponent } from '@app/shared/shared-forms/reactive-file.component' import { BytesPipe } from '@app/shared/shared-main/common/bytes.pipe' import { EmbedComponent } from '@app/shared/shared-main/video/embed.component' @@ -27,6 +37,8 @@ import { VideoEdit } from './video-edit.model' }) export class ThumbnailManagerComponent implements OnInit, ControlValueAccessor { private serverService = inject(ServerService) + private notifier = inject(Notifier) + private environmentInjector = inject(EnvironmentInjector) readonly embed = viewChild('embed') @@ -119,8 +131,16 @@ export class ThumbnailManagerComponent implements OnInit, ControlValueAccessor { selectFromVideo () { this.selectingFromVideo = true - setTimeout(() => { - this.player = new PeerTubePlayer(this.embed().getIframe()) + runInInjectionContext(this.environmentInjector, () => { + afterNextRender(() => { + try { + this.player = new PeerTubePlayer(this.embed().getIframe()) + } catch (err) { + this.notifier.error('Error creating PeerTube embed: ' + err.message) + this.selectingFromVideo = false + return + } + }) }) } diff --git a/client/yarn.lock b/client/yarn.lock index a78cfdf96..23374c599 100644 --- a/client/yarn.lock +++ b/client/yarn.lock @@ -5558,10 +5558,10 @@ headers-utils@^1.2.0: resolved "https://registry.yarnpkg.com/headers-utils/-/headers-utils-1.2.5.tgz#899d6a76b21bcbe18d6108f56136fdbd4f30c404" integrity sha512-DAzV5P/pk3wTU/8TLZN+zFTDv4Xa1QDTU8pRvovPetcOMbmqq8CwsAvZBLPZHH6usxyy31zMp7I4aCYb6XIf6w== -hls.js@~1.5.11: - version "1.5.20" - resolved "https://registry.yarnpkg.com/hls.js/-/hls.js-1.5.20.tgz#7eb23bb5e2595311d4e2761038ca6882673de7e2" - integrity sha512-uu0VXUK52JhihhnN/MVVo1lvqNNuhoxkonqgO3IpjvQiGpJBdIXMGkofjQb/j9zvV7a1SW8U9g1FslWx/1HOiQ== +hls.js@~1.6.7: + version "1.6.7" + resolved "https://registry.yarnpkg.com/hls.js/-/hls.js-1.6.7.tgz#1b45ed55dfc92e06edc15b98e6374bd13f78af65" + integrity sha512-QW2fnwDGKGc9DwQUGLbmMOz8G48UZK7PVNJPcOUql1b8jubKx4/eMHNP5mGqr6tYlJNDG1g10Lx2U/qPzL6zwQ== hmac-drbg@^1.0.1: version "1.0.1"