5
\$\begingroup\$

How can I play a YouTube video in Unity if given the YouTube URL link? I am using 2019.4.13

Is there a way to open webpages?

\$\endgroup\$
2
  • 1
    \$\begingroup\$ It depends on platform (not every platform is supported by some plugins). There are a few plugins that can do that: e.g. github.com/gree/unity-webview \$\endgroup\$
    – Sergio
    Commented Jan 19, 2021 at 9:50
  • \$\begingroup\$ I actually am noodling on this problem right now, and wrote a little test of playing a Youtube video on a Video Player component. Thing is, I'm not sure if getting the mp4 URL the way I did is kosher (felt pretty hacky while I was doing it) so I'm gonna refrain from posting that as an answer. \$\endgroup\$
    – jhocking
    Commented Jan 19, 2021 at 21:36

1 Answer 1

2
\$\begingroup\$

Unity can't play youtube videos out of the box. Youtube generally doesn't support streaming of videos outside of YouTube itself (or an iframe with the YouTube player widget within another website).

There are tools that download youtube videos, however these violate YouTube's terms of service so I would not recommend using them.

\$\endgroup\$
7
  • \$\begingroup\$ I recall AudioShield used to let you play a YouTube video in-game to use its audio track for the gameplay, but subsequently patched-out that feature. I'd suspect terms of use or API limitations might have been a factor there. \$\endgroup\$
    – DMGregory
    Commented Jan 20, 2021 at 15:54
  • \$\begingroup\$ Yeah, that's my thinking as well. \$\endgroup\$
    – tbkn23
    Commented Jan 20, 2021 at 16:01
  • \$\begingroup\$ I'm pretty sure downloading a YouTube video is a violation of it's terms of service. I can double-check and come back. \$\endgroup\$ Commented Jan 20, 2021 at 16:15
  • 1
    \$\begingroup\$ The following restrictions apply to your use of the Service. You are not allowed to: access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as expressly authorized by the Service; or (b) with prior written permission from YouTube and, if applicable, the respective rights holders; \$\endgroup\$ Commented Jan 20, 2021 at 16:18
  • 2
    \$\begingroup\$ @FluffytheTogekiss thanks for the verification. I edited my answer to reflect this (and removed the link to the tool since it violates those terms) \$\endgroup\$
    – tbkn23
    Commented Jan 20, 2021 at 16:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .