forked from playwright-community/playwright-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvideo.go
37 lines (31 loc) · 795 Bytes
/
video.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package playwright
import "errors"
type videoImpl struct {
page *pageImpl
artifact *artifactImpl
isRemote bool
}
func (v *videoImpl) Path() (string, error) {
if v.isRemote {
return "", errors.New("Path is not available when connecting remotely. Use SaveAs() to save a local copy.")
}
if v.artifact == nil {
return "", errors.New("Page did not produce any video frames")
}
return v.artifact.AbsolutePath(), nil
}
func (v *videoImpl) Delete() error {
return v.artifact.Delete()
}
func (v *videoImpl) SaveAs(path string) error {
if v.artifact == nil {
return errors.New("Page did not produce any video frames")
}
return v.artifact.SaveAs(path)
}
func newVideo(page *pageImpl) *videoImpl {
return &videoImpl{
page: page,
isRemote: page.connection.isRemote,
}
}