Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem in threecap with reactjs #3

Open
eboujlal opened this issue Mar 16, 2021 · 5 comments
Open

problem in threecap with reactjs #3

eboujlal opened this issue Mar 16, 2021 · 5 comments

Comments

@eboujlal
Copy link

Hello,

I am using threejs to render animation and i want to export this animation to video mp4.
When i want to use threecap library, i got an error :
TypeError: threecap__WEBPACK_IMPORTED_MODULE_7___default.a is not a constructor

And this is my code :

import THREEcap from 'threecap';


var threecap = new THREEcap({});
threecap.record({
	width: 640,
	height: 480,
	fps: 25,
	time: 10,
	format: 'mp4',
	//canvas: canvasDomElement,   // optional, slowest
	composer: this.renderer.domElement // optional, fastest
}).then(function(video) {
	video.saveFile('myVideo.mp4');
});
@rohan-deshpande
Copy link

This package hasn't been bundled properly for use as a module. I've just tried this myself and the only way I could get it to work was to include the lib via a script tag and access via window.THREEcap

@eboujlal
Copy link
Author

Thank you i will try it

@eboujlal
Copy link
Author

Otherwise i recorded canvas with js vanilla

@rohan-deshpande
Copy link

Yah I just published https://www.npmjs.com/package/canvas-to-video which you can try out... I haven't got any tests yet though but give it a go

@jbaicoianu
Copy link
Owner

You're right, this package was written to be used as a global script. It should be relatively straightforward to convert this to use ES6 modules, I haven't had the time to do so myself though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants