Title: Advanced Interactive Programming Graphics and Multimedia
1Advanced Interactive ProgrammingGraphics and
Multimedia
2Outline
- A quick overview on graphics
- Multimedia controls
- Multimedia MCI control
- ActiveMovie ActiveX control
- RealAudio ActiveX control
- Microsoft agent
- Animation control
- Programming multimedia controls in VB
3Graphics
- Two approaches to creating graphics in Visual
Basic - Graphical methods - the lowest primitive building
blocks - Graphical controls - These are like ordinary
Visual Basic controls which are placed on your
form and can be laid out interactively at design
time.
4Graphic Methods
- These are commands that enable you to draw
directly on to your form at run time. Examples of
these commands include - Print draw text on a form or control
- Pset sets the color of an individual pixel
- Point returns the color value of a specified
point - Line draws a line or rectangle, or filled box
- Circle draws a circle, ellipse, or arc
- Graphics methods can be used to draw on certain
objects including forms and picture boxes.
5Graphical Controls
- There are four standard graphical controls in VB
- Two of the controls, image and picture box
controls allow you to work with various image
files - While line and shape controls draw lines and
shapes on your forms (you can then change the
properties of these)
6Colours
- Color as RGB value
- Colour properties can be applied to graphical
controls and methods - Colour properties
- BackColor
- ForeColor
- BorderColor
- FillColor
7Multimedia MCI Control
8Media Control Interface (MCI)
- A high-level API for controlling multimedia
devices - An intermediate layer between system software,
application and hardware - Software developers write programs using MCI
- Hardware suppliers provide drivers supporting MCI
- No interactions between Software developers and
Hardware suppliers - Applicable in both programming languages and
scripting languages
9Multimedia MCI Control
- An ActiveX control to manage Media Control
Interface (MCI) devices - Allows programs to interact with any MCI-enabled
devices - Such devices include sound boards, CD-ROM drives,
audio players, video players and MIDI sequencers
10Multimedia MCI Control
- Once connected to a device, buttons are
automatically enabled for those supported - The control can be customised to display only
buttons supported - Programmable in several ways
- The control can be visible or invisible at run
time. - You can augment or completely redefine the
functionality of the buttons in the control. - You can control multiple devices in a form
11Multimedia Control Commands
- Use a set of high-level, device-independent
commands, known as MCI commands, to control
various devices.
12MCI Control Properties
13MCI Control Properties
14MCI Control Events
15Example MCI Control CD Player
- Use MCI control to control CD-ROM drive as an
audio CD player - The players GUI consists of three labels, three
textboxes and a MCI control
16Code
17Example MCI Control AVI File Player
- Use MCI control to play AVI (audio-video
interleave) files - The player GUI contains a MCI control and a
button
18Code for AVI File Player
19Microsoft ActiveMovie Control
20Background
- Based on Microsoft DirectShow - an extensible
media architecture, which defines how
applications can control and process time-stamped
multimedia data using modular components called
filters connected in a configuration called a
filter graph - DirectShow SDK, APIs and filters APIs are
available
21Example Microsoft MPEG Filter Graph
- A source filter to read the data off the disk
- A splitter transform filter to separate the video
and audio - A video transform filter to decompress the video
data - A video rendering filter to display the data on
the screen - An audio transform filter to decompress the audio
data - An audio rendering filter to send the audio data
to the sound card
22Microsoft ActiveMovie Control
- Enables an application to play video and sound in
many formats, including MPEG audio and video, AVI
video, WAV audio, MIDI audio, and Apple
QuickTime video. - The elements of the controls GUI is shown below
23Microsoft ActiveMovie Control
- The ActiveMovie control is programmable in
several ways - Each element can be shown or hidden.
- Each element can be enabled or disabled.
- You can augment or completely redefine the
functionality of the buttons in the control.
24ActiveMovie Control Properties
25ActiveMovie Control Methods
26ActiveMovie Control Events
27Example Media Player
- Use ActiveMovie control to play media in an
application - The application contains a CommandButton, a
CommonDialog and an ActiveMovie control
28Code for the Media Player
29Using ActiveMovie Control in HTML Pages
- Two ways to play media files on HTML pages
- Embedded in a Web page
- Externally in a window displayed outside or on
top of the page - Four ways to activate media playback using HTML
tags - OBJECT
- EMBED
- IMG DYNSRC
- A HREF in an external window
30RealPlayerRealAudio ActiveX Control
31Streaming Technology
- A technique for transferring data such that it
can be processed as a steady and continuous
stream. - The technology becomes increasingly important
because - Internet-based multimedia files or
multimedia-oriented applications are popular - Most users do not have fast enough access to
download large multimedia files quickly or the
storage to manage the files - With streaming, the client browser or
applications can start displaying the data before
the entire file has been transmitted.
32Streaming Technology
- Content creation, i.e. audio and video production
using various tools - Content encoding and authoring, i. e. how to
convert and encode live and on demand audio and
video files into the Internet accessible format
and files, usually in .ram file - Serving, i.e. the framework for content
management and URL construction, delivering
on-demand content, and live streaming over IP.
This is usually achieved through a Web server or
dedicated server - See the following web site for details
- http//www.realnetworks.com/resources/tutorials/i
ndex.html
33RealAudio ActiveX Control
- The control enables VB applications to receive
and play streaming audio and video clips over the
Internet
Image window will appear when the source is video
clips
34Position slider
Volume control
Information Summary
Internet congestion LED
Current position indicator
35Example Playing a Audio
- Set the source to http//delphi.about.com/library/
media/audio/IntroDel.ram - No need to coding
36Example Playing a Video Clip
- Set the source to http//play.rbn.com/?urlbps-out
bound/bps-outbound/demand/videoseries/smil/intro.s
milprotortsp - No need to coding
37Example Playing a Video Clip
38Microsoft Agent
- Microsoft Agent is a technology for creating and
using interactive animated characters in a
Windows application or Web page. - It enables software developers and Web authors to
incorporate a new form of user interaction within
the Microsoft Windows interface, known as
conversational interfaces, that leverages natural
aspects of human social communication.
39Microsoft Agent
- Microsoft Agent allows of application users to
interact with application using more natural
human communication techniques - Animated characters (agents) can be used as
interactive assistants to introduce, guide,
entertain, or otherwise enhance Web pages or
applications such as museum presenter
40Microsoft Agent
- With support for speech recognition, characters
can respond to voice commands using synthesized
speech, recorded audio, or recorded video clip,
etc. - With motion capture and recognition, agents can
even respond to gestures such as nodding,
pointing, etc. - http//www.microsoft.com/msagent/default.asp
41Microsoft Agent Control
- Provides access to three predefined characters
- Allows users to interact with applications
through the characters by mouse (pointing),
keyboard (textual input) and voice commands - The agent uses the icon at design time but will
display one of the characters at execution time
42Microsoft Agent
- Microsoft agent comes with a cast of three
characters Merlin, Genie, and Robby - It also includes tools for defining custom
characters using Microsoft Agent Character Editor
43Example Application
- Users can select and display a character from the
ComboBox - Users can type in text in the TextBox for a
character to speak - The CommandButton tell the selected character
when to speak
9-1
44Code for Initialisation
45Code for Initialisation
The show event calls an animation
46(No Transcript)
47Code for ComboBox and Speak Button
Actions by selecting an agent from ComboBox
Actions by clicking the speak button
48More Application Scenarios
9-1
49Code for Clicking, DblClicking and Drag and Drop
50Microsoft Agent Events
51Character Object Properties Methods
52Speech Output Tags
53Animation Control
- The Animation control allows applications to play
AVI file animations. - The AVI files should not have sound, and are
uncompressed or compressed using Run-Length
Encoding (RLE). . - At run time, the control does not have a visible
frame. - The control maintains a separate thread of
execution while it is playing. Therefore, your
application will not be blocked, and can continue
to execute within its process.
54Property and Methods
55Example Animation Player
- The player contains a CommandButton, a
CommonDialog and the Animation control
56Code for the Player
57Summary
- Extend your capability using many available
third-party multimedia ActiveX controls - For example, Shockwave Flash can be use to play
Flash movies (.swf files) - see some websites
- http//www.swiftsoft.de/activex.html
- http//activex.devdirect.com/ALL/Multimedia_PCAT_1
954.aspx