-
Notifications
You must be signed in to change notification settings - Fork 1
/
html_video.go
120 lines (104 loc) · 2.44 KB
/
html_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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
package html5
// HTMLVideo represents HTML <video> tag
type HTMLVideo struct {
HTMLMedia
}
// Video creates an HTML <video> tag element
func Video() *HTMLVideo {
e := &HTMLVideo{}
e.a = make(map[string]interface{})
e.tagName = "video"
return e
}
// S sets the element's CSS properties
func (e *HTMLVideo) S(style StyleMap) *HTMLVideo {
e.HTMLElement.S(style)
return e
}
// Key sets virtual dom's special property to instruct the diffing mechanism
// to reorder the node instead of replacing it
func (e *HTMLVideo) Key(key interface{}) *HTMLVideo {
e.key = F(key)
return e
}
// Ref marks the dest pointer to receive the real DOM element on render.
// Useful for getting live value of an input element, for example.
func (e *HTMLVideo) Ref(dest *DOMElement) *HTMLVideo {
e.ref = dest
return e
}
// Width sets the element's "width" attribute
func (e *HTMLVideo) Width(v int) *HTMLVideo {
e.a["width"] = v
return e
}
// Height sets the element's "height" attribute
func (e *HTMLVideo) Height(v int) *HTMLVideo {
e.a["height"] = v
return e
}
// Poster sets the element's "poster" attribute
func (e *HTMLVideo) Poster(v string) *HTMLVideo {
e.a["poster"] = v
return e
}
// Src sets the element's "src" attribute
func (e *HTMLVideo) Src(v string) *HTMLVideo {
e.a["src"] = v
return e
}
// CrossOrigin sets the element's "crossorigin" attribute
func (e *HTMLVideo) CrossOrigin(v string) *HTMLVideo {
e.a["crossorigin"] = v
return e
}
// Preload sets the element's "preload" attribute
func (e *HTMLVideo) Preload(v string) *HTMLVideo {
e.a["preload"] = v
return e
}
// Autoplay sets the element's "autoplay" attribute
func (e *HTMLVideo) Autoplay(v bool) *HTMLVideo {
if v {
e.a["autoplay"] = ""
} else {
delete(e.a, "autoplay")
}
return e
}
// Loop sets the element's "loop" attribute
func (e *HTMLVideo) Loop(v bool) *HTMLVideo {
if v {
e.a["loop"] = ""
} else {
delete(e.a, "loop")
}
return e
}
// Controls sets the element's "controls" attribute
func (e *HTMLVideo) Controls(v bool) *HTMLVideo {
if v {
e.a["controls"] = ""
} else {
delete(e.a, "controls")
}
return e
}
// Muted sets the element's "muted" attribute
func (e *HTMLVideo) Muted(v bool) *HTMLVideo {
if v {
e.a["muted"] = ""
} else {
delete(e.a, "muted")
}
return e
}
// DefaultMuted sets the element's "defaultmuted" attribute
func (e *HTMLVideo) DefaultMuted(v bool) *HTMLVideo {
if v {
e.a["defaultmuted"] = ""
} else {
delete(e.a, "defaultmuted")
}
return e
}