plugins/org.symbian.tools.wrttools.doc.WebDeveloper/html/GUID-E3D26890-581A-427F-8AFF-16081528A8B8.html
changeset 470 d4809db37847
parent 229 716254ccbcc0
equal deleted inserted replaced
469:4d198a32ac7d 470:d4809db37847
       
     1 
       
     2 <!DOCTYPE html
       
     3   PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
       
     4 <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
       
     5 information about media files stored on a device </title><script type="text/javascript">
       
     6       function initPage() {}
       
     7     </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
       
     8 information about media files stored on a device</h1><div>
       
     9 <p>The <a href="GUID-E5684FF0-28C9-4721-9421-6B9432087086.html#GUID-E5684FF0-28C9-4721-9421-6B9432087086">Media Management
       
    10 Service API</a> allows <span>widgets</span> to retrieve information about
       
    11 the media files stored in the Media Gallery of a device. You can use the Media
       
    12 Management Service to access information about the following types of media:</p>
       
    13 <ul>
       
    14 <li><p>Music</p></li>
       
    15 <li><p>Sounds</p></li>
       
    16 <li><p>Images</p></li>
       
    17 <li><p>Video</p></li>
       
    18 <li><p>Streaming media</p></li>
       
    19 </ul>
       
    20 <p>Using the Media Management Service, you can create <span>widgets</span>,
       
    21 such as a custom photo viewer or audio player, that display or otherwise incorporate
       
    22 media.</p>
       
    23 <div><h3>Accessing the API and supported methods</h3>
       
    24 <p>To create a <a href="GUID-04095E9A-50E7-4E5F-BD6F-71DA281A0080.html#GUID-04095E9A-50E7-4E5F-BD6F-71DA281A0080">service
       
    25 object</a> for the Media Management Service API, use <code>Service.MediaManagement</code> to
       
    26 identify the service provider and <code>IDataSource</code> to identify
       
    27 the supported interface:</p>
       
    28 
       
    29 <pre class="codeblock" id="GUID-98491C3C-31D9-4A23-B756-20FF90796184">var so = device.getServiceObject("Service.MediaManagement", "IDataSource");</pre>
       
    30 <p>The <code>IDataSource</code> interface provides the following
       
    31 methods:</p>
       
    32 <ul>
       
    33 <li><p><a href="GUID-39C0BA48-E615-41B1-84FF-D4D0C4597DAB.html#GUID-39C0BA48-E615-41B1-84FF-D4D0C4597DAB"><code>GetList()</code></a></p>
       
    34 
       
    35 <p>Use the <code>GetList()</code> method to retrieve information
       
    36 from a given service or data source on the device.</p>
       
    37 
       
    38 </li>
       
    39 <li><p><a href="GUID-4EBD83E1-B179-4F8B-93AB-4D58C5F749C3.html#GUID-4EBD83E1-B179-4F8B-93AB-4D58C5F749C3"><code>Cancel()</code></a></p>
       
    40 
       
    41 <p>Use the <code>Cancel()</code> method to cancel an ongoing asynchronous
       
    42 call. This method is valid for any asynchronous call made through the Media
       
    43 Management Service API.</p>
       
    44 
       
    45 </li>
       
    46 </ul>
       
    47 </div>
       
    48 <div><h3>Using the service in a widget</h3>
       
    49 <p>To access media file information using the Media Management Service
       
    50 API:</p>
       
    51 <ol>
       
    52 <li id="GUID-09408614-B079-437A-BF7C-1580105906C1-GENIDd0e8478"><a name="GUID-09408614-B079-437A-BF7C-1580105906C1-GENIDd0e8478"><!----></a><p>Create a service
       
    53 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>
       
    54 </li>
       
    55 <li id="GUID-C7877560-C290-4E7D-980C-D65D50DC5B4A-GENIDd0e8487"><a name="GUID-C7877560-C290-4E7D-980C-D65D50DC5B4A-GENIDd0e8487"><!----></a><p>Define the
       
    56 type of media about which you want to retrieve information.</p></li>
       
    57 <li id="GUID-C4DFB650-8BAD-4947-AE25-74DFCD52229C-GENIDd0e8491"><a name="GUID-C4DFB650-8BAD-4947-AE25-74DFCD52229C-GENIDd0e8491"><!----></a><p>Optionally,
       
    58 define how you want the results sorted.</p></li>
       
    59 <li id="GUID-03590B36-FFCA-4E39-A781-92080EE16B34-GENIDd0e8495"><a name="GUID-03590B36-FFCA-4E39-A781-92080EE16B34-GENIDd0e8495"><!----></a><p>Define a handler
       
    60 method to process the results.</p></li>
       
    61 <li id="GUID-B7AF643B-5587-40D5-A423-0EAF4D3A8DFF-GENIDd0e8499"><a name="GUID-B7AF643B-5587-40D5-A423-0EAF4D3A8DFF-GENIDd0e8499"><!----></a><p>Retrieve the
       
    62 media file information using <a href="GUID-39C0BA48-E615-41B1-84FF-D4D0C4597DAB.html#GUID-39C0BA48-E615-41B1-84FF-D4D0C4597DAB"><code>GetList()</code></a> together
       
    63 with <a href="GUID-C7C3B541-8D28-4DC6-9003-ECF57F26C608.html#GUID-C7C3B541-8D28-4DC6-9003-ECF57F26C608"><code>callback()</code></a>.</p>
       
    64 </li>
       
    65 <li id="GUID-76B47850-874B-4F80-9440-DB7E2A2B9477-GENIDd0e8512"><a name="GUID-76B47850-874B-4F80-9440-DB7E2A2B9477-GENIDd0e8512"><!----></a><p>Process the
       
    66 results in the handler method defined in step 4.</p></li>
       
    67 </ol>
       
    68 <p>For the complete source of a sample widget that demonstrates how to
       
    69 use this service, see <a href="GUID-B7297E44-2CCE-4098-807B-551684CF608E.html#GUID-B7297E44-2CCE-4098-807B-551684CF608E">the full example</a>.</p>
       
    70 </div>
       
    71 </div></div></div><div class="footer"><hr/><div class="copy">© Nokia 2009.</div></div></body></html>