1
votes

I am developing windows 8 application using YouTube API and C#. Now i need to display the same error message what youtube player displays on video failed. For example like this,

enter image description here

Is there any API query available to get this error message or any other best way to done this...??

Thanks in advance.

2

2 Answers

0
votes

I don't think you can get the actual text of the message like that, but you can tell when it's been triggered; use the gdata feed for the video and specifically search for the media:restriction element, like this:

http://gdata.youtube.com/feeds/api/videos/zYNNPfuAHa4?fields=media:group/media:restriction

It will give you a list of countries where the above error message would be triggered; something like this:

<entry xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
<media:group>
<media:restriction type="country" relationship="deny">PR GU VI CA DE US UM AS MP PM</media:restriction>
</media:group>
</entry>
0
votes

If you're playing back YouTube content from your application, you should be using one of the official YouTube players (like the iframe embedded player), in which case the player itself will take care of handling playback restrictions and displaying UX messages.