Playing Audio (Part 1).

Slides:



Advertisements
Similar presentations
Using Multimedia on the Web Enhancing a Web Site with Sound, Video, and Applets.
Advertisements

CNIT 132 – Week 9 Multimedia. Working with Multimedia Bandwidth is a measure of the amount of data that can be sent through a communication pipeline each.
Neal Stublen Pre-HTML5 Solutions  Audio and video were embedded in pages using plug-ins Apple Quicktime Microsoft Silverlight Adobe.
Video, audio, embed, iframe, HTML Form
INF Web Design Using Multimedia on the Web Video - Part 1.
COS 125 DAY 27. Agenda Assignment # 8 Due April 27 Assignment #9 Posted in Webct  Last one!!!!  Due May 4, 8AM Exam #5 is April 30  Castro Chap13,
COS 125 DAY 25. Agenda Assignment 7 is corrected  5 A’s, 2 B’s, 1 C and 1 F Assignment 8 (last one) is posted  Due May 2 Left to do  3 rd and final.
Macromedia Dreamweaver 4 Advanced Level Course. Add Rollovers Rollovers or mouseovers are possibly the most popular effects used in designing Web pages.
Define objects and their relationships to multimedia Explain the fundamentals of C, C++, Java, JavaScript, JScript, C#, ActiveX and VBScript Discuss security.
Tutorial 7 Working with Multimedia. XP Objectives Explore various multimedia applications on the Web Learn about sound file formats and properties Embed.
Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development I” Course materials.
Audio and Video on the Web Sec 5-12 Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development I” Course materials.
Session: 11. © Aptech Ltd. 2HTML5 Audio and Video / Session 11  Describe the need for multimedia in HTML5  List the supported media types in HTML5 
Chapter 11 Adding Media and Interactivity. Flash is a software program that allows you to create low-bandwidth, high-quality animations and interactive.
Using Multimedia on the Web
CHAPTER 18 INTEGRATING AUDIO AND VIDEO. LEARNING OBJECTIVES How the HTML 5 and tag pair can be used to include a video file within a webpage How video.
Using HTML 5.  HTML 5 uses a standard method to embed audio into Web pages.  Prior to HTML 5, browser plug-ins or separate applications such as Windows.
Tutorial 7 Working with Multimedia. XP Introducing Multimedia Bandwidth is a measure of the amount of data that can be sent through a communication pipeline.
© Cheltenham Computer Training 2001 Macromedia Dreamweaver 4 - Slide No 1 Macromedia Dreamweaver 4 Advanced Level Course.
CSCI N241: Fundamentals of Web Design Copyright ©2004  Department of Computer & Information Science Adding Sound.
1 Web Developer Foundations: Using XHTML Chapter 10 Helper Applications and Plug-in Concepts.
Audio and Video CGS Some Common Audio Formats Format Use Extension MIDI instrumental music.mid MPEG songs.mp3 RealAudio live broadcasts.ra Wave.
Tutorial 7 Working with Multimedia. XP Objectives Explore various multimedia applications on the Web Learn about sound file formats and properties Embed.
DHTML AND JAVASCRIPT Genetic Computer School LESSON 2 HTML TAGS G H E F.
MIS 425 Lecture 3 – HTML 5 and CSS Instructor: Martin Neuhard
Tutorial 7 Working with Multimedia. New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 2 Objectives Explore various multimedia applications.
Tutorial 7 Working with Multimedia. New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 2 Objectives Explore various multimedia applications.
Streaming Media A technique for transferring data on the Internet so it can be processed as a steady and continuous stream.
Creating Links. The Anchor Element: The anchor tag can be used in three different ways: 1.External link – to link to a web page outside your own website.
PLUG INS flash, quicktime, java applets, etc. Browser Plug-ins Netscape wanted a method to extend features of the browser became an unofficial standard.
HTML 5 Tutorial Chapter 3 Video. Video HTML 5.0 provides a standard for showing video. Using the element we can easily embed video within our web page.
HTML 5. Introduction In modern browsers, adding a video to your page is as easy as adding an image. No longer do you need to deal with special plug-ins.
Chapter 11 Adding Media and Interactivity. Chapter 11 Lessons Introduction 1.Add and modify Flash objects 2.Add rollover images 3.Add behaviors 4.Add.
FLASH, VIDEO & AUDIO How to add Flash movies into your site How to add video and audio to your site HTML5 and elements.
CHAPTER 8 Multimedia 1. Using Multimedia ❖ Multimedia: the combination of text, sound, and video to express an idea or convey a message. ❖ Podcasts: a.
CHAPTER 10 AUDIO AND VIDEO. MEDIA PLAYER API HTML5 contains an API (Application Programming Interface) for controlling audio and video players embedded.
The HTML5 logo was introduced by W3C in 2010
Advanced HTML Tags:.
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Scripting - Client-side vs. Server-side Scripting
Section 9.1 Section 9.2 Identify multimedia design guidelines
Dreamweaver – Setting up a Site and Page Layouts
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Chapter 9 HTML 5 Video and Audio
HOW FLASH WORKS The Flash authoring environment is used to create Flash movies The .fla file is exported to a format called .swf The .swf file is.
Web Concepts Lesson 2 ITBS2203 E-Commerce for IT.
Links and Comments in HTML5
Embedding Media into Web Pages
Chapter 4: HTML5 Media - <video> & <audio>
Learn HTML Basics Lesson No : 10
"Digital Media Primer" Yue-Ling Wong, Copyright (c)2013 by Pearson Education, Inc. All rights reserved.
Web Programming– UFCFB Lecture 8
Tutorial 7 Working with Multimedia
HTML5 Level II Session II
2.02G Publishing Animated Videos
Playing Audio (Part 2).
2.02F Publishing Animated Videos
Audio and Video Chapter 10.
Integrating Multimedia: Sound, Video and More
Essentials of Web Pages
Playing Video (Part 2).
Playing Video (Part 1).
LGC Website, Software updates, Documentation, and Videos
HTML5 Media.
Client-Side Internet and Web Programming
A Look at PowerPoint 2000 The , the , and the.
Working with Multimedia
Web Programming– UFCFB Lecture 8
HTML5 Audio & Video By Derek Peacock
Presentation transcript:

