Brenton Strine

Brenton Strine

Embedded Content

Slide Duration:

Table of Contents

Section 1: HTML
Your First Web Page

17m 1s

Intro
0:00
World Wide Web
0:23
Introduction to HTML
0:25
Looking at Source Code
0:53
HTML5
1:58
HTML5 Specification
1:59
Creating a Web Page
4:10
What You Will Need to Create a Web Page
4:11
Example: Basic Web Page
4:40
Example: Creating a Web Page
5:46
HTML Elements
6:33
Adding a Title
7:08
Main Body
7:48
First Level Heading
8:23
Adding an Image
8:42
Paragraph
9:09
Adding a List and URLs
11:13
Footer
14:09
CSS: Styling
16:02
Web Basics and Web History

32m 23s

Intro
0:00
The Web
0:56
Overview of the Web
0:58
The Web Page
2:39
Overview of the Web Page
2:40
Web Technologies
4:45
Overview of Web Technologies
4:46
The Web Today
9:22
The Web Today
9:23
What is HTML
11:22
HyperText Markup Language
11:23
The Creation of the Internet
12:40
History of the Internet
12:41
Developments in HTML
14:10
The Birth of HTML
14:11
Early Problems
15:35
Early Browsers
16:24
History of Early Browsers
16:25
NCSA Mosaic
17:55
NCSA Mosaic
17:56
The Browser Wars Begin
19:39
History of the Browser Wars
19:40
Casualties of War
22:27
Results of the Browser Wars
22:28
HTML 4 Stabilization
25:31
History and Overview of HTML4
25:32
Modern Browser Developments
27:27
Modern Browsers
27:29
HTML5
30:57
Overview of HTML5
30:58
Web Development Tools

26m 28s

Intro
0:00
Browsers
0:17
Introduction to Browsers
0:18
Example: Browsers
2:35
Firefox Add-ons
3:14
Firefox Browser
3:15
Example: Firebug Add-ons
3:54
Example: Web Developer Toolbar and ColorZilla
7:51
Domain Names and Hosting
10:23
Overview of Domain Names and Hosting
10:24
Your Own Domain
11:03
Installing a Local Web Server
12:42
Installing a Local Web Server
12:43
Apache Web
13:29
WYSIWYG Editors
15:56
Introduction to WYSIWYG Editors
15:57
Content Management System
18:31
How Content Management System Works
18:32
Example: WordPress
20:00
File Transfer Protocol
22:26
File Transfer Protocol
22:27
HTML Elements and Attributes

21m 50s

Intro
0:00
Proper use of Elements and Attributes
0:14
Elements and Attributes
0:16
Example
1:06
Normal HTML Elements
2:00
Start Tag, Content, and End Tag
2:02
Example: Warning!
2:34
Void HTML Elements
3:23
Self-Closing Tags
3:24
List of Void Elements
4:04
Example: Line Break
5:00
HTML Comments
6:13
Purpose of Comment Tags
6:14
Example: Comment Tags
6:50
Attributes
7:25
Properties of Attributes
7:27
Example: Attributes
7:39
Example: Whitespace
10:22
HTML Character Codes
12:05
Character References
12:07
Example: Registered Trademark Symbol
12:35
Example: Using Character References
13:23
Example: Start Tag and End Tag
15:57
Example: Self-Closing Tag
16:37
Example: Attributes
17:37
Example: Proper use of Elements and Attributes
19:02
Example: Comment
20:09
Example: Whitespace
20:46
Essential Tags Part 1

41m 42s

Intro
0:00
Document Structure Tags
1:13
Document Structure Tags and Example
1:14
Layout Tags
3:24
Layout Tags
3:26
Example: Layout Tags
7:48
Example: Layout Tags
11:28
Example: Layout Tags
13:17
Example: Layout Tags
14:22
Text Level Tags
17:22
Text Level Tags
17:23
Example: Text Level Tags
17:48
Grouping Content Tags
24:23
Grouping Content Tags
24:24
<p> Tag
24:45
<hr> Tag
25:31
<figure>, <figcaption>, and <blockquote> Tag
26:14
<div> Tag
26:58
Example: Grouping Content Tags
27:28
Embedded Content Tags
33:12
Embedded Content Tags
33:13
Example: Embedded Content Tags
35:39
Essential Tags Part 2

24m 20s

Intro
0:00
Simple Tables
0:17
Simple Tables
0:19
Example: Simple Tables
2:31
Semantic Tables
5:11
Semantic Tables
5:14
Example: Semantic Tables
6:24
Simple Lists
8:14
Simple Lists
8:18
Unordered List
8:36
Ordered List
8:42
Example: Simple Lists
9:37
Definition Lists
14:08
Definition Lists
14:09
Example: Definition Lists
15:21
Forms
17:11
Forms
17:12
Example: Forms
17:52
Markup Language

29m 38s

Intro
0:00
HTML 1 Through 3.2
0:13
Period of Rapid Growth of HTML
0:14
Tag Soup
2:03
Definition of Tag Soup
2:04
Example: Tag Soup
3:00
Example: Tag Soup and Valid Doctype
4:45
HTML 4.01
5:26
Overview of HTML 4.01
5:27
Three Flavors of HTML 4.01: Strict, Transitional, and Frameset
6:05
XHTML 1
7:19
Overview of XHTML 1
7:20
Example: XHTML 1
9:20
XHTML1 Syntax
11:48
Lower Case Rule
11:49
Closed Elements Rule
12:25
Encased in Quotes Rule
14:18
Boolean Attributes May Not Be Minimized
14:35
Correct Nesting is Enforced
15:29
The Problem with XHTML
16:15
Problem with XHTML
16:16
XHTML 2
19:22
Overview of XHTML 2
19:23
HTML 5
20:43
Overview of HTML 5
20:44
Validating
22:44
Validators
22:45
Example: W3C Markup Validation Service
25:26
Page Structure and Meta-data Elements

