Chapter 14: Multimedia Audio Files Audio Files Playing Audio Playing Audio Running Audio on a Separate Thread Running Audio on a Separate Thread Displaying.

Slides:



Advertisements
Similar presentations
Preloading Images for better Performance Using the MediaTracker class.
Advertisements

1 More on Applets Overview l Changing Colors l Changing Fonts & Styles l Applet Life-Cycle l Input using Dialog Window l Input using HTML parameters l.
Using Thread for Animation. Threads When we are doing multiple things at once we say we are multitasking Computers multitask when they run several programs.
Using Multimedia on the Web Enhancing a Web Site with Sound, Video, and Applets.
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.
1 More Animation, Images and Sound Chapter Eleven.
Macromedia Director 8 Intermediate Level Course. Ink Masks Using the Ink Mask feature will allow you to create parts of a bitmap cast member to become.
1 Chapter 17 Applets and Multimedia. 2 Motivations F When browsing the Web – you frequently see the graphical user interface –animation developed using.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved What is Multimedia? Multimedia.
1 Frameworks. 2 Framework Set of cooperating classes/interfaces –Structure essential mechanisms of a problem domain –Programmer can extend framework classes,
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Chapter 18 Applets and Multimedia.
1 L45 Multimedia: Applets and Applications. 2 OBJECTIVES  How to get and display images.  To create animations from sequences of images.  To create.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter Java Multimedia: Images, Animation, Audio.
1 Lecturte 14Lecture 7 Applications of Graphics Overview  Conversions Between Applications and Applets  Handling Mouse Events  Handling Keyboard Events.
Audio Chapter 17 - Student. (c) 2005 by Elizabeth Sugar Boese Audio Files Java can play the following audio types: .au (Sun Audio) .wav (Windows Wave)
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved L06 (Chapter 16) Applets.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 14 Applets, Images,
Unit 071 Review of Applets Learning Outcomes oDistinguish between Java Applications and Java Applets. oWrite applet programs that can load images and play.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 16 Applets and Multimedia.
 Pearson Education, Inc. All rights reserved Multimedia: Applets and Applications.
1 CA203 Presentation Application Creating a Multimedia Presentation Lecture # 10.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved L20 (Chapter 24) Multithreading.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved L05 (Chapter 16) Applets.
Software and Multimedia
CS4273: Distributed System Technologies and Programming I Lecture 3: Java Applets and Animations.
Computer Science [3] Java Programming II - Laboratory Course Lab 7: Multimedia: Applets and Applications Faculty of Engineering & IT Software Engineering.
Advanced PowerPoint Debi McGuire. Master Pages If you want to make a change that will affect the entire presentation such as layout or font, then you.
1 Chapter 2 & Chapter 4 §Browsers. 2 Terms §Software §Program §Application.
Chapter 15 Multithreading F Threads Concept  Creating Threads by Extending the Thread class  Creating Threads by Implementing the Runnable Interface.
Threads and Multimedia Animation, Images, Sound. Animation nAnimation, displaying a sequence of frames to create the illusion of motion, is a typical.
 2005 Pearson Education, Inc. All rights reserved Multimedia: Applets and Applications.
