Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Media Management Service in WRT

From Wiki
Jump to: navigation, search
Article Metadata
Code Example
Source file: MediaMgmtSampleWgt
Installation file: MediaMgmtSampleWgt
Article
Created: ltomuta (28 Oct 2008)
Last edited: hamishwillee (23 Aug 2011)

Overview

This code shows all images (photos) in your phone and then uses the file location to create the image and display it to the user.

It is a modification of an example widget that has since been removed from the Web Developer's library (see article history for original URL).

The change I did was to the common.js file for showObject (obviously the change I did will only work if the file is an image so do not use this modified version with any other media type). Basically I take the location of the image on the D: or E: drive and in Javascript create an image and associate its src with the file location. It then displays to the user.

Source

// Build the message by reading a JS object in a recursive manner
function showObject( obj )
{
var txt = "";
try {
if ( typeof obj != 'object' )
return "" + obj + '<BR/>';
else {
for(var key in obj) {
if (key=='FileNameAndPath') {
var img = new Image();
img.src=obj[key];
txt += "<img src='"+img.src+"' border='0' /><br/>";
}
txt += key + ":";
txt += showObject( obj[key] );
txt += '<BR/>';
}
txt += '<BR/>';
}
}
catch (e)
{
alert("showObject: " + e);
}
return txt;
}

Download

  • The executable application that can be used to test the features described in this snippet is available for download at MediaMgmtSampleWgt.
This page was last modified on 23 August 2011, at 23:41.
29 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×