1 of 54

Week 9: Debugging +

Embedded Media

COMD 2451

Spring 2024

2 of 54

Announcements

3 of 54

Wednesday Class

4 of 54

117%

Everybody gets

5 of 54

6/6

Correct on board

5/6

Lowest

Learning: check each other’s answers at end; others can catch something you missed!

Section I

6 of 54

15/10 correct on board.

14

Lowest

7 of 54

13.5 if got < 13.5,

  • DONT FEEL BAD!
  • Mostly bc answer not written in fully or forgot to write all down.

8 of 54

Thursday class

9 of 54

118%

Everybody gets

10 of 54

100%

Section I

11 of 54

13.5 correct on board.

12

Lowest

+1

Bonus for teamwork and first time.

12 of 54

13.5 if got < 13.5,

  • DONT FEEL BAD!
  • Mostly bc answer not written in fully or forgot to write all down.

13 of 54

Week 9: What we will Learn Today

  • Debugging
  • Quiz 2
  • Reading: Reading: W3Schools section on HTML Media (Media through Youtube) https://www.w3schools.com/html/html_media.asp
  • Lecture: Using Rich Media, embedding video, audio files
  • LAB/Homework: Create a web page with embedded media

14 of 54

Debugging

15 of 54

What is Debugging?

Debugging is the process of finding and fixing errors in the source code of any software.

Why is it called debugging ?

While working on a Mark II computer at Harvard in the ‘40s, Admiral Grace Hopper discovered a moth stuck in a relay impeding its operation. She remarked that they were working on “debugging the system.” The terminology stuck and is used to this day in programming.

Grace Hopper’s notes about the incident

The actual bug

Grace Hopper

Tech pioneer and general badass

16 of 54

What is Debugging in the context of our class?

In coding html and css, we use debugging to refer to the process of removing errors and any other impediments to our code working as intended on a browser. This can include:

  • errors we make while coding (most common)
  • Missing, misplaced or non-functioning files
  • Any other factors that may affect our code’s implementation in the browser

17 of 54

How to Debug HTML and CSS

Define the Problem: In your own words, what exactly is wrong?

Step Through the Code: Do a line-by-line scan to step through your code, looking for errors, incorrect links to other files, missing elements, missing semicolons, incorrect quotation marks or missing angle brackets, etc.

Selective Removal: Remove lines that you suspect are causing the error to isolate sections that have problems. Add them back as you make adjustments. (Use comments to “comment out” the line of code) �HTML comment syntax: <!-- COMMENT -->

CSS comment syntax: /* COMMENT */

Test Often: Each time you make a change, test how it looks in a browser. This will let you know if the change worked or not. You can also use the inspector to change values, check whether or how CSS properties are applied, and many more things.

18 of 54

Debugging Tools

Your Own Eyes/Instincts: First, have a look at the code and try to identify any errors. Your own instincts will improve over time!

Markup Editor: Use a tool like VS Code that displays errors in red.

Developer Tools: Use the developer tools (Inspector) available in your browser to view source, inspect elements,look at the box model, etc.

Validator: Use the Validator tools available at W3C: https://validator.w3.org/

19 of 54

Tips for Efficient Debugging

Use Version Control: Before you start debugging, Upload the current version to GitHub (or save a copy of the folder) so you have a snapshot of your code BEFORE you make changes. This way, you can always go back.

Start Small, Test Often: To avoid confusion, make only one small change at a time, then test to see its effect in the browser. This saves lots of time.

Collaborate: No developer is an island. Reach out to other students, developers or online communities for help when you’re stuck. A fresh perspective can help you find the problem more quickly.

Take a Step Back from the Problem: If you find yourself frustrated, take a step away for a while. Go for a walk, chat with a friend, work on something else. Sometimes the solution magically appears when you stop thinking about the problem. And even if not, working on it when feeling refreshed brings the answer much faster.

20 of 54

HTML Debugging Checklist (a.k.a. Types of Bugs)

Syntax errors: things like spelling, punctuation, capitalization, and forgetting things like closing brackets, semicolons or spaces. Easy to fix when familiar with the language’s syntax. Examples:

  • Unclosed elements: If an element is not closed properly, its effect can spread to other areas of the code
  • Unclosed attributes such as <a href=”resume.html>Resume</a>

Placement errors: When things are coded correctly, but they’re in the wrong place in the code. Examples:

  • Misplaced elements, such as something that belongs in the <head> but isn’t.
  • Badly nested elements, such as html end tags that straddle the beginning of another html element. <strong> <em> </strong> </em>
  • Incorrectly linked files, such as images or css files, can make things not appear as expected. Check file names and file paths to ensure they match the actual files and file structure. Remember: file names cannot have spaces or symbols other than underscore and dash!

Compatibility errors:

  • Are the elements you are using supported by the browser you’re using?
  • Are the elements you’re using current and not deprecated? (Check html.com)

Great Resource

21 of 54

CSS Debugging Checklist

Linking: Is the CSS sheet linked correctly? Check to make sure the file name and the file path match the code.

