SamuelScheit / puppeteer-stream

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

extension options.js chrome.sockets.udp seems deprecated in chrome Version 112.0.5615.137 (Official Build) (x86_64) #100

Closed unijoy closed 1 year ago

unijoy commented 1 year ago

after upgrade chrome, record not working

Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'udp') at chrome-extension://jjndjgheafjngoipoacpjgeicjeomjli/options.js:29:18 at new Promise (<anonymous>) at START_RECORDING (chrome-extension://jjndjgheafjngoipoacpjgeicjeomjli/options.js:28:29) at pptr://__puppeteer_evaluation_script__:1:16 at ExecutionContext._ExecutionContext_evaluate (node_modules/puppeteer-core/src/common/ExecutionContext.ts:319:13) at processTicksAndRejections (node:internal/process/task_queues:95:5) at async ExecutionContext.evaluate (node_modules/puppeteer-core/src/common/ExecutionContext.ts:181:12)

line 29: chrome.sockets.udp.create({ bufferSize: 1024 1024 8 }, resolve);

chrome.sockets.udp seems deprecated link: https://developer.chrome.com/docs/extensions/reference/sockets_udp/

my chrome version : chrome Version 112.0.5615.137 (Official Build) (x86_64)

SamuelScheit commented 1 year ago

This package needs a rewrite for the transmission protocol as it currently uses the deprecated chrome extension UDP api. PR's are welcome 🙌

namnm commented 1 year ago

We can expose a function to allow the extension to emit the chunk as array buffer string Then in the puppeteer nodejs code, we will convert the string back to buffer and append to the stream This could be less performant than using net socket, but at least it works I hope

SamuelScheit commented 1 year ago

Alternatively we can use a local http server with request steaming, which can directly send Uint8Arrays

https://developer.chrome.com/articles/fetch-streaming-requests/

namnm commented 1 year ago

@SamuelScheit Look like you pushed a fix in 3.0.7 using websocket? Hope this can be closed now