32m 50s

Intro
0:00
The Doctype
0:12
Doctype
0:13
Example: Doctype
1:25
The Root Element
1:57
Root Element
1:58
Example: Root Element
2:45
The Head Element
3:38
Head Element and Body Element
3:39
Example: Head Element and Body Element
5:06
The Head Element
5:42
Head Element vs. Header Element
5:47
The Title Element
6:51
Title Element
6:52
Example: Title Element
7:54
The Base Element
9:00
Base Element
9:03
Example: Base Element
9:42
The Link Element
14:07
Link Element: rel, type, and href
14:08
Example: Link Element
15:13
The Meta Element
17:54
Meta Element: charset, name, and http-equiv
17:55
Example: Meta Element
21:00
The Style Element
23:35
Style Element
23:37
Example: Style Element
24:40
Text-Level Semantics

30m 13s

Intro
0:00
Text Level Semantics
0:06
Paragraph Level
0:07
The <a> Element
2:23
Definition of the <a> Element
2:25
The <em> Element
3:25
Definition of the <em> Element
3:26
The <strong> Element
6:50
The <strong> Element
6:51
The <small> Element
8:35
The <small> Element
8:36
Example of <small> Element
10:19
The <cite> Element
10:55
The <cite> Element
10:56
Example of <cite> Element
12:32
The <q> Element
12:45
The <q> Element
12:46
Example of <q> Element
13:34
The <abbr> Element
15:35
The <abbr> Element
15:36
Example of <abbr> Element
16:41
The <dfn> Element
17:03
The <dfn> Element
17:04
Example of <dfn> Element
18:01
The <time> Element
19:11
The <time> Element and Example
19:12
The <code> Element
21:18
The <code> Element
21:19
Example of <code> Element
23:00
The <sub> and <sup> Elements
23:31
The <sub> and <sup> Elements
23:32
Example of <sub> and <sup> Elements
23:50
The <i> Element
24:51
The <i> Element and Example
24:52
The <b> Element
27:16
The <b> Element
27:17
Example of <b> Element
29:07
Heading and Sectioning

23m 39s

Intro
0:00
Heading Elements
0:06
Heading Tags
0:07
Heading Rules
1:13
Heading Rules and Example
1:35
Sectioning Roots
5:39
Sectioning Roots
5:41
Sectioning Contents
6:25
Sectioning Content Elements
6:27
Section Wrapping
7:40
Section Wrapping
7:41
Example: Section Wrapping
10:10
Real World Example 1
15:36
Forms

47m 51s

Intro
0:00
Form Terminology
0:23
Form
0:24
Control
0:43
Control Name and Control Label
1:09
Input Type and State
1:52
Form Controls
2:20
Button: Submit and Reset
2:32
Radio
3:37
Checkbox
4:00
Select Menu
4:05
Textarea
4:28
Various Input Types
4:38
Example: Basic Controls of Form Element
7:05
Example: Buttons
18:20
Example: Additional Controls
20:56
Example: Special Input Types
27:55
Example: Date and Time Control
33:40
Example: Create Your Own Control
37:32
Example: Placeholder Text
39:10
Example: Datalist
41:43
Example: Sizing and Input Containment
42:16
Example: Select Modification
42:51
Example: Required Attribute
44:41
Links

36m 41s

Intro
0:00
URIs and URLs
0:23
Definitions of URL and URI
0:36
Differences Between URL and URI
0:42
Example: URI and URL
1:14
Typical URI Construction
2:33
Domain and Subdomain
2:34
Protocol
4:18
IP Address
5:05
Typical URI Construction
5:32
Second Level Domain
5:33
Port
6:07
Foldernames
6:46
Typical URI Construction
8:06
Filename and File Extension
8:08
Typical URI Construction
10:38
Name/ Value Pairs
10:40
Internal Anchors
11:45
Typical URI Construction
12:30
Example: URI Construction
12:31
Relative and Absolute URIs
14:20
Relative and Absolute URIs
14:22
Example: Relative and Absolute URIs
18:32
Link States
24:15
Link States
24:16
Example: Link States
25:18
Block Level Links
27:02
Example: Block Level Links
27:03
Bookmark Links
29:18
Bookmark Links
29:20
Example: Bookmark Links
30:15
Attributes
32:06
href and target
32:20
rel, media, hreflang, and type
33:18
Embedded Content

46m 5s

Intro
0:00
Embedding Image
0:22
Embedding an Image
0:25
Image File Formats
3:38
Image Format: Jpg
3:42
Image Format: Png
4:13
Image Format: Gif
4:40
Compression
6:05
Image Format: Precise Lines and Fewer Colors
8:38
Animated Gif
10:49
Alpha Transparency Png
11:09
Embedding Audio
12:52
Old Way of Embedding Audio
13:00
New Way of Embedding Audio
14:54
Example: Adding Buttons
20:04
Message for Users
26:36
Audio Attributes
27:46
Control
28:29
Autoplay
28:44
Loop
29:36
Preload
30:40
Embedding Video
32:00
Embedding Video
32:11
Controls
34:22
Poster Attributes
36:01
Video Formats
37:36
Solving Formatting Problem
39:26
The Canvas Element

19m 25s

Intro
0:00
Creating the Element
0:38
What is the Canvas Element?
0:39
HTML and Canvas Element
1:48
Example: Canvas Element
3:23
Creating the Canvas in JavaScript
5:13
getContext() Method
5:17
Checking Browser Support with the getContext() Method
6:00
Example: Creating the Canvas in JavaScript
7:31
Drawing in the Canvas
10:13
Methods for Drawing in the Canvas
10:14
2d Context
10:58
Example: Creating Drawing in the Canvas
11:39
Example: Adding an Image and Texts
15:30
Example: Advance Canvas Element
17:31
Content Models

