mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ATS-854] Add media tracks to player from webvtt rendition (#6626)
* ATS-854 Add media tracks to player from webvtt rendition * ATS-854 Fix condition * ATS-854 Fix lint * ATS-854 Move logic to media player * ATS-854 Fix angular.json * ATS-854 Fix error
This commit is contained in:
committed by
GitHub
parent
e0462b126a
commit
5d8d5f56f3
@@ -17,6 +17,8 @@
|
||||
|
||||
import { Component, Input, OnChanges, SimpleChanges, ViewEncapsulation, Output, EventEmitter } from '@angular/core';
|
||||
import { ContentService } from '../../services/content.service';
|
||||
import { Track } from '../models/viewer.model';
|
||||
import { ViewUtilService } from '../services/view-util.service';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-media-player',
|
||||
@@ -39,18 +41,31 @@ export class MediaPlayerComponent implements OnChanges {
|
||||
@Input()
|
||||
nameFile: string;
|
||||
|
||||
@Input()
|
||||
nodeId: string;
|
||||
|
||||
@Input()
|
||||
tracks: Track[] = [];
|
||||
|
||||
@Output()
|
||||
error = new EventEmitter<any>();
|
||||
|
||||
constructor(private contentService: ContentService ) {}
|
||||
constructor(private contentService: ContentService, private viewUtils: ViewUtilService) {
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
const blobFile = changes['blobFile'];
|
||||
const nodeId = changes['nodeId'];
|
||||
|
||||
if (blobFile && blobFile.currentValue) {
|
||||
this.urlFile = this.contentService.createTrustedUrl(this.blobFile);
|
||||
return;
|
||||
}
|
||||
|
||||
if (nodeId && nodeId.currentValue) {
|
||||
this.viewUtils.generateMediaTracks(this.nodeId).then((tracks) => this.tracks = tracks);
|
||||
}
|
||||
|
||||
if (!this.urlFile && !this.blobFile) {
|
||||
throw new Error('Attribute urlFile or blobFile is required');
|
||||
}
|
||||
|
Reference in New Issue
Block a user