Answer the question
In order to leave comments, you need to log in
How to play the downloaded/recorded video from the server on the site (NOT broadcast from IP-camera)?
The folder on the server contains the downloaded/recorded video file in MP4 format. I need to connect to a server remotely and play a file on a client page.
On the client:
TS:
export class VideoLayoutPartComponent implements OnInit {
@Input() part: LayoutPart;
videoSource: SafeUrl;
constructor(private httpService: HttpService, private configurationService: ConfigurationService) { }
ngOnInit(): void {
this.configurationService.configurationUpdated.subscribe(() => this.configurationUpdated());
}
private configurationUpdated() {
return this.httpService.get('configuration/getVideo?videoUID='+ this.part.properties['referenceUID']).subscribe(videoData => {
this.videoSource = videoData;
});
}
<video width="320" height="240" controls="controls" preload="auto">
<source src="{{videoSource}}}" type="video/mp4">
</video>
[HttpGet]
public BitArray GetVideo(Guid? videoUid)
{
return VideoFactory.GetVideo(videoUid);
}
public static BitArray GetVideo(Guid? videoUID)
{
if (videoUID.HasValue && videoUID != Guid.Empty)
{
foreach (var fileInfo in contentFolder.GetFiles())
{
if (Path.GetFileNameWithoutExtension(fileInfo.FullName) == videoUID.ToString())
{
byte[] bytes = File.ReadAllBytes(fileInfo.FullName);
return new BitArray(bytes);
}
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question