-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexample11.html
266 lines (250 loc) · 8.18 KB
/
example11.html
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML Media Tutorial</title>
<style>
body {
font-family: Arial, sans-serif;
line-height: 1.6;
margin: 20px;
background-color: #f9f9f9;
color: #333;
}
h1, h2 {
color: #444;
}
pre {
background-color: #e9e9e9;
padding: 10px;
border-radius: 5px;
overflow-x: auto;
}
.section {
margin-bottom: 40px;
padding: 20px;
background-color: #fff;
border: 1px solid #ccc;
border-radius: 10px;
}
.example {
background-color: #e9f7ef;
padding: 10px;
border: 1px solid #27ae60;
border-radius: 5px;
margin: 10px 0;
}
.code-example {
background-color: #f8f9fa;
padding: 15px;
border: 1px solid #ddd;
border-radius: 5px;
margin: 10px 0;
}
table {
border-collapse: collapse;
width: 100%;
margin: 10px 0;
}
th, td {
padding: 8px;
text-align: left;
}
.demo-table {
border: 2px solid #333;
}
.demo-table th, .demo-table td {
border: 1px solid #666;
}
.styled-table {
background-color: #fff;
}
.styled-table th {
background-color: #4CAF50;
color: white;
}
.styled-table tr:nth-child(even) {
background-color: #f2f2f2;
}
.media-container {
margin: 20px 0;
padding: 15px;
background-color: #f5f5f5;
border-radius: 8px;
}
.responsive-iframe {
width: 100%;
max-width: 560px;
height: 315px;
border: none;
border-radius: 8px;
}
</style>
</head>
<body>
<h1>HTML Media Tutorial</h1>
<div class="section">
<h2>HTML Video</h2>
<p>HTML5 introduced the <code><video></code> element for embedding videos directly into web pages without plugins.</p>
<div class="code-example">
<h3>Basic Video Example:</h3>
<pre>
<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>
</pre>
</div>
<div class="media-container">
<h3>Live Example:</h3>
<video width="320" height="240" controls>
<source src="/api/placeholder/320/240" type="video/mp4">
Your browser does not support the video tag.
</video>
</div>
<div class="example">
<h3>Video Attributes:</h3>
<table class="styled-table">
<tr>
<th>Attribute</th>
<th>Description</th>
</tr>
<tr>
<td>controls</td>
<td>Adds video controls (play/pause/volume)</td>
</tr>
<tr>
<td>autoplay</td>
<td>Video will start playing automatically</td>
</tr>
<tr>
<td>loop</td>
<td>Video will start over when finished</td>
</tr>
</table>
</div>
</div>
<div class="section">
<h2>HTML Audio</h2>
<p>The <code><audio></code> element allows you to embed sound content in your web pages.</p>
<div class="code-example">
<h3>Basic Audio Example:</h3>
<pre>
<audio controls>
<source src="music.mp3" type="audio/mpeg">
<source src="music.ogg" type="audio/ogg">
Your browser does not support the audio element.
</audio>
</pre>
</div>
<div class="media-container">
<h3>Live Audio Example:</h3>
<audio controls>
<source src="https://www2.cs.uic.edu/~i101/SoundFiles/StarWars60.wav" type="audio/wav">
Your browser does not support the audio element.
</audio>
<p><small>Note: This is a sample audio file (Star Wars theme)</small></p>
</div>
</div>
<div class="section">
<h2>HTML Plug-ins</h2>
<p>While modern HTML5 features have largely replaced plugins, some legacy content might still require them.</p>
<div class="code-example">
<h3>Object Element Example:</h3>
<pre>
<object data="file.pdf" type="application/pdf" width="100%" height="500px">
<p>Unable to display PDF file. <a href="file.pdf">Download</a> instead.</p>
</object>
</pre>
</div>
<div class="media-container">
<h3>Live Plugin Example (PDF Embed):</h3>
<object data="https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
type="application/pdf"
width="100%"
height="500px">
<p>Unable to display PDF file.
<a href="https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf">
Download
</a> instead.
</p>
</object>
</div>
</div>
<div class="section">
<h2>HTML YouTube</h2>
<p>YouTube videos can be easily embedded using an iframe.</p>
<div class="code-example">
<h3>YouTube Embed Example:</h3>
<pre>
<iframe
width="560"
height="315"
src="https://www.youtube.com/embed/z6zFKgJ5TuI?si=bKNpyY1Cs5upQrlt"
title="YouTube video player"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
referrerpolicy="strict-origin-when-cross-origin"
allowfullscreen>
</iframe>
</pre>
</div>
<div class="media-container">
<h3>Live YouTube Example:</h3>
<iframe
class="responsive-iframe"
src="https://www.youtube.com/embed/z6zFKgJ5TuI?si=bKNpyY1Cs5upQrlt"
title="YouTube video player"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
referrerpolicy="strict-origin-when-cross-origin"
allowfullscreen>
</iframe>
</div>
<div class="example">
<h3>Key YouTube Embed Attributes:</h3>
<table class="styled-table">
<tr>
<th>Attribute</th>
<th>Description</th>
</tr>
<tr>
<td>src</td>
<td>The URL of the YouTube video (embed format)</td>
</tr>
<tr>
<td>title</td>
<td>Descriptive title for accessibility</td>
</tr>
<tr>
<td>frameborder</td>
<td>Specifies whether to display a border around the iframe</td>
</tr>
<tr>
<td>allow</td>
<td>Specifies which features are allowed in the iframe</td>
</tr>
<tr>
<td>referrerpolicy</td>
<td>Specifies which referrer information to send</td>
</tr>
<tr>
<td>allowfullscreen</td>
<td>Enables fullscreen mode option</td>
</tr>
</table>
</div>
<div class="example">
<h3>Best Practices:</h3>
<ul>
<li>Always include width and height attributes</li>
<li>Use responsive design for better mobile experience</li>
<li>Consider loading time and page performance</li>
<li>Provide fallback content for accessibility</li>
</ul>
</div>
</div>
</body>
</html>