29m 8s

Intro
0:00
The HTML 4.01 Content Model
0:16
Block Elements and Inline Elements
0:18
Example: Block Elements and Inline Elements
1:18
W3C Markup Validation Service
3:28
The HTML5 Content Model
6:21
Overview of HTML5 New Content Categories
6:22
Flow Content
8:02
Specification for Content Models
8:05
Flow Content
9:41
Example: Flow Content Elements
10:40
List of Flow Content
11:35
BlockQuote Element
11:50
Sectioning Content
13:19
Introduction to Sectioning Content
13:20
Heading Content
14:06
Heading Content and hgroup Element
14:07
Phrasing Content
16:56
Attributes of Phrasing Content
16:57
Anchor Element in Phrasing Content
17:28
Embedded Content
19:33
Attributes of Embedded Content
19:34
No Content
19:53
Transparent Content
20:38
Source Elements and Param Elements
21:15
Interactive Content
24:16
Interactive Content Elements
24:17
Button Element
25:57
The DOM

13m 10s

Intro
0:00
The DOM
0:26
Document Object Model
0:27
The DOM Tree
0:55
DOM Trees
0:56
Example: DOM Tree
1:31
Vocabulary: Tree, Node,Branch, Parent, Child
2:15
Exploring the DOM
3:13
Example: Built-in Browser Inspection and Firebug
3:15
Example: Manually Exploring the DOM
6:01
JavaScript
7:28
DOM Navigation Techniques
7:55
DOM Navigation Techniques
7:56
Favicons

13m 14s

Intro
0:00
Favorite Icons
0:08
Function of Favorite Icons
0:09
Bowser Support
1:10
Browser Support
1:13
Location in Browsers
1:46
Implementation Methods
2:04
Implementation Methods for Favorite Icons
2:05
Favicon and Apple Mobile Devices
4:51
Creating the Icon
6:13
How to Create the Icon
6:14
Favicon Resources
9:10
Websites for Icon Creation and Conversion
9:11
Programs for Icon Creation and Conversion
11:50
Embedding Flash and Other Objects

15m 7s

Intro
0:00
Flash and other Plug-ins
0:41
Main Problems with Flash
0:44
Benefits of Flash
2:02
Embedding Flash: the Old Way
2:57
The Old Way to Embed Flash
2:58
Embedding Flash: the Satay Method
6:42
Satay Method
6:43
Embedding Flash: HTML5
9:28
How to Embed Flash in HTML5
9:29
Embedding Flash Directly in <video>
11:39
Embedding Flash Directly in Video Element
11:40
Review of Embedding
13:24
Image Elements
13:39
Video, Audio, and Canvas Elements
13:44
Embed Elements
13:53
Object Elements
14:04
Offline Cache

19m 53s

Intro
0:00
Purpose
0:47
Purpose of Offline Cache
0:48
The Appache
2:06
Attributes of Appcache
2:07
The Manifest File
3:22
Manifest File
3:23
Example of Manifest
3:32
Section Headers: Cache, Fallback, and Network
4:21
Server-Side Considerations
5:17
text/cache-manifest MIME-type
5:18
Other Server-Side Considerations
5:41
ExpiresActive On and ExpiresDefault 'access'
6:07
Example: Offline Cache 1
7:44
Example: Overwriting Files
11:09
Example: Wild Cards for Network
14:58
Example: Offline Cache 2
16:06
Web Development Principles

26m 47s

Intro
0:00
Interoperability
0:36
Interoperability of Web Development
0:37
Interoperable Websites Should Work
3:05
Qualities of Interoperable Websites
3:06
Backward Compatibility
5:52
Compatibility With Older Technology
5:53
Example: Meta Tag
9:07
Forward Compatibility
9:33
Advancement in Technology
9:34
Accessibility
10:11
Accessibility of Content
10:12
Semantic Code
11:43
Example: Where Will This Link Take You?
13:56
Graceful Degradation
14:59
Graceful Degradation or Fault Tolerance
15:00
Types of Degradation
16:35
Progressive Enhancement
18:36
Progressive Enhancement
18:37
Future Detection and Browser Sniffing
21:05
Future Detection Versus Browser Sniffing
21:06
Example: Email Input Type
23:39
Tim Berners-Lee's Quote
26:20
Loading...
This is a quick preview of the lesson. For full access, please Log In or Sign up.
For more information, please see full course syllabus of HTML
Bookmark & Share Embed

Share this knowledge with your friends!

Copy & Paste this embed code into your website’s HTML

Please ensure that your website editor is in text mode when you paste the code.
(In Wordpress, the mode button is on the top right corner.)
  ×
  • - Allow users to view the embedded video in full-size.
Since this lesson is not free, only the preview will appear on your website.
  • Discussion

  • Download Lecture Slides

  • Table of Contents

  • Transcription

  • Related Services

Lecture Comments (8)

0 answers

Post by Vimala Koppada on December 8, 2015

i have tried this video tag in different browsers but it is not playing in the any of the browsers. Can you please say what might be the problem. One more problem is for use of buttons. what could be the problem. How to fix it. I have used firefox, chrome and IE browsers.

1 answer

Last reply by: Professor Strine
Wed Jan 15, 2014 5:54 PM

Post by Gerard Kenny on April 20, 2013

Can someone tell me why my image shows in IE but will not be displayed in Firefox?

1 answer

Last reply by: Gerard Kenny
Sat Apr 13, 2013 3:56 PM

Post by Gerard Kenny on April 13, 2013

I have Windows 8. What is the best tool for resizing my JPG images?