(c) 2008 E.S.Boese All Rights Reserved. Threads and Media Chapter 8 - Lecture Slides 1.
Applets Chapter 17.  Java’s big splash onto the scene came in the mid 90’s. The people at Sun Microsystems had managed to work java programs into Web.
Getting a video from the Internet Getting a video from the Internet (1 of 9) 1. Click the Web toolbar button on the Standard toolbar. 1.
XP Tutorial 8New Perspectives on HTML and XHTML, Comprehensive 1 Using Multimedia on the Web Enhancing a Web Site with Sound, Video, and Applets Tutorial.
Chapter 17: Applets, Images, and Sound. Objectives Learn about applets Write an HTML document to host an applet Use the init() method Work with JApplet.
Media in PowerPoint Learning Goal: Today you are going to explore how music and video can be added to a presentation.
Chapter 18 Networking F Client/Server Communications F Simple Client/Server Applications F Serve Multiple Clients F Create Applet Clients F Send and Retrieve.
Chapter 8 Introduction to HTML and Applets Fundamentals of Java.
XP Tutorial 8New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Using Multimedia on the Web Enhancing a Web Site with Sound, Video, and.
Tutorial 7 Working with Multimedia
Tutorial 7 Designing a Multimedia Web Site
Timer Objects  regularly generates action events at programmer-specified time intervals  Timer class is in javax.swing package  Timer (int delay, ActionListener.
 2000 Prentice Hall, Inc. All rights reserved. Java Multimedia: Images, Animation, Audio and Video Outline 30.1 Introduction 30.2Loading, Displaying and.
1 CSC Computer Education (P) Ltd. DESIGNED BY K PRAKASH,
Pravin Yannawar, DOCS, NMU Jalgaon Basic Java : Applets 2 Objectives of This Session Identify the need for Applets Distinguish between Applets and Applications.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 16 Applets and Multimedia.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved GUI: Applets and Multimedia.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Applets and Multimedia.
Chapter 6 Applets and HTML  Overview  HTML tags for Applets  Applet Life Cycle  Applet Class  JAR files.
Java Programming Working with Sound and Images. Topics Learn about the paint() and repaint() methods Learn about paintComponent() method Use the drawString()
Multimedia: Audio and Video Kyle Hawver. BGSOUND element Should be placed in the HEAD section of the HTML document Has 4 key properties: – SRC – URL of.
Game Art & Sound. Sound ● Midi files – Musical Instrument Digital Interface – Advantages ● small ● fast – Disadvantages ● synthesized ● rendered ● Wav.
Chapter 16 Multimedia F Audio Files F Playing Audio F Running Audio on a Separate Thread F Displaying Images F Displaying a Sequence of Images  Using.
Applets, Images, and Audio Chapter 14 CSCI CSCI 1302 – Applets, Images, and Audio2 Outline Introduction The Applet Class –The init Method –The start.
Chapter 12: Accessing the Web URL (Uniform Resource Locator) class Applet methods –for audio clips –for images –context interface.
1 Applets. 2 What is an applet? Applet: a Java program that can be inserted into a web page and run by loading that page in a browser brings web pages.
Multimedia Effects Adding Value to Presentation Content.
Introduction to Applets Chapter 21. Applets An applet is a Java application that is intended to be invoked and executed through a Web browser. Click Here.
Rina System development with Java Instructors: Rina Zviel-Girshin Lecture 10.
Microsoft® Small Basic Flickr, ImageList, and Network Objects Estimated time to complete this lesson: 1 hour.
Video 2 Subject:T0934 / Multimedia Programming Foundation Session:11 Tahun:2009 Versi:1/0.
Chapter 8 Adding Multimedia Content to Web Pages HTML5 & CSS 7 th Edition.
CHAPTER 8 Multimedia 1. Using Multimedia ❖ Multimedia: the combination of text, sound, and video to express an idea or convey a message. ❖ Podcasts: a.
Software and Multimedia
Software and Multimedia
Chapter 15 Multithreading
Java Programming COMP-417 Applet
APPLET PROGRAMMING.
Presentation transcript:

Chapter 14: Multimedia Audio Files Audio Files Playing Audio Playing Audio Running Audio on a Separate Thread Running Audio on a Separate Thread Displaying Images Displaying Images Displaying a Sequence of Images Displaying a Sequence of Images Using MediaTracker Using MediaTracker

Audio Files Audio is stored in files. Audio is stored in files. There are several formats of audio files. There are several formats of audio files. JDK 1.2 can play several audio file formats, including.wav and.au files. JDK 1.2 can play several audio file formats, including.wav and.au files.

Playing Audio play(URL url, String filename); play(URL url, String filename); Plays the audio clip after it is given the URL and the file name that is relative to the URL. Nothing happens if the audio file cannot be found. play(getCodeBase(), "soundfile.au"); play(getCodeBase(), "soundfile.au"); Plays the sound file soundfile.au, located in the applet’s directory. play(getDocumentBase(), "soundfile.au"); play(getDocumentBase(), "soundfile.au"); Plays the sound file soundfile.au, located in the HTML file’s directory.

Using Audio Clips public AudioClip getAudioClip(URL url); public AudioClip getAudioClip(URL url); public AudioClip getAudioClip(URL url, String name); public AudioClip getAudioClip(URL url, String name); Either method creates an audio clip. Specify String name to use a relative URL address. public abstract void play() public abstract void play() public abstract void loop() public abstract void loop() public abstract void stop() public abstract void stop() Use these methods to start the clip, play it repeatedly, and stop the clip, respectively.

Example 14.1 Incorporating Sound in Applets Objective: Display a running clock and play sound files to announce the time at every minute. Objective: Display a running clock and play sound files to announce the time at every minute. ClockAppletWithAudio Run Applet Viewer

Running Audio on a Separate Thread Objective: Avoid the conflict between painting the clock and announcing time in Example 14.1 by running the tasks on separate threads. Objective: Avoid the conflict between painting the clock and announcing time in Example 14.1 by running the tasks on separate threads. ClockAppletWithAudioOnSeparateThread Run Applet Viewer

Displaying Images Two methods are available for displaying images: Use the getImage() method to retrieve image files and create Image objects. Paint the images on the viewing area using the drawImage() method.

Example 14.3: Displaying Images in an Applet Objective: Display images in applets Objective: Display images in applets DisplayImageApplet Run Applet Viewer

Example 14.4: Using Image and Audio in Applets and in Applications Objective: Display images and playing audio in applets and in applications. Objective: Display images and playing audio in applets and in applications. ResourceLocatorDemo Run as an Applet Run as an Application

Example 14.5: Using Image Animation Objective: Simulate a movie by displaying a sequence of images in a control loop. Objective: Simulate a movie by displaying a sequence of images in a control loop. ImageAnimation Run Applet Viewer Note: Images may take several seconds to load.

Example 14.6: Using MediaTracker Objective: Use the MediaTracker class to load all the images before displaying them in a sequence. Objective: Use the MediaTracker class to load all the images before displaying them in a sequence. ImageAnimationUsingMediaTracker Run Applet Viewer Note: Images may take several seconds to load.