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 Youtube videos?

Discussion in 'Audio & Video' started by mikelowefedex, Nov 12, 2020.

  1. mikelowefedex

    mikelowefedex

    Joined:
    Sep 29, 2020
    Posts:
    139
    Hello,
    I was wondering if there is an easy way to provide a URL link to a Youtube video, and have it converted to a material that can be used on a game object. I already tried copying an pasting the URL link from Youtube and set the source to URL, but it doesn't work. Can I also do that for livestream videos? Thank you.
     
  2. Cody-Rauh

    Cody-Rauh

    Joined:
    Oct 12, 2013
    Posts:
    256
    From my understanding, the link needs to be/end with .mp4 for Unity to use it. The problem with the link converter methods I have found is that the link for some reason breaks at times when Youtube updates.

    I am also unable to find good documentation/solutions regarding an API approach and many of the asset store products are afflicted with the same problem according to their product reviews. The previous way would have been to create a .js or .HTML file within Unity and reference your public classes, however, Unity did away with support for that a couple of years ago to the best of my memory.

    When it comes to the Unity forums these days it also feels like most of the answers, answered are basic problems any tutorial could answer, and there is a 50% chance that people responding in forums will also chastise them for not Google searching more thoroughly.

    Most things not immediately obvious or available through a Youtube tutorial seems to go unanswered, and I am going to guess for the most part the forums and discord are primarily the blind leading the blind.
     
  3. mikelowefedex

    mikelowefedex

    Joined:
    Sep 29, 2020
    Posts:
    139
    I can put downloaded video on a material. Why not also make a way to 'livestream' data to a material?
     
  4. nhasson76

    nhasson76

    Joined:
    May 5, 2014
    Posts:
    2
    You'll have to find a decent parser library, and as you said, keep it updated every time YouTube changes their internal API.
    This one looks pretty decent:
    https://github.com/omansak/libvideo

    Once you'll have it you'll need to select the desired URL and use it with your favorite video player.
     
  5. Cody-Rauh

    Cody-Rauh

    Joined:
    Oct 12, 2013
    Posts:
    256
    Yeah, just wish every time Youtube updated, they didn't break the connections between video and app. You don't see websites breaking search engines every time they update.