Skip to content
Snippets Groups Projects
video.component.ts 1.76 KiB
Newer Older
  • Learn to ignore specific revisions
  • import { Component, Input } from '@angular/core';
    
    import { VideoElement } from './video-element';
    import { MediaPlayerElementComponent } from '../../directives/media-player-element-component.directive';
    
    
    @Component({
      selector: 'app-video',
      template: `
    
        <div [style.width]="elementModel.positionProps.fixedSize ? elementModel.width + 'px' : '100%'"
             [style.height]="elementModel.positionProps.fixedSize ? elementModel.height + 'px' : '100%'"
             [class.center-content]="elementModel.positionProps.dynamicPositioning && elementModel.positionProps.fixedSize"
             [class]="elementModel.scale ? 'fit-video' : 'max-size-video'">
    
                 (playing)="onMediaPlayStatusChanged.emit(this.elementModel.id)"
                 (pause)="onMediaPlayStatusChanged.emit(null)"
    
                 [style.width.%]="100"
                 [src]="elementModel.src | safeResourceUrl">
    
          </video>
    
          <app-control-bar class="correct-position"
                           [player]="player"
    
                           [active]="active"
    
                           [id]="elementModel.id"
                           [playerProperties]="elementModel.playerProps"
    
                           [dependencyDissolved]="dependencyDissolved"
                           (onMediaValidStatusChanged)="onMediaValidStatusChanged.emit($event)"
    
                           (elementValueChanged)="elementValueChanged.emit($event)">
    
          </app-control-bar>
    
      styles: [
        '.correct-position{ display: block; margin-top: -4px; }',
        '.max-size-video{ width: fit-content; max-height: fit-content }',
        '.fit-video{ width: 100%; height: 100%; object-fit: contain}'
      ]
    
    export class VideoComponent extends MediaPlayerElementComponent {
    
      @Input() elementModel!: VideoElement;