1 answer

Last reply by: marc mitchell
Sun Apr 1, 2012 7:42 PM

Post by Jorge Guerrero on March 17, 2012

Brenton, it's great that you know JavaScript and apply it to creating buttons for audio control, but I think you should stick to just HTML for now. I mean, should we return to this lesson after we finis the JavaScript course? It's like teaching a foreging language and jumping around. Don't blame students for not learning.

0 answers

Post by Jorge Guerrero on March 17, 2012

Is there a place where we can download the code for the lessons? I try to write as much as I can, but I'd like to have some examples which are not walked through.

Embedded Content

Lecture Slides are screen-captured images of important points in the lecture. Students can download and print out these lecture slide images to do practice problems as well as take notes while watching the lecture.

  • Intro 0:00
  • Embedding Image 0:22
    • Embedding an Image
  • Image File Formats 3:38
    • Image Format: Jpg
    • Image Format: Png
    • Image Format: Gif
    • Compression
    • Image Format: Precise Lines and Fewer Colors
    • Animated Gif
    • Alpha Transparency Png
  • Embedding Audio 12:52
    • Old Way of Embedding Audio
    • New Way of Embedding Audio
    • Example: Adding Buttons
    • Message for Users
  • Audio Attributes 27:46
    • Control
    • Autoplay
    • Loop
    • Preload
  • Embedding Video 32:00
    • Embedding Video
    • Controls
    • Poster Attributes
    • Video Formats
    • Solving Formatting Problem

Transcription: Embedded Content

Welcome back to Educator.com.0000

Today, we are going to be looking at embedded content--specifically, images, audio, and video--0002

and how to embed those into a web page.0009

Let's get right into the code.0014

We have here a little outline I have prepared.0018

First, let's look at embedding an image: let me just show you, really quickly, what this web page looks like.0023

It is just a bunch of headers right now; and we are going to type in, right here, an image.0031

Images are pretty simple.0037

This is one of the oldest media tags; it goes way back to the days of Mosaic, one of the first browsers that added the ability to include an image.0039

And there was a little bit of a controversy about whether it should be a tag like this, img, with a source;0050

and then you specify, say, a folder and an image; or whether it should be something more like embed, and then a source;0058

and then maybe something like a type that lets you know what type of content you are embedding.0071

For historical reasons, and because there were already some browsers doing things in this way, this is what they went ahead with,0079

even though they figured, "If we do it this way, eventually we are going to have to have an audio tag and a video tag,"0087

which is just what has happened; but it is not a bad thing, because until now, we haven't had tags in HTML.0093

We have had to embed things like Flash Players or plug-ins in order to play video or audio.0103

Now, we just have a tag very similar to the image tag.0110

This is how the image tag works: refresh it, and there is a little image--very, very simple.0113

The browser has access to this; for example, you can right-click on it and do things like copy it, get some information about it, save it...0121

There are a couple of other options: say you want to give it a width--you can do that easily and size it up.0136

Now, this is generally something you don't want to do, because it looks kind of pixolated.0149

It gets out of proportion; and you can size it down, as well; but then, you have an image that is bigger than it needs to be.0155

We will delete that; now, let's look at some image file formats.0166

You will notice that I used the jpg extension here; this happens to be a JPEG image.0174

There are a lot of other file formats that you can use.0180

I'm going to copy some code over that I prepared earlier and paste it in here.0184

What this is that I have just pasted in: it is a bunch of figures, using correct code.0198

But the important parts are these images here: they are all the same image, this picture of me visiting a Darth Vader art exhibit.0204

And they are each using a different file format; and this will illustrate some of the differences in the different file formats.0214

JPEG is probably one of the most popular file formats.0224

That last picture I showed you was a JPEG; this is JPEG.0230

JPEG is really good for images with a lot of color and a lot of variety.0233

You can see this picture: it is not really pixolated--there aren't a lot of compression artifacts.0238

And it is sizing well, even though this is zoomed in a little bit.0247

The same thing down here for png's; you will notice that the color is a little bit brighter--png's actually have more colors than a jpg does.0253

And it does the same sort of good job with not having artifacts and having lots of colors, and there are not a lot of hard edges here.0264

It is kind of fuzzy; but then, when there are hard edges, they show up well, as well.0276

Now, gif, on the other hand, is a format that is terrible for images.0280

You can see that it does not have a lot of colors.0286

You get this effect of the colors breaking into hard lines.0290

And the hard edges get broken up into weird little color artifacts.0297

And you can fix that a little bit with some options that gif has.0301

There is something called dithering: this is the same image as a gif with full dither.0305

And it breaks up some of those lines, so you don't have those lines in here and here, for example.0310

They are broken up, so it looks a little smoother.0316

But then, you can see these dots, as well.0318

And I have saved these images to emphasize the effect a little bit.0321

For example, this would be a dither with the full color; and you can see, it is a lot better than this one.0326

But it is still not as good as the JPEG or the PNG images.0332

This is the best image that you can create with a GIF.0337

Compare it to the JPEG below; you can see some of the differences.0343

Those are the most common file formats for images on the Internet.0350

It used to be that png's were not well-supported by browsers.0357

But nowadays, pretty much any browser that you are going to be using will support png's.0360

Now, also take into consideration the compression, because all of these are actually compressing the file.0366

This full-color GIF is 72 kilobytes, compared to 40 for the dithered one and 39 for the normal one.0372

Now, the PNG has a lot higher of a file size, because it is using the full colors.0381

But if you wanted to, you could use the same number of colors as JPEG or GIF, and the PNG would be better compression.0390

So, PNG is a better file format all around, for a lot of things.0398

And then, the GIF 47--GIF is very popular, because if you take a picture on, say, a digital camera,0404

