diff --git a/projects/common/components/control-bar/control-bar.component.ts b/projects/common/components/control-bar/control-bar.component.ts index 696c6a1679e9f90a75e0d0dab1baaf1fe2ae7f1c..c032a3c5526e589938b80e9b5c43b525efbcfa69 100644 --- a/projects/common/components/control-bar/control-bar.component.ts +++ b/projects/common/components/control-bar/control-bar.component.ts @@ -39,6 +39,7 @@ export class ControlBarComponent implements OnInit, OnChanges, OnDestroy { ngOnInit(): void { this.dependencyDissolved = !this.playerProperties.activeAfterID; + this.playbackTime = this.playerProperties.playbackTime; this.player.ondurationchange = () => this.initTimeValues(); this.player.ontimeupdate = () => { this.currentTime = this.player.currentTime / 60; @@ -163,12 +164,9 @@ export class ControlBarComponent implements OnInit, OnChanges, OnDestroy { } private toPlaybackTime(): number { - let newPlayBackTime: number = 0; - if (this.player.duration && this.player.currentTime) { - newPlayBackTime = this.runCounter + this.player.currentTime / this.player.duration; - } - this.playbackTime = newPlayBackTime; - return newPlayBackTime; + this.playbackTime = this.player.duration ? + this.runCounter + this.player.currentTime / this.player.duration : this.playbackTime; + return this.playbackTime; } private initTimeValues(): void { @@ -180,6 +178,7 @@ export class ControlBarComponent implements OnInit, OnChanges, OnDestroy { this.player.currentTime = (this.playerProperties.playbackTime - this.runCounter) * this.player.duration; this.checkDisabledState(this.runCounter); this.checkValidState(this.runCounter); + this.sendPlaybackTimeChanged(); } else { this.duration = 0; this.runCounter = 0; diff --git a/projects/player/src/app/components/element-container/element-container.component.ts b/projects/player/src/app/components/element-container/element-container.component.ts index f1c2fd053b6661016e0bbe8829ceb8dcb9cbf2d6..8f7ef363960604a90b2780febadcb7a79381affd 100644 --- a/projects/player/src/app/components/element-container/element-container.component.ts +++ b/projects/player/src/app/components/element-container/element-container.component.ts @@ -256,7 +256,9 @@ export class ElementContainerComponent implements OnInit { break; case 'video': case 'audio': - elementModel.playbackTime = unitStateElementCode.value; + if (elementModel && elementModel.playerProps) { + elementModel.playerProps.playbackTime = unitStateElementCode.value as number; + } break; default: elementModel.value = unitStateElementCode.value; @@ -272,9 +274,9 @@ export class ElementContainerComponent implements OnInit { case 'image': return { id: elementModel.id, value: (elementModel as ImageElement).magnifierUsed }; case 'video': - return { id: elementModel.id, value: (elementModel as VideoElement).playbackTime }; + return { id: elementModel.id, value: (elementModel as VideoElement).playerProps.playbackTime }; case 'audio': - return { id: elementModel.id, value: (elementModel as AudioElement).playbackTime }; + return { id: elementModel.id, value: (elementModel as AudioElement).playerProps.playbackTime }; default: return { id: elementModel.id, value: (elementModel as InputElement).value }; } diff --git a/projects/player/src/app/components/unit-state/unit-state.component.ts b/projects/player/src/app/components/unit-state/unit-state.component.ts index d9256cb2a64aa3e09e1b336df4a56bd706bc9ad5..c666df9be4823d7141e6ad6580fdb23036513c68 100644 --- a/projects/player/src/app/components/unit-state/unit-state.component.ts +++ b/projects/player/src/app/components/unit-state/unit-state.component.ts @@ -165,6 +165,9 @@ export class UnitStateComponent implements OnInit, OnDestroy { private sendVopStateChangedNotification(): void { // give the form time to change its valid status Promise.resolve().then(() => { + // eslint-disable-next-line no-console + console.log('player: this.unitStateService.unitStateElementCodes', + this.unitStateService.unitStateElementCodes); const unitState: UnitState = { dataParts: { elementCodes: JSON.stringify(this.unitStateService.unitStateElementCodes)