I have problem with video src. After clicking on my div (camera) in source code I can see that video src is changing properly, but videos arent being played. What should I do?
Below are my components - streaming.component.ts (responsible for displaying videos of chosen camera component) and camera.component.ts (for viewing icon with camera name)
streaming.component.ts
import {Component} from '@angular/core';
import {CameraComponent} from '../camera/camera.component';
@Component({
moduleId: module.id,
selector: 'streaming',
template: `
<camera cameraName="Kamera 1" (click)='cameraStream("sample.mp4")'></camera>
<camera cameraName="Kamera 2" (click)='cameraStream("sample2.mp4")'></camera>
<camera cameraName="Kamera 3" (click)='cameraStream("sample3.mp4")'></camera>
<camera cameraName="Kamera 4" (click)='cameraStream("sample4.mp4")'></camera>
<video width="800" controls>
<source src = "{{cameraSrc}}" type="video/mp4">
Your browser does not support HTML5 video.
</video>
<p>{{cameraSrc}}</p>
`,
directives: [CameraComponent]
})
export class StreamingComponent {
cameraSrc:string;
constructor() { }
cameraStream(chosenCamera :string){
this.cameraSrc=chosenCamera;
}
}
Videos are working ,because when I put
<source src = "{{cameraSrc}}" type="video/mp4">
everything is fine.
camera.component.ts
import { Component ,Input } from '@angular/core';
@Component({
moduleId: module.id,
selector: 'camera',
templateUrl: 'camera.component.html'
})
export class CameraComponent {
@Input() cameraName:string = "";
constructor() { }
}
I cant comment because I am too new, sorry.
The reason that interpolation isnt working for you is because its used for data binding , not property binding. The brackets indicate that its a property of the element and not an observable attached to a static property.