SamuelScheit / puppeteer-stream

A Library for puppeteer to retrieve audio and/or video streams
MIT License
333 stars 105 forks source link

Solving a race condition #97

Closed SoTrxII closed 1 year ago

SoTrxII commented 1 year ago

Hey, I'm currently using puppeteer-stream for one of my projects. While playing around with it, I've come across this particular bug a few times.

Error: Evaluation failed: ReferenceError: START_RECORDING is not defined
    at pptr://__puppeteer_evaluation_script__:1:16

I'm using this lib both on my own computer and in a headless docker container, and saw that in the container case, the function declared by the extension had no time to register in the page context before being called.

To solve this, I've added a configurable pseudo-retry policy, that simply checks if the START_RECORDING symbol exists before attempting to retrieve the stream.

Keep up the great work !

nivhsay commented 1 year ago

Hello, any chance you have a couple of minutes to make an npm release with the merged commit? Thanks!

SamuelScheit commented 1 year ago

@nivhsay Done 👍

npm i puppeteer-stream@3.0.4