pub struct Video { /* private fields */ }Expand description
Video recording controller for a page.
Videos are recorded using CDP’s screencast feature which captures compressed frames from the browser. These frames are then assembled into a video file.
§Example
use viewpoint_core::page::VideoOptions;
// Recording is usually started via context options
let context = browser.new_context_builder()
.record_video(VideoOptions::new("./videos"))
.build()
.await.unwrap();
let page = context.new_page().await.unwrap();
page.goto("https://example.com").goto().await.unwrap();
// Get the video path after recording
if let Some(video) = page.video() {
// Video operations available here
// let path = video.path().await?;
}Implementations§
Source§impl Video
impl Video
Sourcepub async fn path(&self) -> Result<PathBuf, PageError>
pub async fn path(&self) -> Result<PathBuf, PageError>
Get the path to the recorded video.
Returns None if recording hasn’t started or hasn’t stopped yet.
§Example
use viewpoint_core::page::Page;
if let Some(video) = page.video() {
let path = video.path().await?;
println!("Video at: {}", path.display());
}Sourcepub async fn is_recording(&self) -> bool
pub async fn is_recording(&self) -> bool
Check if video is currently being recorded.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Video
impl !RefUnwindSafe for Video
impl Send for Video
impl Sync for Video
impl Unpin for Video
impl !UnwindSafe for Video
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more