feat: video support
idk if useful but would be good if you could have a node that plays a video
k.loadSprite("testVid", "./mp3s/testVid.mov")
k.add([
k.sprite("testVid")
]);
and also the controls like with audio component would be in video component (like pause, play, loop, detune, start position)
i think this is awesome, and should be added
I think playing a video on a texture would be most powerful? Since you can still use shaders and vertex deformation?
I think playing a video on a texture would be most powerful? Since you can still use shaders and vertex deformation?
Yes, would be nice
I see this is a feature now mentioned here... https://v4000.kaplayjs.com/guides/video/
but.. I can not get it to work...
- Do I need to load a sprite like "k.loadSprite("box", "sprites/box.png");"
- what url am I putting?
I have tried different variations but I get the following error....
"Uncaught TypeError: Cannot read properties of undefined (reading 'width') at Object.video (kaplay.js?v=636aa5ed:3539:101) at main.js:30:5"
at first I thought it was because I was trying a .wmv file but .mp4 gives the same error... I am just using the code as listed in the guide link above... any help would be appreciated... sorry if this is the wrong place for this kind of ?
Is your video file on the same server as your script?
yes... same server... local server...
in the kaplay.js... it hits here: line 3539 function Ii(t, e) { let r = document.createElement("video"), n = false, o = false, s = false, a = new xe(u.gfx.ggl, e.width, e.height);
but the element is obviously empty...
No, the element is r. What is undefined is e, the opt, you probably use video(url) instead of video(url, { width:320, height: 200 });
No, the element is r. What is undefined is e, the opt, you probably use video(url) instead of video(url, { width:320, height: 200 });
specifying width and height worked... am I looking at the wrong documentation? I looked at the link above... might have just not been updated but if there is a better source for documentation then please let me know... thanks for the reply!!!
I would definitely be interested in exposing settings/attributes like loop, autoplay, muted, etc... because it is a bit difficult to start the video on page load unless you set some of these features.
Docs are not updated. I will setup a documentation for master, because we don't continuous releae