Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Video Detecting Video Play Failure?

Discussion in 'Audio & Video' started by Antistone, Feb 7, 2018.

  1. Antistone

    Antistone

    Joined:
    Feb 22, 2014
    Posts:
    2,836
    I am using Unity's VideoPlayer component to play a video from an URL. The URL is supplied at runtime, so there's a possibility it may point to a bad asset (e.g. someone trying to use a youtube URL). I want to be able to detect when this happens so that I can behave differently.

    So, I added a listener to the errorReceived event on the VideoPlayer.

    In my Android build, this seems to successfully detect this error case. But when running inside the editor, the event does not fire!

    In Unity's console, I get a WindowsVideoMedia error saying The byte stream type of the given URL is unsupported. But the errorReceived listener is not activated.

    Is this a Unity bug, or is there something else going on that I don't understand? Is there a workaround that will work on other platforms?