Anyway To Stream YouTube Videos Ingame?

My question is as descriptive as it can be. But ill elaborate still. I would like to have a sort of media player in-game that can take pasted YouTube links and play them right there in-game on a virtual screen. There seems to be no offered direct methods as far as I can find online.

I know its possible. I’ve watched some older UE4 streams where its mentioned that YouTube support is planned. Years later, its still not. Even some games like Tower Unite managed to figure this out. I have of course tried contacting them first, but they are very difficult to communicate with. I’ve gotten nowhere.

1 Like

Yes, it’s possible. At least this is sort of a workaround:

  • Go to Plugins > Widgets and enable the web browser. Here’s the link to the documentation.
  • Now, create an UMG widget and from the list of components on the left, drag the browser widget in there.
  • Set the default URL to YouTube where VIDEOID is the ID you need. The watch_popup will ensure the video renders full screen (but you may still have the URL bar on top).
  • Then, since you want it in-game, you have to make a 3D widget by right clicking in your content browser > blueprint class. Choose actor.
  • Inside this actor, add a component called Widget. Compile your blueprint.
  • Inside this actor, click on the widget and on the right side, choose your widget in Widget Class. Compile and Save.
  • Drag your actor in your level and you should see your youtube.

Some tips:

  • A 3D widget is single-sided by default so you may need to rotate it to see the result
  • Also ensure the dimensions are set properly either in the widget or in the 3D widget (actor) to get the full screen.
  • You could get rid of the URL bar (if there’s one) from the browser, by positioning that part out of the canvas panel of your widget. Perhaps there’s even an option to disable it but it’s been some time I played with it.
  • If the video doesn’t play automatically, you could try adding ?autoplay=1 to the youtube URL
  • You can also make your scene interactable. Here’s more info. You could also make a small menu 3D widget with a choice of videos to play inside the 3D widget (since there’sa load URL node available for this widget).
  • Make sure you have a fallback (e.g. by playing offline movie) when your network connection fails.
4 Likes

Apologies, wanted to keep it open a little longer to see if there were any direct methods. But I suppose this is the one and only way without some kinda expert html coding. Current issue with the makeshift method is video scaling and resolution. It doesn’t manage to have correct proportions.

Hi,

Did this solve your problem? Please indicate as answered so the post doesn’t stay open for unlimited amount of time.

When i package project with pixel streaming. Unable to hear audio on client machines. the audio works only on the machine where the exe runs i.e. the server

1 Like

Hey!
Any solutions?

Hi thank you for the detailed explanation with this. I have successfully made a Youtube video play in my level automatically using this method in 4.26 (with interactions as well). However in UE5.0.0 I can’t get it to play automatically and the interaction doesn’t work either. Even when I tried it with the basic google homepage. Is this something that was done deliberately? Or can it be looked at in the coming updates? Thank you for your on going support

3 Likes

It is now August 27, and we are also looking for a solution and/or an update to this?

Anyone???

Probably just create a c++ class to get the file, and a widget to play the media you get back.

The web browser thing should have been discontinued, so your options are kinda limited.

Thanks for the reply, what do you mean that the “web browser thing should have been discontinued”? Can you point me to any details? You are listed as a Marketplace Creator, have you created something and/or can create something to play YouTube videos in a UE5 Browser window?

I did a quick YouTube video showcasing this problem and would greatly appreciate any help … UE5 Pixel Streaming NO YouTube Audio - YouTube

Hi, were you able to replicate the url or the widget so that the server and clients could watch youtube links together?

No, still no YouTube audio with Pixel Streaming, only on the VM YouTube instance so far.

Well, it is now June 15, 2023 and we are still looking for a solution to NO YouTube Audio over Pixel Streaming with UE5 … EPIC Staff or anyone ??? How can Pixel Streaming NOT play YouTube Audio when it CAN PLAY YouTube video - via the standard YouTube Web based player so INCREDIBLY rich and vibrant ???

I mean… its called Pixel Streaming not AudioVisual streaming.

Why can’t you just stream the 2 things separately?

So, I like your humor, but YouTube is Video + Audio in a .MP4 integrated format. Is there a technical reason that Audio plays great on the VM but NOT on the remote Pixel Streaming users sessions? Watching YouTube Video with NO Audio is like watching “paint dry” !

BTW, thx for even the reply … I thought I missed some big event where YouTube - with billions of hits per day - somehow became irrelevant ???

OOps … Billions of MINUTES consumed every day !

Is probably the problem/issue.

You can instruct the engine to play the audio stream off the MP4 with other systems.
Also, the youtube stream likely isn’t just an MP4. Check on that before assuming it is as it could need to be handled differently.

Again, since the engine removed the built in web browser features/support, you wont be able to easily widget in the video.

If you were not to rely on pre-built stuff, then you will likely need to re-create a stream reader to read the data and allow its playback.
You should be able to find C++ examples of how to do this with a simple google search.

Almost none of the basic I/O stuff is licensed or restricted in any way, so creating your own “copy paste” solution should really be trivial here…

I really do appreciate your updated information. You wrote that the engine “removed the built in web browser features/support”? We are currently using the standard UE Browser for all kinds of standard HTML5 web pages and literally everything plays fabulously. Even, all aspects of the YouTube player app PLAYS everything like a Chrome Browser plays. Every feature of YouTube just plays in the UE5 Browser widget. It’s ONLY the YouTube audio that has not played but it plays on the VM perfectly fine.

My lead dev said we are using a UE5 “experimental web browser on UE5.2” in case that is different? What I can say is that this Web Browser runs everything we can throw at it, that is any web content, EXCEPT NO audio over Pixel Streaming. So, maybe their experiment does not yet support “audio” over Pixel Streaming. Also YouTube appears to have switched to VP9 and AV1

Just in case it might be useful for anyone.
It is againgst the rules to play YouTube videos out of YouTube apps. To stream without resctricitons, you need the direct video URL. To get direct video streaming URL, you need to host your video content into a server and create video streaming URL. HISPlayer now includes Video Upload & Hosting solution that allows you to host your local videos and convert them into HLS or DASH streaming URLs. You can then play those video URLs anywhere inside Unreal projects.