puppeteer/assets/js/7bcd2e54.d4eb8bfd.js

2 lines
4.9 KiB
JavaScript
Raw Normal View History

/*! For license information please see 7bcd2e54.d4eb8bfd.js.LICENSE.txt */
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[86539],{95915:(e,r,n)=>{n.r(r),n.d(r,{assets:()=>o,contentTitle:()=>c,default:()=>d,frontMatter:()=>a,metadata:()=>p,toc:()=>i});var t=n(85893),s=n(11151);const a={sidebar_label:"Page.screencast"},c="Page.screencast() method",p={id:"api/puppeteer.page.screencast",title:"Page.screencast() method",description:"Captures a screencast of this page.",source:"@site/versioned_docs/version-22.8.0/api/puppeteer.page.screencast.md",sourceDirName:"api",slug:"/api/puppeteer.page.screencast",permalink:"/api/puppeteer.page.screencast",draft:!1,unlisted:!1,tags:[],version:"22.8.0",frontMatter:{sidebar_label:"Page.screencast"},sidebar:"api",previous:{title:"Page.removeScriptToEvaluateOnNewDocument",permalink:"/api/puppeteer.page.removescripttoevaluateonnewdocument"},next:{title:"Page.screenshot",permalink:"/api/puppeteer.page.screenshot"}},o={},i=[{value:"Signature:",id:"signature",level:4},{value:"Parameters",id:"parameters",level:2},{value:"Remarks",id:"remarks",level:2},{value:"Example",id:"example",level:2}];function l(e){const r={a:"a",code:"code",em:"em",h1:"h1",h2:"h2",h4:"h4",p:"p",pre:"pre",strong:"strong",...(0,s.a)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.h1,{id:"pagescreencast-method",children:"Page.screencast() method"}),"\n",(0,t.jsxs)(r.p,{children:["Captures a screencast of this ",(0,t.jsx)(r.a,{href:"/api/puppeteer.page",children:"page"}),"."]}),"\n",(0,t.jsx)(r.h4,{id:"signature",children:"Signature:"}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-typescript",children:"class Page {\n screencast(options?: Readonly<ScreencastOptions>): Promise<ScreenRecorder>;\n}\n"})}),"\n",(0,t.jsx)(r.h2,{id:"parameters",children:"Parameters"}),"\n",(0,t.jsxs)("table",{children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{children:[(0,t.jsx)("th",{children:(0,t.jsx)(r.p,{children:"Parameter"})}),(0,t.jsx)("th",{children:(0,t.jsx)(r.p,{children:"Type"})}),(0,t.jsx)("th",{children:(0,t.jsx)(r.p,{children:"Description"})})]})}),(0,t.jsx)("tbody",{children:(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)(r.p,{children:"options"})}),(0,t.jsx)("td",{children:(0,t.jsxs)(r.p,{children:["Readonly<",(0,t.jsx)(r.a,{href:"/api/puppeteer.screencastoptions",children:"ScreencastOptions"}),">"]})}),(0,t.jsx)("td",{children:(0,t.jsxs)(r.p,{children:[(0,t.jsx)(r.em,{children:"(Optional)"})," Configures screencast behavior."]})})]})})]}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Returns:"})}),"\n",(0,t.jsxs)(r.p,{children:["Promise<",(0,t.jsx)(r.a,{href:"/api/puppeteer.screenrecorder",children:"ScreenRecorder"}),">"]}),"\n",(0,t.jsx)(r.h2,{id:"remarks",children:"Remarks"}),"\n",(0,t.jsxs)(r.p,{children:["All recordings will be ",(0,t.jsx)(r.a,{href:"https://www.webmproject.org/",children:"WebM"})," format using the ",(0,t.jsx)(r.a,{href:"https://www.webmproject.org/vp9/",children:"VP9"})," video codec. The FPS is 30."]}),"\n",(0,t.jsxs)(r.p,{children:["You must have ",(0,t.jsx)(r.a,{href:"https://ffmpeg.org/",children:"ffmpeg"})," installed on your system."]}),"\n",(0,t.jsx)(r.h2,{id:"example",children:"Example"}),"\n",(0,t.jsxs)(r.p,{children:["Recording a ",(0,t.jsx)(r.a,{href:"/api/puppeteer.page",children:"page"}),":"]}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{children:"import puppeteer from 'puppeteer';\n\n// Launch a browser\nconst browser = await puppeteer.launch();\n\n// Create a new page\nconst page = await browser.newPage();\n\n// Go to your site.\nawait page.goto(\"https://www.example.com\");\n\n// Start recording.\nconst recorder = await page.screencast({path: 'recording.webm'});\n\n// Do something.\n\n// Stop recording.\nawait recorder.stop();\n\nbrowser.close();\n"})})]})}function d(e={}){const{wrapper:r}={...(0,s.a)(),...e.components};return r?(0,t.jsx)(r,{...e,children:(0,t.jsx)(l,{...e})}):l(e)}},75251:(e,r,n)=>{var t=n(67294),s=Symbol.for("react.element"),a=Symbol.for("react.fragment"),c=Object.prototype.hasOwnProperty,p=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FI