FORUMS
Remove All Ads from XDA

[Q] Usage of Microsoft.Phone.Media.Extended

3 posts
Thanks Meter: 0
 
By kaspur, Junior Member on 5th December 2010, 09:50 AM
Post Reply Email Thread
I'm attempting to access the camera and its features through Microsoft.Phone.Media.Extended.dll, but am only coming up with COM errors. Any help would be appreciated.

PhotoCamera cam = new PhotoCamera(CameraSource.PrimaryCamera);

when I go into debugging mode and inspect "cam" it shows that most of its properties are null. Does anybody know how to initialize this?
 
 
5th December 2010, 11:54 AM |#2  
Senior Member
Flag Belfast
Thanks Meter: 33
 
More
You can only access the camera from the photo Chooser task:

http://msdn.microsoft.com/en-us/libr...(v=VS.92).aspx

Sent from my HTC HD2 using XDA App
5th December 2010, 04:31 PM |#3  
OP Junior Member
Thanks Meter: 0
 
More
Quote:
Originally Posted by Blade0rz

You can only access the camera from the photo Chooser task

Using the official SDK APIs yes, but I'm talking about Microsoft.Phone.Media.Extended.dll

There are more methods inside of this dll than is normally available to developers.
6th December 2010, 04:44 PM |#4  
Senior Member
Flag Sleaford, UK
Thanks Meter: 27
 
More
Have you granted yourself the necessary permissions? You need to add ID_CAP_CAMERA to gain access to the PhotoCamera class.
The Following User Says Thank You to hounsell For This Useful Post: [ View ] Gift hounsell Ad-Free
6th December 2010, 10:19 PM |#5  
sensboston's Avatar
Recognized Developer
Flag Boston, MA
Thanks Meter: 762
 
Donate to Me
More
Quote:
Originally Posted by kaspur

I'm attempting to access the camera and its features through Microsoft.Phone.Media.Extended.dll, but am only coming up with COM errors. Any help would be appreciated.

How did you get it load to solution? I getting error:

Code:
Could not load file or assembly 'Microsoft.Phone.Media.Extended, Version=7.0.0.0, Culture=neutral, PublicKeyToken=24eec0d8c86cda1e' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)
7th December 2010, 06:05 PM |#6  
Junior Member
Thanks Meter: 0
 
More
You need to get the file from phone image. When you got it, you can reference it in your windows phone project.
To allows compiling your project you will need to remove the strong name check on media.extended.dll (in a visual studio command prompt sn -Vr pathto.dll)
Restart Visual Studio and you should be able to build your project
7th December 2010, 06:59 PM |#7  
Senior Member
Bellevue, WA
Thanks Meter: 48
 
More
sn -Vr just whitelists the assembly on your PC. Why are your assemblies broken to begin with? All my GAC libraries work without errors (when referencing them). I suggest you work on extracting clean files.

With regards to COM -- what are the exceptions?
7th December 2010, 08:23 PM |#8  
sensboston's Avatar
Recognized Developer
Flag Boston, MA
Thanks Meter: 762
 
Donate to Me
More
Quote:
Originally Posted by titaye

You need to get the file from phone image. When you got it, you can reference it in your windows phone project.
To allows compiling your project you will need to remove the strong name check on media.extended.dll (in a visual studio command prompt sn -Vr pathto.dll)
Restart Visual Studio and you should be able to build your project

Thanks! I remove a strong name (now I have no exceptions at design time) but the app doesn't load. Stack trace:
Code:
'taskhost.exe' (Managed): Loaded 'mscorlib.dll'
'taskhost.exe' (Managed): Loaded 'System.Windows.RuntimeHost.dll'
'taskhost.exe' (Managed): Loaded 'System.dll'
'taskhost.exe' (Managed): Loaded 'System.Windows.dll'
'taskhost.exe' (Managed): Loaded 'System.Core.dll'
'taskhost.exe' (Managed): Loaded 'System.Xml.dll'
'taskhost.exe' (Managed): Loaded '\Applications\Install\AF30D7A5-21BB-480F-94CC-658A0DCE171A\Install\CameraTest.dll', Symbols loaded.
'taskhost.exe' (Managed): Loaded 'Microsoft.Phone.Media.Extended.dll'
'taskhost.exe' (Managed): Loaded 'System.SR.dll'
The thread '<No Name>' (0x166f19be) has exited with code 0 (0x0).
The thread '<No Name>' (0xecf0ade) has exited with code 0 (0x0).
The program '[371728818] taskhost.exe: Managed' has exited with code 0 (0x0).
I've already added <Capability Name="ID_CAP_CAMERA"/>, no luck. Seems like I'm missing some important part. Unfortunately guys who already had camera working doesn't like to share experience with community...
7th December 2010, 08:32 PM |#9  
sensboston's Avatar
Recognized Developer
Flag Boston, MA
Thanks Meter: 762
 
Donate to Me
More
Quote:
Originally Posted by WithinRafael

sn -Vr just whitelists the assembly on your PC. Why are your assemblies broken to begin with? All my GAC libraries work without errors (when referencing them). I suggest you work on extracting clean files.

Could you please post your dll's, test project and some instructions? I'm really curious to get video camera working.
8th December 2010, 03:04 AM |#10  
Retired Recognized Developer
Thanks Meter: 33
 
More
I'm able to get this working. The trick seems to be to create a CameraVisualizer, and then SetSource to your camera object. The camera is then shown in the CameraVisualizer. (This is as far as I've got)

Here's a sample: dl.dropbox.com/u/12359/Flashlight.zip

You'll need to follow the instructions here to add Microsoft.Phone.Media.Extended: thounsell.co.uk/2010/11/avoiding-reflection-adding-the-interopservices-library-to-the-wp7-sdk/
8th December 2010, 06:19 AM |#11  
sensboston's Avatar
Recognized Developer
Flag Boston, MA
Thanks Meter: 762
 
Donate to Me
More
Thank you, perfect, get it works!
Attached Files
File Type: zip Flashlight.zip - [Click for QR Code] (244.0 KB, 2991 views)
The Following 6 Users Say Thank You to sensboston For This Useful Post: [ View ]
Post Reply Subscribe to Thread

Tags
camera, phone.media.extended

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes