kteem84
kteem84

Reputation: 61

Youtube video as texture on Unity3d Android app

I'm trying to render Youtube video onto Unity3d texture, through a plugin for Android.

1) Android MediaPlayer API can render video streaming with specific url onto a texture. But there's no official method to reveal streaming urls for Youtube videos.

2) YoutubePlayerView class in Youtube API lets me ignore how to play Youtube videos, but there's no way to render any Android View including YoutubePlayerView onto a Unity3d texture. (I succeeded to render a WebView onto another SurfaceView, but when load Youtube iframe source onto the WebView, video is not rendered to another one; Youtube Player UI components were rendered.)

Is there anyone have some idea to solve? Any kind of workaround will be ok.

Upvotes: 3

Views: 3509

Answers (2)

alvaro654
alvaro654

Reputation: 11

I was doing something like this with augmented reality. In my case I used a normal video player which you can play video files in a texture. What i did was use the direct link for the youtube video file (not youtube URL) instead of a local file link and it worked.

So you have to found the link to the youtube video file. It's easy with some libraries that you can find on internet. Also you can develop a web scraper to find it in the youtube URL html but its a more complicated option.

Upvotes: 1

Time for C Sharp
Time for C Sharp

Reputation: 11

I added YouTube integration to a client's Unity 3D app with this 3D web plugin for Android / iOS. In my case, I just added the prefab to my scene and loaded YouTube like this:

prefab.WebView.LoadUrl("https://youtube.com");

If you want just the video by itself, it looks like you could access it with this VideoTexture property.

Upvotes: 0

Related Questions