soverflow88 soverflow88 - 3 years ago 81
Javascript Question

How to handle youtube error messages with specific image or text?

There are some youtube videos like :


  1. which are deleted

  2. some videos are not accessible in some regions

  3. youtube is not accessible in some regions

  4. Or might be some other problems.

  5. There is no network connection right now (Retry).

  6. Please check your network connection (Retry).

  7. Error loading. Tap to retry.

  8. Error loading. Tap to retry.

  9. 500 Internal Server Error.

  10. No Connection.



Right now, in my application if something is wrong with youtube videos, something went wrong error message is displaying. Any way to replace these error message with specific image or any text?

Answer Source

Look at https://developers.google.com/youtube/js_api_reference#onError

101 – The owner of the requested video does not allow it to be played in embedded players.

So, depending on error code you do whatever you want.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download