it is usually going to always automatically save it in the JPEG format.0410

And it has good compression; you can set the compression values to be little compression0415

(which will make the file size much larger, but it will look better) to a lot of compression0422

(which can make it smaller, if you are really worried about bandwidth).0428

Now, this last image here is the JPEG in its original size that is not compressed; it is not resized down.0432

It is just the original JPEG compression, and I have browser-resized it to be a lot smaller.0442

So, if we look at the picture un-sized, it is this big.0449

This is something that you will see on some websites, where the original picture hasn't been sized down for the web page.0456

It is just right there, and then sized down using the browser.0465

And that slows down the browser when you are trying to load and scroll.0471

And it slows down the downloading speed, and you can actually see in here, if you have an eye for it--0475

there are a lot of artifacts from browser resizing, especially since this is actually sized up, so it is closer to the original size.0482

If I were to make this the original size that it is sized down to, you can see a lot more artifacts in here.0488

So, don't ever depend on just the browser to resize an image; it is almost never going to have the same quality,0493

and it is just going to be a negative effect on the usability.0500

I am going to go in here; I am actually going to delete that one, because it is slowing down everything.0506

Now, we can look at the way that these different image formats deal with more precise lines and fewer colors.0519

This would be the sort of images that you might see that aren't just photographs, but say an image that is part of the design of a website--0529

so, borders around things, or little logos or decorations that you want to be precise.0539

JPEG does not do a good job with these sorts of images.0546

You can see here these artifacts of the compression around the edges here.0548

It does a little better job on the straight line, although on the corners you can see a little bit of artifacts.0553

And even if you have it at really high quality, you are always going to have a little bit of this artifact.0559

And also, the coloring is not as good; you can compare it to a PNG.0568

This red circle here has lost a lot of its brightness; so has the blue square.0572

JPEG is not a good format for these sorts of images.0581

PNG does well at both; it is both good for photographs, and for this sort of line art with more precision needed.0583

Even though it is a compressed image, there is not as much loss in here.0592

In fact, I can't see any loss; every pixel looks like it is in the correct place, as far as I can tell.0595

And it is also much smaller; this is an 8-kilobyte image, and the PNG, which has superior image quality, is only four kilobytes.0600

And this is also something that GIF's are really good at; this is a 4-kilobyte GIF--the same size;0608

and it is pretty much indistinguishable from the PNG--they both display it really well.0613

Some other differences that you have are: GIF's have been able to do image transparency and animation;0620

and PNG's can do transparency as well, and there are some methods being employed to make PNG's use animation, as well;0628

but it is not well supported at this time, so right now, if you have an image that you want animated, it is going to be a GIF usually.0639

If you want a photograph, it is going to be either a PNG or a JPEG.0644

Here is an animated GIF...the browser is crashing a little bit, because it is a fairly large image, and it is resized.0649

This is a GIF that is just continually repeating.0662

And you could do the same thing with PNG, but it is not as well supported.0666

What PNG's are really great at is alpha transparency.0669

So, this image right here has this white area; it is not just a color placed on it--it is actually transparency.0673

You are seeing the white background behind this image, showing through.0680

And you will notice that there is a gradient: it fades slowly.0683

When a GIF does transparency, it is just a 1-color transparency, usually,0688

which means I could select maybe the red color, and make that transparent, so that all of this would be transparent.0692

Or I could select, maybe, just the white color.0698

But you couldn't do something like this, where it fades out.0700

In fact, I am going to pull open Opera browser, because the Opera browser has a built-in extension,0702

sort of like Firebug in Firefox, that will allow me to take this up.0715

I am highlighting it right here, and I am going to pull the margin up and make it negative.0726

And you can see that it is transparent all the way throughout the whole range; it is not just a single color.0733

That is alpha transparency; and it has some problems with Internet Explorer,0742

although you can add in some special code to make alpha transparency work in Internet Explorer.0748

I think Internet Explorer 9 will support alpha transparency in PNG's; all other browsers will support it, if you have a modern version.0755

That is the images; now, as of HTML5, we can do the same sort of thing with audio--it is very clean.0767

So, this is the old way of embedding audio in a web page--all this code right here, from here to here.0780

This is what you need just to embed one song, or a little audio clip.0793

So, you have this object; you have to specify its class ID; if you get the class ID wrong, then it is not going to load.0800

You have to specify the code base; you can see right now that it is using an Apple code base,0806

so if the user doesn't have this Apple plug-in installed (it is QuickTime, QT), then it is not going to work for them.0813

And either it will just be broken, or they will be prompted to install the plug-in.0820

They will have to take the time to try and install it; it may or may not work.0825

You can specify the width and height, and then you have these parameters that are also needed,0828

because it wasn't consistently implemented in different browsers.0833

So, you need these, as well; specify a file and a lot of other information.0837

And then, you need special code for Internet Explorer here.0841

This is an I.E. conditional comment; so, this is actually code that Internet Explorer made up to target just Internet Explorer.0845

And you have a whole separate code, basically the same as this, but a little bit different, using different types, etc., for Internet Explorer.0854

And this is just really complicated; and after all of that, you have multiple layers.0865

You have the browser; you have the plug-in; and then you have the actual audio element playing.0873

And the website has no access to the plug-ins or the audio itself.0877

And, for example, you will not be able to resize the player unless you do it through all of these complicated controls.0886

You can't update things dynamically.0891

The new way of doing it is vastly better.0893

Let's put it down here.0898

It is just the audio element, just like that: you can give it a source, and filename...0904

And the audio element actually, unlike the image element, is not an empty element.0925

It is closed; and this is for historical reasons.0932

The image element is really well supported by browsers; the audio element is only supported by new browsers.0937

So, what we can put in here is a little message saying, "Your browser"...a little message.0944