Syntax: spelling, punctuation, capitalization, and using the correct symbols (such as {} and ; )

CSS Specificity: If a style you apply is not appearing, sometimes there is another property overriding it. An easy way to find this out is by using the inspector to see what’s controlling this. To remedy it, use a more specific CSS selector or change the property overriding the style you want.

Are the property and value supported by your browser? Check the property in MDN’s CSS reference.

Great Resource

22 of 54

Quiz #2

23 of 54

Embedded Media

24 of 54

Embedding Media in a Web Page

25 of 54

Common Media File Types

Images: .JPG, .JPEG, .GIF, .PNG, .SVG, .WEBP

Audio/Lossless: .WAV, .FLAC, .AIFF, .ALAC

Audio/Lossy: .OGG, .MP2, .MP3, .AAC, .AMR, .WMA

Video/Compressed: M4V, .MP4, .OGG, .OGV, .WEBM

Video/Uncompressed: .AVI, .MOV, .MP4, .MPEG, .MPG, .WMV, .OGG, .OGV

A compressed or lossy file is any file that is smaller than their original file size. These files make downloading from the web faster, easier and allow more data to be stored on removable media, such as a thumb drive.

26 of 54

HTML5 Media Elements

<audio>: Defines sound content

<embed>: Defines a container for an external (non-HTML) application

<video>: Defines video or movie

<source>: Defines multiple media resources for media elements (<video> and <audio>)

<track>: Defines text tracks for media elements (<video> and <audio>)

Source: https://www.w3schools.com/html/html_media.asp

27 of 54

HTML5 Media Elements

<object>: This is an HTML 4.10 element that can be used for any external media type. (Some of the older attributes are no longer supported).

Source: https://www.w3schools.com/html/html_object.asp

28 of 54

HTML5 Audio

<audio controls>

<source src="assets/horse.ogg" type="audio/ogg">

<source src="assets/horse.mp3" type="audio/mpeg">

</audio>

Attributes: autoplay, controls, loop, muted, src, preload

preload requires a value: auto, metadata, none

Supported Formats: MP3, WAV, and OGG

Source: https://www.w3schools.com/tags/tag_audio.asp

29 of 54

HTML5 Video

<video width="320" height="240" controls autoplay muted>

<source src="assets/movie.mp4" type="video/mp4">

<source src="assets/movie.ogg" type="video/ogg">

</video>

Attributes: autoplay, controls, height, loop, muted, poster, src, width, preload (preload requires a value: auto, metadata, none)

Supported Formats: MP4, WEBM, and OGG

Source: https://www.w3schools.com/tags/tag_video.asp

30 of 54

HTML5 Embed

<embed> allows you to display any number of media types.

<embed src="helloworld.swf">

Attributes: height, src, type, width

List of supported media types is available at http://www.iana.org/assignments/media-types/

Source: https://www.w3schools.com/tags/tag_embed.asp

31 of 54

Embed with Iframe

<iframe width="560" height="315" src="https://www.youtube.com/embed/yTvC2HSfitE" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen>

</iframe>

<iframe> is a common way of embedding content into a webpage. It creates a window, or inline frame, within the browser window.

Source: https://www.w3schools.com/tags/tag_iframe.asp

32 of 54

HTML Object

<embed type="video/webm" src="/media/examples/flower.mp4" width="250" height="200">

It is also possible to use HTML5 <EMBED> or <OBJECT> elements to embed media without creating an inline frame.

Attributes: align, archive, border, classid, codebase, codetype, data, declare, form, height, hspace, name, standby, type, usemap, width

Source: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/embed

33 of 54

YouTube Video

YouTube videos can be added using <iframe>

<iframe width="420" height="315"

src="https://www.youtube.com/embed/tgbNymZ7vqY"></iframe>

To add properties like autoplay, controls or loop, append the YouTube URL with ? followed by the property and a value of 1 for each property.

src="https://www.youtube.com/embed/tgbNymZ7vqY?&autoplay=1&mute=1"

src="https://www.youtube.com/embed/tgbNymZ7vqY?&controls=1&loop=1"

Source: https://www.w3schools.com/html/html_youtube.asp

34 of 54

Using Rich Media

35 of 54

What is Rich Media?

Rich media is a digital advertising term for an ad that includes advanced features like video, audio, or other elements that encourage viewers to interact and engage with the content.

While text ads sell with words, and display ads sell with pictures, rich media ads offer more ways to involve an audience with an ad.

When we aren’t talking about ads, we tend to use multimedia or just media to describe the different forms it may take. See examples on article below.

https://www.nytimes.com/2019/11/20/arts/music/grammy-awards-nominees.html?action=click&module=Top%20Stories&pgtype=Homepage

36 of 54

Rich Media Resources

Google Studio has guidelines for rich media production and is a good source for learning more about rich media advertisements.

What is rich media? - Studio Help (google.com)

Google Rich Media Gallery has inspiration and offers a Google Skillshop tutorial where you can create a rich media ad:

http://www.richmediagallery.com/

