manish kumar
manish kumar

Reputation: 4692

Wait until an HTML5 video loads-Typescript

I have a video tag, that I dynamically change its source as I am letting the user to choose from a number of videos from the database. The problem is that, i am getting error while calling the load function

Here is my code:

var video = <HTMLInputElement>document.getElementById('introVideo');
video.src = this.videoUrl;
video.load();`

But doing so i am getting a warning

[ts] Property load does not exists on type HTMLInputElement

Upvotes: 0

Views: 723

Answers (1)

gdostie
gdostie

Reputation: 81

I did not test this, but try casting your HTML element to a HTMLVideoElement instead of HTMLInputElement because the method .load() does not exist on HTMLInputElement type.

Cheers.

Upvotes: 3

Related Questions