Embedding Video - FREEEEEEEEEEEEE FREEEEEEEEEE FREEE FREEE FREE FREFEREFREEFREEEEEEEEEEEEE FREEEEEEEEEE PDF

Title Embedding Video - FREEEEEEEEEEEEE FREEEEEEEEEE FREEE FREEE FREE FREFEREFREEFREEEEEEEEEEEEE FREEEEEEEEEE
Course Health Assessment 1
Institution Unitek College
Pages 4
File Size 607.7 KB
File Type PDF
Total Downloads 21
Total Views 122

Summary

FREEEEEEEEEEEEE FREEEEEEEEEE FREEE FREEE FREE FREFEREFREEFREEEEEEEEEEEEE FREEEEEEEEEE FREEE FREEE FREE FREFEREFREEFREEEEEEEEEEEEE FREEEEEEEEEE FREEE FREEE FREE FREFEREFREEFREEEEEEEEEEEEE FREEEEEEEEEE FREEE FREEE FREE FREFEREFREE...


Description

Embedding Video Content Overview Modern web browsers have native support for video content. Embedding videos into a web page is very simple. In this activity you will embed videos into your webpage using 2 different techniques: • •

Use an HTML5 video element to directly embed an MP4 file Use an iframe element to embed a YouTube video

Before starting this activity, make sure you have downloaded the Lab 5 Files.zip file and completed the previous activity. You will be using the following files: •

Lab 5 Files (folder) o index.html (HTML document) o videos/never-gonna-give-you-up.mp4 (video file)

Replace the image with a video Note: Similar to images, video files should be correctly optimised for web delivery. If a video is not optimised to reduce its file size, it will load slowly and buffer frequently during playback! 1. The page currently features an image of Rick Astley. To make the page more engaging, let’s replace the image with a video. An MP4 video file has been provided in the videos subfolder. Locate the img element in the HTML code:

Replace the img element with a video element:

Save and test your page.

2. You can add playback controls by adding a controls attribute in the element’s start tag:

The controls attribute is a Boolean attribute. This means that the attribute does not require a value. When the attribute is present, it automatically becomes a true value. The video player now has playback controls:

3. You can also start playback as soon as the page loads, as long as the video is muted as well:

Because the video is short, you can also make the playback repeat automatically:

4. The video can also be resized in the HTML code:

… Or by using CSS code in your style.css file: video { width: 100%; }

Embed a video from YouTube Instead of using your own MP4 video file, you can also embed videos from online services such as YouTube. This is often a better method and more convenient method of adding video to a page as YouTube will take care of many technical aspects of video delivery: • • • •

Video does not use storage space on your own web server Multiple quality options can be offered with automatic switching based on user’s bandwidth Multiple formats for better compatibility with older web browsers Advanced features such as subtitles

Note: Not all YouTube videos can be embedded. This option is enabled by the video’s original uploader. Here is a video that has embedding disabled: https://www.youtube.com/watch?v=dQw4w9WgXcQ 1. Search for a suitable video to embed on YouTube https://www.youtube.com/results?search_query=never+gonna+give+you+up+live Open a video and look click on the share button below the video player:

In the share dialog, choose the embed option:

2. A preview of the video embed is shown with HTML code that you can use in your page:

Copy the code and paste it at the top of the mian section of your HTML document to add the video to the top of your page:

"Never Gonna Give You Up" is a song recorded by British The iframe element has a few attributes that are important: • • •

width height src

The width of the embedded iframe The height of the embedded iframe The URL of a webpage to display inside of the iframe

Try loading the src URL directly in your browser – you will see the video player filling the entire browser window. You can also try changing the size of the video in your page by editing the width and the height values. Note that unlike a video element, both width and height must be set....


Similar Free PDFs