Playing Audio (Part 1)

Playing Audio in HTML (1) In prior versions of HTML, audio files could be played only by using one of these resources external to the core browser: A browser plug-in, such as Adobe Flash, Apple QuickTime, or Microsoft Silverlight A JavaScript player, such as Yahoo WebPlayer An external application, such as Windows Media Player To play audio in HTML via plug-in, we used the <embed> or <object> elements: <embed height="100" width="200" src="audio/song.mp3" autostart="false"> <object height="100" width="200" data="audio/song.mp3"></object> To play audio in HTML via a JavaScript player, we added a script to load the player. Any subsequent audio files opened were handled by the player. Here we loaded the Yahoo WebPlayer and linked directly to an audio file: <script type="text/javascript" src="http://webplayer.yahooapis.com/player.js"></script> <a href="audio/song.mp3">Play the song now.</a>

Playing Audio in HTML (2) To use an external application, we just created a text link directly to the audio file. Once the link was clicked, the browser would turn over the playing of the file to the local operating system: <a href="audio/song.mp3">Play the song now.</a> There were numerous disadvantages to using these methods: Plug-ins needed to be installed and maintained for each browser. Plug-ins were also less than 100% reliable and sometimes crashed. If JavaScript was disabled on the browser, audio files would not be played by a JavaScript player. There were inconsistencies in how each operating system played audio files and the player interface and features were outside of the web designer's control.

Playing Audio in HTML5 HTML5 introduced the <audio> element. The goal of this new element is to play audio files natively within the browser. Doing so carries some big advantages: No need for installing, maintaining, and updating specific browser plug-ins. Faster and smoother performance, since no plug-ins or JavaScript need to be loaded. More consistency in behavior among the different browsers, versions, and platforms. This change in how browsers play audio (and video) is one of the most important new features in HTML5. Web designers have eagerly awaited this change and how it promises to simplify their work when playing multimedia on their websites. Unfortunately, as we will soon see, there are still some major challenges preventing the smooth implementation of these new features right away.

The <audio> Element Here we have added an MP3 music file to our web page using <audio>: <p>Listen to my favorite song:</p> <audio src="audio/song.mp3" controls></audio> Chrome 25.0 IE 9.0 The controls attribute provides the user with a way to control the play of the audio: start/stop, jump to any point on the audio track, mute, and adjust volume. It also displays the length of the audio and the current progress point. Always include the closing </audio> tag, even if there's nothing between the two tags. It's a good practice to keep separate folders on your web server for different types of files. Having a dedicated folder each for audio and video files will make the organization of our site much easier to manage.

Pre-downloading Audio By adding the preload attribute to the <audio> element, we can recommend to the browser what to do with the audio file when the web page loads: <p>Listen to my favorite song:</p> <audio src="audio/song.mp3" controls preload="auto"></audio> There are three possible settings for this preload attribute: "auto" – Requests the browser to download the audio file automatically in the background, without waiting for the user to click on the play button. "metadata" – Requests the browser to download just the beginning chunk of the audio file, which is enough to determine and display the track length. "none" – Requests the browser not to download any portion of the audio file unless the user clicks on play. No track length will be displayed. Unless we have a specific reason, such as wanting to save bandwidth or speed up a page with multiple large audio files, sticking with "auto" is recommended.

Playing Audio Automatically The autoplay attribute lets us begin playing an audio file immediately upon page load, without the user clicking on the play button: <p>Listen to my favorite song:</p> <audio src="audio/song.mp3" controls autoplay></audio> This feature should be used with caution, as most users dislike pages that play audio automatically. One possible exception might be to play background music on a page in which the user expects it. In this case, we could set <audio> to autoplay and remove the controls attribute: <audio src="audio/background.mp3" autoplay></audio> Remember that by enabling autoplay and removing the controls attribute, the user has no direct way to stop the audio from playing. Their only options would be using the computer's volume/mute controls or exiting the page entirely.

Looping Audio The loop attribute lets us tell the browser to play the audio track continuously until the user stops or pauses it: <p>Listen to my favorite song:</p> <audio src="audio/song.mp3" controls loop></audio> This can be handy if we want to play background music that never stops. Some music tracks are specifically designed so that the ending matches up with the beginning to make for continuous, seamless music. In that case, we can add the loop attribute to our previous example: <audio src="audio/background.mp3" autoplay loop></audio> Notice that, as with most HTML5 elements, multiple attributes can be used in combination. The order the attributes are listed makes no difference.

Current Browser Support for <audio> The good news is that <audio> is well-supported across major web browsers, including IE9.0 and most mobile browsers. The bad news is that not all audio formats are supported by all browsers, a problem we will address in the next lesson.