Multimedia and Embedding Flashcards
<img></img>
Creates an image element pointing to the file “dinosaur.jpg” in your “images” folder
If the picture doesn’t show up (or screenreader gets to it) the “alt” attribute comes in
Note: Putting your images in an “images” folder is recommended or SEO purposes. Search engines also take note of the name of the image and alt text!
and
You can wrap your <img></img> in tags with a following tag to specify a caption for the image
Note: A figure could be several images, a code snippet, audio, video, equations, a table, or something else.
Explain this:
<p>Your browser doesn't support HTML5 video. Here is a <a>link to the video</a> instead.</p>
This embeds a video from the file rabbit320.webm, adds ways to control the video, and provides a fallback <p> in case the video doesn’t work with the browser</p>
Explain this:
<p>Your browser doesn't support HTML5 video. Here is a <a>link to the video</a> instead.</p>
We are trying to embed a video, and the two tags specify in order the files we would like to try to embed. If the browser doesn’t support the first one, it tries the second. If doesn’t support the second, displays the message.
Note: include the “type” attribute to make sure the browser knows what type of file it is so that it can determine if it isn’t compatible more quickly.
Explain this:
<p>Your browser doesn't support HTML5 audio. Here is a <a>link to the audio</a> instead.</p>
We are trying to embed an audio file, and the two tags specify the order of the sources to pull from. Controls will make play/pause etc. show up.
If it doesn’t support the second source, displays the <p></p>
const mediaElem = document.getElementById("my-media-element"); mediaElem.load();
resets the media element back to the beginning
WebVTT
a format for writing text files containing multiple strings of text along with metadata such as the time in the video at which each text string should be displayed, and even limited styling/positioning information.
Basically subtitles etc.
Look up more when needed
The HTML Inline Frame element () represents a nested browsing context, embedding another HTML page into the current one.
This is great for incorporating third-party content into your website that you might not have direct control over and don’t want to have to implement your own version of — such as video from online video providers, commenting systems like Disqus, maps from online map providers, advertising banners, etc.
Clickjacking
A malicious attempt to steal your info usually through overlaying an invisible layer to the user
What are the benefits of using HTTPS when embedding content from a third party?
HTTPS reduces the chance that remote content has been tampered with in transit,
HTTPS prevents embedded content from accessing content in your parent document, and vice versa.
sandbox
A container for code where it can be used appropriately — or for testing — but can’t cause any harm to the rest of the codebase (either accidental or malicious)
By default, you should impose all available restrictions by using the sandbox attribute with no parameters
Example:
Content Security Policy
provides a set of HTTP Headers (metadata sent along with your web pages when they are served from a web server) designed to improve the security of your HTML document.
What can you do now that Adobe Flash is going away?
You should use HTML5 video for your media needs, SVG for vector graphics, and Canvas for complex images and animations.
Raster Images vs. Vector Images
Raster images are image files such as .png, .jpeg, etc, and the way that they render the image is by specifying a grid of pixels (where they should be placed, what color). Raster images are more suited for photos because it’s hard to achieve the necessary amount of detail in vector images
Vector images are defined using algorithms. A vector image file contains shape and path definitions that the computer can use to work out what the image should look like when rendered on the screen.
Vector images work much better in responsive design, such as when zooming in on the image, in which case a raster image would become blurry and the vector image would not. SVG is a type of vector image.
SVG
SVG stands for Scalable Vector Graphics.
It’s an XML-based language for describing vector images. It’s basically markup, like HTML, except that you’ve got many different elements for defining the shapes you want to appear in your image, and the effects you want to apply to those shapes.
As a simple example, the following code creates a circle and a rectangle: