CA
Crawlee & Apify•2y ago
extended-salmon

Can I use streams to upload video to Apify storage?

I am using screen recorder (https://github.com/prasanaworld/puppeteer-screen-recorder) and I want to be able to save it upon finishing the run. Can I use Apify storage for it?
GitHub
GitHub - prasanaworld/puppeteer-screen-recorder
Contribute to prasanaworld/puppeteer-screen-recorder development by creating an account on GitHub.
11 Replies
MEE6
MEE6•2y ago
@Vadym just advanced to level 1! Thanks for your contributions! 🎉
Pepa J
Pepa J•2y ago
Hello @Vadym I have never tried it, but as long as you have a ReadStream and know the content-type, I don't see a reason why it should not be possible. 🙂
extended-salmon
extended-salmonOP•2y ago
You should update the doc to mention that storage can accept any Readable @Pepa J is there a directory on the host machine that I can write temp files to?
Pepa J
Pepa J•2y ago
@Vadym I suggest you to use key-value store, when running locally it will write on your disk, when running on platform you'ill see id on the Output->KeyValue store tab.
extended-salmon
extended-salmonOP•2y ago
My recording library does not work with streams, I have to write it out to a file first :C Can you suggest a directory that I can save in on the host? @Pepa J
Pepa J
Pepa J•2y ago
@Vadym It seems it does, based on the docs https://github.com/prasanaworld/puppeteer-screen-recorder
const pipeStream = new PassThrough();
await recorder.startStream(pipeStream);
const pipeStream = new PassThrough();
await recorder.startStream(pipeStream);
and then save pipeStream to key-value store, something like:
await Actor.setValue('video.mp4', pipeStream, {contentType: 'video/mp4'});
await Actor.setValue('video.mp4', pipeStream, {contentType: 'video/mp4'});
otherwise try /tmp/ then
extended-salmon
extended-salmonOP•2y ago
@Pepa J unfortunately, it does not work. The stream hangs up. Looks like a bug in the recorder. Can you point me to a temp dir on the container that actors have access to so that I can save to disk first?
Pepa J
Pepa J•2y ago
Is /tmp/ as I sugested not working for you? Otherwise you may change the Dockerfile so you can have more control about the file system settings.
extended-salmon
extended-salmonOP•2y ago
Oh, did not see the suggestion, thanks man! @Pepa J is it ./tmp/or /tmp/ ?
Pepa J
Pepa J•2y ago
/tmp/
extended-salmon
extended-salmonOP•2y ago
Gotcha!

Did you find this page helpful?