What this does is: a browser that can process this audio element will not display this text right here, or whatever else you put in here.0956

But an older browser will get confused by this tag and just sort of ignore--just treat it as something like a div tag.0965

And then, it will display this text; so this is a way to target users who have out-of-date browsers.0975

You might give them the option to upgrade, give them some links to a couple free browsers (like Firefox, Chrome, Opera,0981

or a new version of Internet Explorer)...another thing you can do is give a manual link to the piece of media in question; just go to the link.0988

And this is a better thing to do, because then, people with older browsers will still be able to access the content here very easily.1012

And they will download it, and then they will have whatever they need on their computer to run it--1022

assuming that they have something that is capable of playing MP3's.1028

And if you are clever, you can actually also use this whole object code.1032

All of this is not needed anymore (it is a mess); but if you do take the time to figure it out, and do it the old way for the old browser,1038

you can just paste that whole thing in here; now, the audio element ends here and begins way up here.1049

New browsers will just see the new audio element the right way.1061

And then, the old browsers are going to get all of this.1065

Let's take a look, really quickly, at what we have so far.1068

Here is the old way of embedding audio; and you shouldn't be surprised that it is just broken right now, actually.1077

We don't have the plug-ins installed; I probably have some typo in there; and it is just a big mess.1084

Now, the new way (where did it go?) is much simpler.1090

It is actually in here; I forgot to give it a control, so that it shows up.1110

Now, you can see the controls.1122

This is just automatically part of the browser; I can play it here.1126

You won't be able to hear it, because the speaker is on my shirt right here.1130

But all of these controls are just built into the browser, and you can seek, and there are a lot of other things you can do; I will show you in a minute.1134

But you will notice that, even though I had all this extra code that made this little broken plug-in,1144

this thing right inside this audio element--it is not showing up, because this browser is able to read it just fine.1149

This is Firefox, by the way; now, say you wanted to look at it in Chrome.1159

Chrome is going to display it a little bit differently; it is up to the browser how they want to render the controls.1168

It is a browser function, so every browser is going to be a little bit different.1176

When you are in Safari, it is going to look maybe a little bit nicer, more like Safari--more like Mac sort of controls.1183

And this is really good: you can style it with additional stylings, if you want.1191

But the point is that I now have access to this from the browser.1196

In fact, let's say that I wanted to not use this at all, but just add a little button and give it a type.1200

Now, it is actually really simple to control this.1225

I'm going to give this an ID of audioPlayer, and now this control down here that I am making manually...1230

I am going to say, when it is clicked, we get the ID of the player.1247

Now, I am going to copy this code over, really quickly; OK.1270

This is a little bit of JavaScript: you will learn about JavaScript later, hopefully, if you are serious about web design.1285

But this is an event; so, when it is clicked, it will run this script.1294

And what the script does is grabs the element, which we just specified up there, which is this one; and then, it uses this method to play it.1298

Here, we will do it in Chrome: here is this little button I have created, and you see it is not playing.1311

If I click this button, it starts playing.1316

You can do a lot of different things like that: it is all available in the browser now.1321

Let's add a couple of other ones, while we are at it.1326

Here are some other methods that you can use.1344

This is pause, and it is just the same as the one up here, except the method is pause.1347

Now, this one is a little bit trickier: you have the audioplayer.volume, and then, instead of just calling it, like these are,1355

you are setting it equal to this value; but you are actually not just setting it equal to...1364

this is a JavaScript shorthand notation that says, "Take this, and then add to it this value," basically.1369

So, for volume, the way that audio works is: 0 is muted, and then 1 is full-volume.1378

This is going to add .1 to it, and it will make it 10% louder every time you click this Louder button.1387

And then, the same thing here: this Quieter button that I have made (you have a -) will make it 10% quieter each time.1393

This is a mute button, which takes the muted property and sets it to true (which hopefully has been set to false already).1401

And then, this one will un-mute it (set it back to false); take a look.1412

So now, I have all of these little controls here.1420

I can play it, pause it (look right here), and I will mute it and un-mute it.1428

Right now, it is at full volume; I can make it a little bit quieter (see it move down?).1435

And so, now I don't even need the audio element that gives it the controls--this right here.1439

This the controls attribute; it is a boolean, by the way, which means you don't have to set it something like controls=true; that doesn't work.1452

This is a boolean, so just existing right here makes it on.1461

And then, if you don't have it, it makes it off.1466

So, if you really wanted to put the whole thing in here, like this, this would be for XHTML syntax, because every attribute needs a value.1468