Creatopia Tutorial (easy): How to create rich media ads - 9 simple steps

Adform (expert): Intro to Building with HTML5 Studio | Adform Help

37 of 54

Lab: Embedding Media

38 of 54

Lab: Embedding Media

1. Group into pairs.

2. Create an HTML document (index.html) in a folder called [yournames]-media

3. Look for a youtube video to embed in your media file.

4. With your partner, create an audio recording with your phone discussing the youtube video. No more than a minute or two.

https://www.wikihow.com/Record-Audio-on-a-Mobile-Phone

5. Export the audio recording to Google Drive or other media storage (or email to yourself).

6. Embed your conversation and a youtube video into your media web page using the <audio> and <embed> HTML5 elements discussed in this deck. You can also use the Embed code provided by Youtube.

7. Upload the index.html, assets folder and files to a repository on GitHub. Copy the link to your github and submit it.

Submit your files to: Blackboard in the Assignments Page for Week 9.

39 of 54

Putting Together

Final Project

40 of 54

Final Project Requirements: Both parts required

  • Presentation

● Cover page

● Project Proposal - Week 3 In Class

● Mood Board - HW

● Style Guide - HW

● CSS Stylesheet, HTML file - in progress

● Supporting images/sketches - HW�(Sketches of your website. You can show multiple sketches to show how your concept got clearer over time as you worked on your website and got more concrete idea on what you wanted it to look like. These can be photos of drawings on paper; they don't have to be formal.)

● “Thank you” page with your portfolio URL and email address

Format:

Can use Powerpoint, Google Slides, Keynote, etc.

2) Portfolio Website

● Home page - in progress

● Portfolio pages

● Image Gallery - HW

● Portfolio samples and description

● Resume Page (write your resume in HTML)

● Contact Form

Format:

Must be a working website at your personal domain

41 of 54

Refresher: Github!

42 of 54

What is Github?

43 of 54

Why Github?

We will host our websites here -- for FREE!

Github is used by developers everywhere

It does version control

We can share with each other

You can keep your Github account forever!

Github is where the LIVE version of your website will live.

44 of 54

Your Files

Your LOCAL Environment

Your Computer or Cloud (OneDrive, Google Drive, or Dropbox)

Create and Edit Your Files Here

Your Live Environment�Github

HTML

The live version of your files lives here

CSS

Images

UPLOAD

45 of 54

OMG it looks complicated. What do I do?

I know, right?

This tool is used by devs at all levels so it has lots of advanced features and lingo we won’t use.

Don’t worry. Follow these instructions, step by step!

46 of 54

Create an Account

Write your password somewhere you will remember it!

47 of 54

Create a Repository

How? Watch this video from Kenny Yip:

https://bit.ly/Github1025

48 of 54

Upload Your Files

Upload your files in the same structure we talked about.

  • Html files go in the ROOT folder of your repository
  • CSS files go in the css folder*
  • Images go in the assets folder*

  • folder names should be all lowercase

49 of 54

Upload Your Files: Steps

  • Open your GitHub repository. Click the "+" or "add file" button next to the green "Code" button, and choose "upload files." You will see a large box that says "drag files here to add them to your repository."
  • Go to your local file directory on your computer where you keep your files (if you keep your files on repl.it, first download them as a zip, then extract the zip, and continue these instructions.)
  • delete all the extra junk you don't need: anything that isn't part of your website. GitHub is finicky; even a word doc in your repository can keep the entire site from working!
  • Check spelling. Make sure your home page is called "index.html". With a lowercase "i". Your website won't work unless you have it spelled exactly this way. Also make sure that none of your files have spaces in them.
  • Select all of the files and folders that you want to bring over to GitHub: all your html files, css folder, assets folder, and js folder (if you have one. (note: do NOT select the folder that contains all the files.
  • Drag these files over on top of the "drag files here..." box in GitHub, and let go!
  • Wait until the files finish uploading
  • Hit the green "Commit changes" button and follow the prompts. You don't have to write a comment unless you want to.

50 of 54

51 of 54

Share With Me And Each Other

Add me as a collaborator.

  • go to "Collaborators" on the left sidebar. Enter your password if prompted.
  • click "add people"
  • enter "sandblasta" - that is my username. then click the green button.

52 of 54

Homework:

Project 1 Restaurant Page

53 of 54

Project 1: One-Page Design Restaurant Web Page

Each student will design and hand-code a web page for a restaurant cuisine of their choice. The restaurant web page must be for the menu section of the restaurant website.

The primary focus is on learning layout design for the purpose of using only HTML and CSS for screen presentation.

Assignment Objective:

The purpose of this assignment is to help students gain a better understanding of markup language and get comfortable with hand coding. Only HTML and external CSS are allowed.

Menu page must consist of the following:

● Full navigation

● Welcome section

● About section

● Contact section

● Menu section:

○ a minimum of 3 courses (e.g. breakfast, lunch, dinner)

○ 3-5 items for each course: each item must have a price and description

54 of 54

Restaurant Web Page: Examples