Viewing files
The Application Manager's open() method can be used to launch viewers for common file types (.pdf, .doc, .jpg, etc.). When opening a file, you are simply calling the Application Manager's open() method on a target of unknown content type. The target can be web or file-based. If the Application Manager cannot determine the content type based on the file extension or http header, it will return an error.
Click here for an example of opening a file using the Application Manager.
Video and Audio
The built-in webOS media applications can be used to play stream or file-based audio or video content.
The audio player is launched using the Application Manager's open method with a target property of:
- https://[audio file URI]
- https://[audio file URI]
- rtsp://[audio file URI]
- file://[audio file location]
Click here for an example of launching the Audio player with a local file.
The video player can play or stream video content. Like the audio player, the video player is launched using the Application Manager's open method with a target property of:
- https://[video file URI]
- https://[video file URI]
- rtsp://[video file URI]
- file://[video file location]
Additional features supported by the video player but not the audio player include the ability to specify a title or thumbnail that is displayed while the video is loading.
Click here for an example of launching the Video player with a local file.
Palm has not yet released the Command Resource Handler Table, which will have a complete list of all supported video and mime types.
Launching other 3rd party applications
In addition to launching the included core webOS applications you can launch other 3rd party applications if you know their application ids and any required launch parameters. Palm has hinted that eventually webOS will support dynamic registration for resource handlers and broadcast services "to allow you to determine what applications are available and what services they offer at runtime."
If the launched application is already running, it will become maximized and put into the foreground view.
Click here for an example of launching a 3rd party application.
That covers viewers and players. Check back when Palm lifts the NDA on the SDK for the full Command Resource Handler Table which will help you make real decisions about file and application launching in your application.
In our next (Not Quite) Daily Tutorial, we'll check out System Services like location services, connection status, alarms, sounds, power management, system properties and time services! Follow us on Twitter or grab the www.webOShelp.net RSS feed to stay in the know.
Much of the information in this article was presented in Chapter 8 of Palm webOS by Mitch Allen.
0 Comments