And it is just boolean, so it is just on or off, basically; it is not true or false (you can't set it to false; not existing would be false).1481

I am going to remove it--no controls; and now, they are gone, but I have made my own here.1489

So, if I press Play, you can actually hear it (I can hear it; you probably can't).1500

And you can style whatever you want.1506

I used a button; you can use a link; you can use an image; you can use pretty much anything you want.1509

And there are a lot of other methods and things that you can do available, using JavaScript.1514

Now, we have all of this complicated stuff here.1524

I forgot to mention that you can actually take this Download Manually link and put it inside here.1527

We have this object, and then all of the parameters are children of it.1535

We can put this link in here; and if a browser doesn't support the object tag in this way, then they will get the Download Manually link.1542

So, this way, you have sort of tiered levels of support.1554

You have just the good HTML5 video and audio for new browsers.1558

And then, if that doesn't work, then you can fall back to the object element for slightly older browsers.1566

And then, if that doesn't work for some reason, then it falls back to just a simple link; and they can download it on their own.1571

Interestingly, you can take advantage of this, if you want to.1580

Let's add some code down here; if you want to target older browsers, and say you want to give a message specifically1586

to people using browsers that are not HTML5-ready, you can use the video element and the audio element.1599

And there is also the canvas element; and what this will do is: anything you put in here is only going to show up1608

to browsers that don't support the video, and don't support the audio element, and don't support the canvas element.1623

So, a lot of browsers right now fit this, actually.1631

But if you have a brand-new browser, you won't see this.1635

But if you have a slightly older browser, we are going to put a message that says something like this.1637

And you can send messages to them; you might recommend that they upgrade, or something like that.1650

There are a lot of attributes that you can add to these controls and the players.1667

So, let's clean this up; we don't want to deal with all of this right now.1675

Let's just work with the audio element by itself; OK.1684

I'll make another copy down here.1706

We have already talked about controls, and that will make it visible with the controls, so that users can play with it a little bit, and go throughout, selecting...1710

Another one you can add is autoplay; it is another boolean attribute.1725

If I add this, it is going to make it so that the browser automatically starts playing it, as soon as I load.1732

And you can see: it is playing here.1738

Don't do this! It is really annoying when you have a web page that starts playing music right away.1740

It is here if you really want to, but there are almost no use cases where this is not going to just be annoying.1745

But it is sort of the HTML5 methodology of paving the cow paths; this is something that people do.1753

And if it is not included here, people are going to figure out ways to do it anyway.1760

So, the ability to do it is added and available; but most web developers are going to say it is a bad idea.1764

Now, another one we can do, besides autoplay: we can say loop.1777

If it wasn't annoying enough that you started playing it right away, now it will play endlessly.1784

Once it gets to the end here, it is going to loop back around to the beginning and just keep playing over and over and over.1788

So, if you really wanted to bother somebody, you could have a little short clip that just looped around.1796

But that is not what...annoying people is easy; making a website that is nice, and a joy to use, is difficult.1804

We already looked at some of the JavaScript elements.1815

Probably the last one that is really interesting is actually only available for video, not audio.1819

So, I'll just say right now: it is the preload.1826

My mistake; this is available for audio, as well.1837

Preload is going to tell your browser to load the full file into memory,1841

so that when you do click Play (because you have the control to click Play, because you didn't use the autoplay attribute--don't use that!)...1846

when you do click Play, it will already have loaded the whole thing.1855

So, that is going to be preload=auto, which means to just go with the browser default.1860

And all of the browsers are going to default to preloading all of the audio and video that you have in your page.1867

Now, that can be bad, in some cases, because you may have, say, many, many, many audio playing.1875

And your browser is going to crawl to a halt, trying to download all these things.1884

Or you might have something that, for some other reason, you don't want preloaded.1887

You can set this to none, and then it won't preload it.1892

You are not going to be able to see the difference here, but there might be a pause,1899

or you might have to wait for it to buffer a little bit, when this is set to none.1902

You can also set it to meta-data, which will allow you to specify its preload state elsewhere in the meta information.1905

That is all the information for audio; now, video is actually very, very similar.1916

It has almost all the same tags and attributes and format syntax.1924

Let's set up this video section here.1931

Video is very similar: it is a video tag, and it is not an empty element, so you have to close it.1934

And the same thing here: you can put messages to the users that don't have browsers supporting this video element yet.1948

Actually, let's not be mean: let's do something like this.1961

That is a much better use for the video.1979

You might also be tempted to put things inside the video, like...say you have a transcript of what is being said in the video.1985

You might be tempted to do something like set up a paragraph and put the transcript in here, or whatever the text is.1993

The problem with this is that, if you put things inside the video element, it is going to hide it from your users that have the video.2007

That is not accessible; that is not very usable.2015

It would be better to take...if you have some information like that, why not make it available to everybody and paste it out here?2018

This is going to be basically for backwards compatibility.2026

Video is very similar to the audio tag: source=...2031

We are going to set up the video right here, and here is this little video that I have made.2046

You will see that there are no controls, and clicking on it doesn't really do anything.2056

So, let's add controls; refresh; and now, we have controls.2061

We can start playing it; we can pause it; we can mute it--things like that.2074

You can also put a width; let's make it 100 pixels; now it is much smaller.2082

This is something that you wouldn't be able to do with the object, or the normal embed elements, like...what YouTube uses today is Flash.2097

You would never be able to just resize it using HTML like that, because the video itself...you have to use the Flash, as well.2105

You can see, it still plays.2113

But you are also suffering from the same problem that I described above, with images,2115

where you now have a huge amount of video that is not even being fully used.2118

You are downloading a lot of unnecessary pixels; so don't ever do this.2123

But it may be the case that you would want to take something small and blow it up and make it a little bit bigger, for artistic reasons or whatever.2127

You have this ability to set it.2136

You can use the autoplay; you can use loop; and now, if I refresh, it should automatically start playing.2141

All right, so the last thing that is actually specific to video tags is the poster attribute.2160

Now, the poster attribute is new, so I think it may not be supported in this browser.2173

But you can set a poster; and what this does is: this image right here will be used as the default picture on the video.2179

So, if you haven't set it to play yet, then when you load the page, it is not supported here.2192

But when you load the page, you would see the picture that I set in the poster right here; you would see this picture2199

instead of seeing whatever frame is the first frame in the video.2204

So, this is something that you can do for...like in YouTube, when you have a couple of choices at the first frame to set.2209

This one--you can set any picture that you want to be the very first frame, the still that is before it goes.2216

Now, the big thing with video in HTML5 is: there is a big debate about what video formats to use.2225

We talked about how, with images, you have PNG's, JPEG's, and GIF's; and it actually took a while for that format to settle down.2236

Early on in the Web, people were using other types of image formats.2244

You would even see bitmaps and things like that; and over time, it settled down to those three as the main players.2247

And maybe some new ones will start being used, as well.2253

Video--the same sort of thing is going on, but we are in the early stages now.2257

So, this is an MP4, which uses an mpeg compression.2260

And this is actually a proprietary compression, which is really good, and it is really efficient;2265

but because it is proprietary, the owners of this technology can charge browsers, or pretty much anyone they want, to use it.2271

So, something like Firefox (which is an open-source browser, and it is not a for-profit company)--2281

they are afraid that, if they support this video codec, then they are going to be charged a bunch of money later on.2287

And it is going to make their browser too expensive for them to run.2295

And if they don't support it, then it will be unusable.2301

So, right now, Firefox is not supporting this codec, because they don't want it to take off and gain popularity and traction.2303

They are supporting an Ogg Vorbis video formatting instead, which is admittedly not as nice; it doesn't work quite as well.2312

It gets the job done; it doesn't compress things quite as well, but it is a format that is open.2323

It is open-source, so anybody can use it for free, and edit it, and all of these other things.2330

So, that is very beneficial; so, both Opera and Firefox are using this--they are putting their weight behind this format.2336

And it is just going to take some time for us to see which format works.2347

But this causes a problem for us, because now, if I had this mp4 video here, Firefox is not going to be able to play it.2350

But if I just change it to the Ogg, then another browser may not be able to play it.2361

So, we have come up with a solution where we have a new element inside the video here.2366

And it goes like this: you set a source, and it is a self-closing tag.2373

Now, what this does is: the browser will go down to the video, read it, and then--2392

because it supports the video element, it is going to go to this source tag and look for the source of the video in this source tag.2397

If it doesn't support the video element, it is going to see this--go in here and just display whatever it reads in here.2405

It is not going to recognize this element, as well.2412

And it is just going to kind of ignore all of this.2415

So, this is backwards compatible; and it will load this up.2417

Now, if it is a browser that doesn't support this, it will continue moving on to the next one.2421

And you can put multiple in here; so you can add the video.ogg, and then the browser will read this.2426

If it doesn't support this format, it can move on to the next one.2435

And if there are a lot of other formats being produced over the next couple of years, we could have as many of these as you wanted.2438

And then, say your browser still doesn't support that; then you can have a link, just like we were talking about before,2443

giving them the ability to just download it manually.2453

And maybe you would want to choose this one, because it is open-source.2457

Even if the browser does support the video and the source tag, it is going to display this if it can't find a format that will work for you.2470

Now, the same thing actually can apply to the audio element up here.2483

This is the audio player that we built earlier.2488

We can do the exact same thing; let's copy this.2492

We have the audio element beginning here, ending down here.2499

Let's have it all indented properly.2504

And we don't want it to preload, so let's remove this; and we'll remove the loop, as well.2507

And we can put as many of these audio formats as we want.2514

We could say mp3's; there is also an ogg format for audio.2520

And say you had it in Windows, Microsoft Wave format--you can set that up.2527

And so, it just depends on if your browser is going to support it.2535

And this is all going to be being worked out over the next couple of years.2537

But I think, just like images, it is going to eventually settle down to a few main players that all the browsers are going to support.2542

And maybe the same thing will happen with this mp4 format as what happened with the GIF format, which also used to be proprietary.2551

And what happened was: there were a lot of people worried that everybody on the Internet was using these GIF images, which were proprietary.2559

And they knew that at any time, the CompuServe company that made the GIF and owned the rights to it could start charging money for it.2566

And it could just bring the entire Web to a stand-still, because nobody could use these images anymore,2574

or they would have to pay whatever CompuServe wanted.2581

What CompuServe actually ended up doing was: they made it so that anybody can use GIF at any time, and sort of promised that they would never charge.2586

Some people are hoping the same thing will happen here.2596

But then again, why would a company that could make profit off of something like this just give it away?2599

So, that is why there is a lot of support for the Ogg codec.2604

This is pretty much the important things I want to do with audio and video.2611

I should mention that these audio tags that I created myself, that I added up here (I'll put them back in,2621

just so you can see them again)--these audio buttons that I have made--they could be links;2639

they could be almost anything, really; because see this button that I have right here?2645

This could just as easily be a span tag, which has no semantic meaning besides whatever CSS you apply to it...like a class may have some semantic meaning.2650

This span tag--you will notice, when I hover over it, it doesn't even turn into a hand cursor.2665

But still, if I click on it, it is still going to trigger this on-click event and run this JavaScript, which will un-mute it.2669

And so, it just has a lot of freedom.2679

The same thing applies to video; you can do the exact same thing with all of the exact same JavaScript methods that are described up here.2681

They work for both of them.2693

And so, that gives you a lot of freedom.2700

So, in summary, we have three tags: one image, one for audio, and one for video.2705

And that should be all you need; and there is a lot of other embedded content that you can use,2712

but it is a little bit more advanced; and we may look at that a little later.2721

But this is all you need for now, for the main things you will be doing.2727

One thing to be aware of, also, is that, when you add a lot of these things, they can make the page a little bit slow.2737

So, you always want to be careful about loading a lot of video and audio, especially if they are preloaded,2746

as images are preloaded, because it is going to slow down the bandwidth--it is going to slow down how long it takes your page to load.2752

I think that is it for this lesson; thanks for watching Educator.2762

Educator®

Please sign in to participate in this lecture discussion.

Resetting Your Password?
OR

Start Learning Now

Our free lessons will get you started (Adobe Flash® required).
Get immediate access to our entire library.

Membership Overview

  • Available 24/7. Unlimited Access to Our Entire Library.
  • Search and jump to exactly what you want to learn.
  • *Ask questions and get answers from the community and our teachers!
  • Practice questions with step-by-step solutions.
  • Download lecture slides for taking notes.
  • Track your course viewing progress.
  • Accessible anytime, anywhere with our Android and iOS apps.