Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix selecting a frame on Safari

Chocobozzz750139403615
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 ee50d65c69..caf0b3f45e 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<EmbedComponent>('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
+ }
+ })
})
}