嘿,所以我想播放一段视频作为我的 konva 舞台。我使用了沙盒中的一个示例,但我不知道如何向其中添加视频播放器控件。有人可以帮忙谢谢
constructor(...args) {
super(...args);
const video = document.createElement("video");
video.src = Vid;
video.type = "video/mp4";
video.controls = true; //I tried adding controls here
this.state = {
video: video,
timestamps: [],
};
video.addEventListener("canplay", () => {
video.play();
this.image.getLayer().batchDraw();
this.requestUpdate();
});
// video.addEventListener("keydown", () => {
//video.pause();
// });
//}
requestUpdate = () => {
this.image.getLayer().batchDraw();
requestAnimationFrame(this.requestUpdate);
};
render() {
return (
<Image
ref={(node) => {
this.image = node;
}}
height={window.innerHeight}
width={window.innerWidth}
image={this.state.video}
controls
/>
);
}