org.symbian.tools.wrttools.doc.WebDeveloper/html/GUID-E3D26890-581A-427F-8AFF-16081528A8B8.html
author Eugene Ostroukhov <eugeneo@symbian.org>
Thu, 15 Jul 2010 10:08:51 -0700
changeset 450 ed815e0eef9a
parent 229 716254ccbcc0
permissions -rw-r--r--
Bug 3268 - Debugger does not start on Windows XP


<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><meta name="copyright" content="(C) Copyright 2009"/><meta name="DC.rights.owner" content="(C) Copyright 2009"/><meta name="DC.Type" content="mobileconcept"/><meta name="DC.Title" content="Accessing information about media files stored on a device"/><meta name="DC.Relation" scheme="URI" content="GUID-2240F5BE-97BD-4CB3-8DB3-B5CF7C23BF54"/><meta name="DC.Relation" scheme="URI" content="GUID-CF55DBA3-2D4C-4FD0-8A06-862E6128F4E7"/><meta name="DC.Relation" scheme="URI" content="GUID-1EFD7043-E9B8-4B4E-9EA6-A20B3EECC14A"/><meta name="DC.Relation" scheme="URI" content="GUID-46EABDC1-37CB-412A-ACAD-1A1A9466BB68"/><meta name="DC.Format" content="XHTML"/><meta name="DC.Identifier" content="GUID-E3D26890-581A-427F-8AFF-16081528A8B8"/><title>Accessing
information about media files stored on a device </title><script type="text/javascript">
      function initPage() {}
    </script><link href="../PRODUCT_PLUGIN/book.css" rel="stylesheet" type="text/css"/><link href="css/s60/style.css" rel="stylesheet" type="text/css" media="all"/></head><body onload="initPage();"><div class="body"><div class="contentLeft prTxt"><h1 class="pageHeading" id="GUID-E3D26890-581A-427F-8AFF-16081528A8B8">Accessing
information about media files stored on a device</h1><div>
<p>The <a href="GUID-E5684FF0-28C9-4721-9421-6B9432087086.html#GUID-E5684FF0-28C9-4721-9421-6B9432087086">Media Management
Service API</a> allows <span>widgets</span> to retrieve information about
the media files stored in the Media Gallery of a device. You can use the Media
Management Service to access information about the following types of media:</p>
<ul>
<li><p>Music</p></li>
<li><p>Sounds</p></li>
<li><p>Images</p></li>
<li><p>Video</p></li>
<li><p>Streaming media</p></li>
</ul>
<p>Using the Media Management Service, you can create <span>widgets</span>,
such as a custom photo viewer or audio player, that display or otherwise incorporate
media.</p>
<div><h3>Accessing the API and supported methods</h3>
<p>To create a <a href="GUID-04095E9A-50E7-4E5F-BD6F-71DA281A0080.html#GUID-04095E9A-50E7-4E5F-BD6F-71DA281A0080">service
object</a> for the Media Management Service API, use <code>Service.MediaManagement</code> to
identify the service provider and <code>IDataSource</code> to identify
the supported interface:</p>

<pre class="codeblock" id="GUID-98491C3C-31D9-4A23-B756-20FF90796184">var so = device.getServiceObject("Service.MediaManagement", "IDataSource");</pre>
<p>The <code>IDataSource</code> interface provides the following
methods:</p>
<ul>
<li><p><a href="GUID-39C0BA48-E615-41B1-84FF-D4D0C4597DAB.html#GUID-39C0BA48-E615-41B1-84FF-D4D0C4597DAB"><code>GetList()</code></a></p>

<p>Use the <code>GetList()</code> method to retrieve information
from a given service or data source on the device.</p>

</li>
<li><p><a href="GUID-4EBD83E1-B179-4F8B-93AB-4D58C5F749C3.html#GUID-4EBD83E1-B179-4F8B-93AB-4D58C5F749C3"><code>Cancel()</code></a></p>

<p>Use the <code>Cancel()</code> method to cancel an ongoing asynchronous
call. This method is valid for any asynchronous call made through the Media
Management Service API.</p>

</li>
</ul>
</div>
<div><h3>Using the service in a widget</h3>
<p>To access media file information using the Media Management Service
API:</p>
<ol>
<li id="GUID-09408614-B079-437A-BF7C-1580105906C1-GENIDd0e8478"><a name="GUID-09408614-B079-437A-BF7C-1580105906C1-GENIDd0e8478"><!----></a><p>Create a service
object for the API using <a href="GUID-04095E9A-50E7-4E5F-BD6F-71DA281A0080.html#GUID-04095E9A-50E7-4E5F-BD6F-71DA281A0080"><code>device.getServiceObject()</code></a>.</p>
</li>
<li id="GUID-C7877560-C290-4E7D-980C-D65D50DC5B4A-GENIDd0e8487"><a name="GUID-C7877560-C290-4E7D-980C-D65D50DC5B4A-GENIDd0e8487"><!----></a><p>Define the
type of media about which you want to retrieve information.</p></li>
<li id="GUID-C4DFB650-8BAD-4947-AE25-74DFCD52229C-GENIDd0e8491"><a name="GUID-C4DFB650-8BAD-4947-AE25-74DFCD52229C-GENIDd0e8491"><!----></a><p>Optionally,
define how you want the results sorted.</p></li>
<li id="GUID-03590B36-FFCA-4E39-A781-92080EE16B34-GENIDd0e8495"><a name="GUID-03590B36-FFCA-4E39-A781-92080EE16B34-GENIDd0e8495"><!----></a><p>Define a handler
method to process the results.</p></li>
<li id="GUID-B7AF643B-5587-40D5-A423-0EAF4D3A8DFF-GENIDd0e8499"><a name="GUID-B7AF643B-5587-40D5-A423-0EAF4D3A8DFF-GENIDd0e8499"><!----></a><p>Retrieve the
media file information using <a href="GUID-39C0BA48-E615-41B1-84FF-D4D0C4597DAB.html#GUID-39C0BA48-E615-41B1-84FF-D4D0C4597DAB"><code>GetList()</code></a> together
with <a href="GUID-C7C3B541-8D28-4DC6-9003-ECF57F26C608.html#GUID-C7C3B541-8D28-4DC6-9003-ECF57F26C608"><code>callback()</code></a>.</p>
</li>
<li id="GUID-76B47850-874B-4F80-9440-DB7E2A2B9477-GENIDd0e8512"><a name="GUID-76B47850-874B-4F80-9440-DB7E2A2B9477-GENIDd0e8512"><!----></a><p>Process the
results in the handler method defined in step 4.</p></li>
</ol>
<p>For the complete source of a sample widget that demonstrates how to
use this service, see <a href="GUID-B7297E44-2CCE-4098-807B-551684CF608E.html#GUID-B7297E44-2CCE-4098-807B-551684CF608E">the full example</a>.</p>
</div>
</div></div></div><div class="footer"><hr/><div class="copy">© Nokia 2009.</div></div></body></html>