716-0XXXX-123_Advanced Java App Dvlpt for the BB

Advanced Java Application
Development for the
BlackBerry Smartphone
Trainer name
Date
© 2009 Research In Motion Limited
Agenda
In this course, you will cover the following topics:
– Introduction to advanced mobile application
development for the BlackBerry® smartphone
– Application control for mobile devices
– Optimization for mobile application development
– Advanced BlackBerry user interface
– Introduction to multimedia application development
for the BlackBerry smartphone
– Understanding push technology
© 2009 Research In Motion Limited
Agenda
In this course, you will cover the following topics:
– Understanding client/server push
– Introduction to developing Bluetooth® applications
for mobile devices
– Developing secure applications
© 2009 Research In Motion Limited
Advanced Java Application Development for the BlackBerry
Smartphone
Objectives:
– Explain the importance of playing media within a
media application
– Create a media application
– Play media in a BlackBerry smartphone application
– Discuss the use of media events
– Send and receive media events
– Discuss audio routing
© 2009 Research In Motion Limited
Advanced Java Application Development for the BlackBerry
Smartphone
Objectives:
– Create an application that records audio
– Identify supported audio and video formats
– Identify optimal settings for audio and video on
BlackBerry smartphones
© 2009 Research In Motion Limited
Introduction to multimedia application
development for the BlackBerry
smartphone
© 2009 Research In Motion Limited
Playing media
You can choose to play media in your BlackBerry
smartphone applications in several ways:
– Create a media application that can play a variety of
media types and formats
– Play media using the BlackBerry Browser
– Play media using the BlackBerry smartphone media
application
© 2009 Research In Motion Limited
Playing media
– You can create a media application by using the API
items in the javax.microedition.media (JSR 135)
package that :
– plays a sequence of tones
– plays media from a web address
– plays media from an input stream
– plays streaming media
– displays a video in a field
– displays an image from the camera viewFinder
© 2009 Research In Motion Limited
Playing media using the BlackBerry Browser
– Your BlackBerry application can play media in the
BlackBerry Browser by using the methods of the
Browser class and BrowserSession class
© 2009 Research In Motion Limited
Playing media within a media application
– Use the media application to play media that is:
– stored on a local device
– streamed from a remote device
– both local and streamed media.
© 2009 Research In Motion Limited
Playing media using the BlackBerry
Browser
© 2009 Research In Motion Limited
Playing media using the BlackBerry Browser
– Use the methods of the Browser class and
BrowserSession to play media:
• Playing audio
• Playing video
© 2009 Research In Motion Limited
Playing media in the BlackBerry
smartphone Media application
© 2009 Research In Motion Limited
Playing media in the BlackBerry smartphone Media
application
– Start the Media application with or without content
– Streaming data from a remote source to the Media
application
© 2009 Research In Motion Limited
Playing media within your Media
application
© 2009 Research In Motion Limited
Playing media within your Media application
Accessing stored media
– Accessing media on a BlackBerry smartphone
– Accessing media on a microSD card
© 2009 Research In Motion Limited
Playing media within your Media application
Streaming media in a BlackBerry device application
– Buffer and play streamed media
• create a custom class that extends
javax.microedition.media.protocol.DataSource
to customize how data is read
• DataSource provides a SourceStream
implementation
© 2009 Research In Motion Limited
Creating a media player
© 2009 Research In Motion Limited
Creating a media player
– Use javax.microedition.media (JSR 135)
package to play audio
– A media application must be created first and then
have functionality added.
© 2009 Research In Motion Limited
Playing media in a BlackBerry
smartphone application
© 2009 Research In Motion Limited
Playing media in a BlackBerry smartphone
application
– Use javax.microedition.media (JSR 135)
package to play audio
– Provides methods to manage media application
and control the playback
© 2009 Research In Motion Limited
Playing media in a BlackBerry smartphone
application
– An object of a class that implements the Player
interface can be in one of five states:
• UNREALIZED
• REALIZED
• PREFETCHED
• STARTED
• CLOSED
© 2009 Research In Motion Limited
Playing media in a BlackBerry smartphone
application
– Changing the state of a Player
– Playing media in a BlackBerry application
© 2009 Research In Motion Limited
Receiving and sending media events
© 2009 Research In Motion Limited
Receiving and sending media events
– Use javax.microedition.media (JSR 135)
package to listen for and send media application
events:
• Listen for changes to the state of the media
application
• Send the media application event to the
registered PlayerListener
© 2009 Research In Motion Limited
Routing audio
© 2009 Research In Motion Limited
Routing audio
– Use the AudioPathControl API to play back and
record audio
– Supported audio paths:
• Bluetooth--AUDIO_PATH_BLUETOOTH
• A2DP--AUDIO_PATH_BLUETOOTH_A2DP
• Handset--AUDIO_PATH_HANDSET
© 2009 Research In Motion Limited
Routing audio
– Supported audio paths:
• Handsfree--AUDIO_PATH_HANDSFREE
• Headset--AUDIO_PATH_HEADSET
• Headset Handsfree-AUDIO_PATH_HEADSET_HANDSFREE
© 2009 Research In Motion Limited
Recording audio
© 2009 Research In Motion Limited
Recording audio
– Two formats for recording audio:
• AMR (Default)
• 8 kHz mono-16-bit PCM
AMR
PCM
© 2009 Research In Motion Limited
Adaptive Multi-Rate
pulse code modulation
Supported audio and video formats
© 2009 Research In Motion Limited
Supported audio and video formats
– The BlackBerry smartphone Media application can
open the following types of media files:
• Videos
• Ring tones
• Pictures
• Music files
© 2009 Research In Motion Limited
Supported audio and video formats
BlackBerry Browser audio and video support
Support for web feeds
• BlackBerry® Device Software version 4.2 or later:
– RSS 0.9, 1.0, and 2.0
– Atom™
• BlackBerry Device Software version 4.2.2 or later:
– RSS enclosures
RSS
© 2009 Research In Motion Limited
really simple syndication
Supported audio and video formats
BlackBerry browser audio and video support
Support for web feeds
• BlackBerry browser displays media file based on
their type
• Steamed content is not stored
© 2009 Research In Motion Limited
Supported audio and video formats
BlackBerry browser audio and video support
Support for media streaming
• BlackBerry Device Software supports a wide
variety of formats, including the following (version
4.3 or later):
– Video: WMV, h.263
– Audio: MIDI, MP3, MP4, WAV
WMV
WAV
Windows Media Video
Wave
MIDI
© 2009 Research In Motion Limited
musical instrument digital interface
Supported audio and video formats
BlackBerry browser audio and video support
Support for media streaming
• Media streaming over HTTP or RTSP protocols
• Network gateway can limit streaming file size
• No file size limitations over Wi-Fi ®
HTTP
RTSP
© 2009 Research In Motion Limited
hypertext transfer protocol
real time streaming protocol
Supported audio and video formats
BlackBerry smartphone audio and video support
– There are specific codecs for audio and video for
each BlackBerry smartphone type.
– Some formats support RTSP
– Streaming requires BlackBerry Device Software 4.3
or later
© 2009 Research In Motion Limited
Summary
© 2009 Research In Motion Limited
Summary
– You can create an application that:
• Plays media in the BlackBerry Browser
• Plays media in the Media application
– You can also create an application that:
• Can play audio, video, and binary SVG content
• Record audio and video
• Send audio to a Bluetooth enabled headset
© 2009 Research In Motion Limited
© 2009 Research In Motion Limited
Legal Disclaimer
© 2009 Research In Motion Limited. All rights reserved. BlackBerry®, RIM®, Research
In Motion®, SurePress™ SureType® and related trademarks, names and logos are the
property of Research In Motion Limited and are registered and/or used in the U.S. and
countries around the world. All other trademarks are the property of their respective
owners. This documentation is provided "AS IS" and without condition, endorsement,
guarantee, representation or warranty, or liability of any kind by Research In Motion
Limited and its affiliated companies, all of which are expressly disclaimed to the
maximum extent permitted by applicable law in your jurisdiction.
© 2009 Research In Motion Limited