Youtube player no longer working for Windows Phone

Sep 15, 2012 at 9:09 AM

Hi,

I have been using this toolkit for a few months and I noticed last night the player had stopped working. I assume Youtube have put something in to try stop this, the message the player returns is "Sorry, we can't play this file on your phone."

I saw that this discussion mentions the GetVideoUriAsync method having a similar issue.

Thanks

Coordinator
Sep 15, 2012 at 8:49 PM
Edited Sep 15, 2012 at 8:50 PM

I've found the problem: YouTube has added a new parameter (signature). This parameter has to be read and added to the MP4 url. I've fixed the YouTube class. You can get the latest version by downloading it over Codeplex or using Subversion (not in NuGet yet). Please let me know if it is working for you now.

Best regards
Rico Suter

Sep 15, 2012 at 9:15 PM

Hi

That has fixed the problem, it can now play the video. However before the video starts playing a messagebox is shown first saying "This video could not be played" - once you press ok, the video plays.

Thanks

Coordinator
Sep 15, 2012 at 9:28 PM
Edited Sep 15, 2012 at 9:31 PM

Is this your "own" text box? Maybe you always show an error message. Your code should look like this: 

 

YouTube.Play(youTubeId, true, YouTubeQuality.Quality480P, ex => {
	if (ex != null)
	{
		MessageBox.Show(...);
	}
});
Sep 15, 2012 at 10:01 PM

Thanks for that, I never before checked for ex != null, so possibly something had changed to cause it to be thrown now. Anyway everything is working again now.

Sep 16, 2012 at 1:46 PM

I don't think this is a good idea having to add an if-statement.  If you're calling an action to deal with an exception, i don't see a need or how a null should ever get passed to the action.  a catch block would never get a null exception.

Coordinator
Sep 16, 2012 at 8:18 PM

This is not an error callback but a completed callback (see the second code snippet http://mytoolkit.codeplex.com/wikipage?title=YouTube). Sometimes it is needed to know that the movie has been loaded (to hide the loading bar).