To display videos, I get a video from an API (link to video). I use this link as a source for in my template. Important: The video is on an external server. Unfortunately, now only the player is shown to me, but no video. The navigation of the player is also not clickable. If I wrote the video URL directly to the template, the video will work without problems.
Template:
<div *ngIf="templates">
<video width="400" controls>
<source src={{templates.media[0].remoteUrl}} type="video/mp4">Your browser does not support HTML5 video.
</video>
</div>
component:
import { Component, OnInit } from '@angular/core';
import {Router, ActivatedRoute, Params} from '@angular/router';
import { Template } from '../models/index';
import { TemplateService } from '../services/index';
@Component({
selector: 'app-template-details',
templateUrl: './template-details.component.html',
styleUrls: ['./template-details.component.css']
})
export class TemplateDetailsComponent implements OnInit {
//patient: Patient;
templates: Template[] = [];
constructor(private activatedRoute: ActivatedRoute, private templateService: TemplateService) { }
ngOnInit() {
this.activatedRoute.params.subscribe((params: Params) => {
let id= params['id'];
this.showTemplateDetailsForId(id);
});
}
private showTemplateDetailsForId(id: number) {
this.templateService.getTemplateById(id).subscribe(templates => { this.templates = templates; });
}
}