Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Science [3] Java Programming II - Laboratory Course Lab 7: Multimedia: Applets and Applications Faculty of Engineering & IT Software Engineering.

Similar presentations


Presentation on theme: "Computer Science [3] Java Programming II - Laboratory Course Lab 7: Multimedia: Applets and Applications Faculty of Engineering & IT Software Engineering."— Presentation transcript:

1 Computer Science [3] Java Programming II - Laboratory Course Lab 7: Multimedia: Applets and Applications Faculty of Engineering & IT Software Engineering Department WWW.PALINFONET.COM Eng.Omar Al-Nahal Eng.Omar Al-Nahal

2 b Loading, Displaying and Scaling Images b Animating a Series of Images b Loading and Playing Audio Clips b Playing Video and Other Media with Java Media Framework Multimedia: Applets and Applications

3 Loading, Displaying and Scaling Images  Classes Image and ImageIcon – used to load and display images b Displaying images Graphics method drawImage – used to draw image referenced by Image object (can be scaled)Graphics method drawImage – used to draw image referenced by Image object (can be scaled) ImageIcon method paintIcon can be used to draw image referenced by ImageIcon objectImageIcon method paintIcon can be used to draw image referenced by ImageIcon object b Loading images Applet method getImage loads an Image into an appletApplet method getImage loads an Image into an applet Applet method getDocumentBase returns location of applet’s HTML file on InternetApplet method getDocumentBase returns location of applet’s HTML file on Internet ImageObserver s receive notifications as Image is loaded and update image on screen if it was not complete when displayedImageObserver s receive notifications as Image is loaded and update image on screen if it was not complete when displayed b Java supports several image formats, including GIF, JPEG and PNG See Img-Example

4 Animating a Series of Images b Animation can be created by displaying a sequence of similar images  Timer object can be used to specify when each image is displayed  Timer objects generate ActionEvent s at fixed intervals Method start – Timer should start generating eventsMethod start – Timer should start generating events Method stop – Timer should stop generating eventsMethod stop – Timer should stop generating events Method restart – Timer should start generating events againMethod restart – Timer should start generating events again  Component method getPreferredSize determines the preferred width and height of a component  Component method getMinimumSize determines the minimum width and height of a component See Images-Example

5 Loading and Playing Audio Clips b Java programs can play and manipulate audio clips b Playing sounds in an applet Applet ’s play method – loads sound and plays onceApplet ’s play method – loads sound and plays once AudioClip ’s play, loop and stop methodsAudioClip ’s play, loop and stop methods Additional capabilities provided by JMF and Java Sound APIsAdditional capabilities provided by JMF and Java Sound APIs b Loading sounds in an applet Applet method getAudioClip – retrieves sound, returns reference to an AudioClipApplet method getAudioClip – retrieves sound, returns reference to an AudioClip Applet ’s play method loads soundApplet ’s play method loads sound b Supported file formats include Sun Audio file format, Windows Wave file format, MIDI file format

6 Loading and Playing Audio Clips See Playing Audio Example

7 Playing Video and Other Media with Java Media Framework b A simple video can concisely and effectively convey a great deal of information b JMF API enables Java programmers to play, edit, stream and capture popular media types b Supported file types include Microsoft Audio/Video Interleave, Macromedia Flash2 movies, MPEG-1 videos and QuickTime movies

8 Creating a Simple Media Player  Interface Player used to play video  Class Manager declares utility methods for accessing system resources to play and manipulate media  Manager method createRealizedPlayer obtains a Player for a specified media clip b Loading and playing video Player method getVisualComponent gets component that displays visual aspect of media filePlayer method getVisualComponent gets component that displays visual aspect of media file Player method getControlPanelComponent gets component that provides playback and media controlsPlayer method getControlPanelComponent gets component that provides playback and media controls Player method start begins playing media filePlayer method start begins playing media file

9 Creating a Simple Media Player See Media Player -Example

10 Internet and World Wide Web Resources b Internet and web resources for Java Media Framework http://java.sun.com/products/java-media/jmf/ –Download and documentation for JMF http://java.sun.com/products/java-media/ jmf/forDevelopers/ –Site for javax.media API descriptions b Downloadable image, audio, and video galleries Test your multimedia programsTest your multimedia programshttp://www.nasa.gov/gallery/index.htmlhttp://sunsite.sut.ac.jp/multimed/


Download ppt "Computer Science [3] Java Programming II - Laboratory Course Lab 7: Multimedia: Applets and Applications Faculty of Engineering & IT Software Engineering."

Similar presentations


Ads by Google