import TimedAudio from './timedAudio'; /** * TimedVideo is a thin subclass of TimedAudio that uses an HTMLVideoElement * instead of an HTMLAudioElement. It preserves the TimedAudio API and maps * video playback to the same timed progress events. * * constructor(duration=0, url='', gain=1.0, aspectRatio=0) */ export default class TimedVideo extends TimedAudio { constructor(duration = 0, url = '', gain = 1.0, aspectRatio = 0) { super(duration, url, gain); // create a video element and replace the audio element const video = document.createElement('video'); video.src = url; if (aspectRatio) { (video.style as any).aspectRatio = String(aspectRatio); } this.element = video as unknown as HTMLAudioElement; // keep typed as element in parent } }