Comments (5)
Can you show how you are calling the destroy function?
from puppeteer-stream.
Sorry for delay.
Here is a part of code that creates instance, page, stream and then destroys the stream.
Let me know if you need more details.
// Create page
const browser = await launch({
// @ts-ignore
product: 'chrome',
headless: false,
ignoreDefaultArgs: ['--mute-audio'],
args: [
'--autoplay-policy=no-user-gesture-required'
]
})
const page = await browser.newPage()
(...)
// Create stream
const tabStream = await getStream(page,
{
audio: true,
video: false
}
)
(...)
// Destroy stream
await tabStream.destroy()
from puppeteer-stream.
I'm also having the same difficulty.
The node version is below.
node --version
v16.8.0
This is the code I wrote.
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-call */
import * as puppeteerStream from 'puppeteer-stream';
import fs = require('fs');
const file = fs.createWriteStream(__dirname + '/test.webm');
async function test() {
const options = {
headless: false,
args: ['--autoplay-policy=no-user-gesture-required'],
ignoreDefaultArgs: ['--mute-audio'],
};
const browser = await puppeteerStream.launch(options);
const page = await browser.newPage();
const url = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
await page.goto(url);
// create a video stream
const streamOptions: puppeteerStream.getStreamOptions = {
audio: true,
video: true,
};
const stream = await puppeteerStream.getStream(page as any, streamOptions);
console.log('recording');
stream.pipe(file);
await timeout(5000);
file.close();
console.log('finished');
}
function timeout(ms: number) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
void (async () => {
await test();
});
When I execute tsc --build
, I got the following error.
$ tsc --build
node_modules/puppeteer-stream/dist/PuppeteerStream.d.ts:8:5 - error TS2416: Property 'destroy' in type 'Stream' is not assignable to the same property in base type 'Readable'.
Type '(page?: Page) => Promise<void>' is not assignable to type '(error?: Error) => void'.
Types of parameters 'page' and 'error' are incompatible.
Type 'Error' is missing the following properties from type 'Page': _closed, _client, _target, _keyboard, and 118 more.
8 destroy(page?: Page): Promise<void>;
~~~~~~~
Found 1 error.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
from puppeteer-stream.
node --version v16.13.0
Need to change destroy to destroyStream (for example) in files dist/puppeteerStream.d.ts line 8 and src/puppeteerStream.ts line 13
@Flam3rboy author?
from puppeteer-stream.
fixed with fef0a6f
from puppeteer-stream.
Related Issues (20)
- Advice for taking the last 10s of audio without FFMPEG or re-encoding HOT 1
- Option to specify the websocket port
- Using FFMPEG give an error HOT 1
- Close browser causes Protocol error HOT 6
- Wrong resolution in FFMPEG from the Pipe HOT 1
- Process hangs after recording finished
- Are transparent videos possible?
- videoConstraints Not works HOT 3
- [feature request] streaming part of the webpage
- Use it with an existing HTTP server.
- Cannot find tab HOT 4
- Cannot read properties of undefined (reading 'query') HOT 3
- No impact of video configurations on headless browser Kubernetes cluster (linux). HOT 1
- Protocol Error Occurs When Retrieving Media Stream Using getStream() HOT 1
- listen on port 0 instead of incrementing port
- Unable to access Dialog in pupetter stream HOT 3
- Bad audio recorded HOT 3
- Unable to increase video quality HOT 2
- What is `wss.close()` for?
- audioConstraints on mimeType: 'audio/webm;codecs=pcm',
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from puppeteer-stream.