Can't resolve MyToolkit.Multimedia.

May 4, 2014 at 3:37 PM
Any suggestions? Any help would be greatly appreciated.

I just want to access MyToolkit.Multimedia.YouTube.GetVideoUriAsync to get a uri from my WPF MediaElement app.

I'm using VS 2010, with .Net 4.0

First I downloaded the assemblies package. Unzipped it. And added a reference to the dll in my project from
MyToolkit.Extended.Wpf40/MyToolkit.Extended.dll
The reference was added successfully.

Result: Visual studio could not resolve this code statement "using MyToolkit.Multimedia".

Then I downloaded NuGet because someone mentioned in another post, that you have to compile the source files to get VS to recognized the Multimedia namespace.

Result: NuGet wouldn't let me install the package. Error message below.

Install failed. Rolling back...
Install-Package : Could not install package 'MyToolkit 2.2.3.0'. You are trying to install this package into a project that targets
'.NETFramework,Version=v4.0,Profile=Client', but the package does not contain any assembly references or content files that are compatible with that
framework. For more information, contact the package author.
At line:1 char:1
  • Install-Package MyToolkit
  • ~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
    • FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
Coordinator
May 4, 2014 at 3:40 PM
I think .net 4.0 is no longer supported, can you upgrade to .net 4.5?
May 4, 2014 at 3:45 PM
No, VS 2010 does not support .Net 4.5. :-(
May 4, 2014 at 3:49 PM
Is the source code available as a zip file?
Maybe I can just extract the code needed for GetVideoUriAsync and compile it for .Net 4.0
Coordinator
May 4, 2014 at 3:50 PM
The problem is that enabling net4 in a PCL library forces the developer to use the "legacy" .net set. Maybe i can enable it in the lagacy pcl.. Ill try to do this soon. You may also try to use the vs express version or the yt source code directly...
Coordinator
May 4, 2014 at 3:52 PM
Check out this svn repo: https://xp-dev.com/svn/mytoolkit
May 4, 2014 at 3:54 PM
Yes, where can I get the YouTube source code? I don't expect you to spend time on legacy stuff just for me.
Coordinator
May 4, 2014 at 4:04 PM
I think you need:

https://xp-dev.com/svn/mytoolkit/Shared/Multimedia/YouTube.cs
https://xp-dev.com/svn/mytoolkit/Shared/Multimedia/YouTubeQuality.cs

But you have to check that the correct compiler flags are set (or remove the unused code).

Just checked the PCL library, I cannot support .NET 4.0 in the MyToolkit library as a lot of classes (e.g. ICommand) are not supported in this PCL profile.
I'm not sure if the classes run on .NET 4 as they use async/await...
Marked as answer by Theseus on 5/4/2014 at 8:14 AM
Coordinator
May 4, 2014 at 4:07 PM
Are you using .NET 4.0.3?
May 4, 2014 at 4:10 PM
Yes, .NET 4.0.3
May 4, 2014 at 4:14 PM
Thanks for these source code links. I think that should do the trick. Looks manageable.
Coordinator
May 4, 2014 at 4:19 PM
Ok, please inform me if and how you compiled it.. There's a .net 4 lib which i can extend then...
May 4, 2014 at 4:33 PM
Sure, I'll report back when I get it working. You can have the source code with any changes I make. Thanks again. :-)
Coordinator
May 4, 2014 at 6:44 PM
Does your visual studio support async/await? I have now a .NET 4 library version which works in VS2013 for me...
May 4, 2014 at 8:23 PM
I got it to compile with .Net 4.0 and VS 2010 -- but it took quite a bit of hacking. ;-)

async/await and HttpClient are new in .Net 4.5. So I had to gut those from the code.

The resulting code is not asyncronous, but in my case it's ok b/c I call it on a separate thread from the UI. It actually works nicely and I can feed the resulting http url to my media element. Plays perfectly on my primary display.

My only issue is that my app is for attaching a secondary display and playing the media element on that display. Trouble is the MP4 codecs that come with Windows freeze up when you try to play MP4 video on the secondary screen (most MP4s apparently contain Apple formats). You don't happen to know of a solid Windows codec that supports MP4s would you?

I don't know if you are interested in the hacked code. I removed all the windows phone methods since I don't need them and wanted to get it running asap. If you want the code, let me know.

And thanks for your help. I really appreciate it!! :-)
May 7, 2014 at 11:00 AM
Well, final notes:
I got it integrated into my .Net 4.0 app. You did a really nice job with this code, so thanks again for sharing it. Since I don't have access to async/await, I used Tasks with timeout waits to pull titles and urls. It's not as elegant but it works. I wrote a method to extract the Youtube Id from several forms of urls. If you want it for the library, let me know (it's trivial compared to your work :-).

I found the tweaks needed to play MP4s on a secondary display with MediaElement -- Tweaking codecs with KLite Tweak Tool. But 'streaming' Youtube videos still won't play on the secondary display (primary display works fine). There must be a magic setting in KLite somewhere. Will have to keep tweaking.

I see VLC media player will play Youttube videos. I wonder if that means that Google has stopped Bullying independent developers over their Terms of Service madness?