Hello.
So i ran into this problem. I’m making my own custom youtube playlist player inside unity which i know isn’t a good engine to do this in, but i’m so used to it i just don’t want to try anything else. What i don’t like in youtube’s playlist player is that it doesn’t have a randomize option that won’t repeat the same videos. I want it to go through the list, make a random order every time but to not repeat the videos until it goes through all of the videos. Okay that much about useless info, let’s get to the point.
So, so far i got the basic code. I’m collecting urls from a .txt file and storing them inside a list of strings, and then i have some more code to actually open these links randomly and to delete the ones that were already played off the list. The problem is though, to actually play the next video you have to go back inside the game view and press a button and it will open the next one. But what i want is for it to either do it automatically after the video is finished, which i think would require either youtube API which i find complicated to implement into my project. Or some kind of web API to check when the video is finished in order to play the next one right ? That could work but i have no idea where to start. Another method which i wouldn’t mind to have in replacement from previous is to have a hotkey that will open the next song while i’m not focused onto the game view. Of course, unity’s input system only listens to inputs while you’re focused onto the game view, the game window.
So, what would be the best solution for either of these methods. With the 2 hour research i did, i found nothing helpful. Thanks in advance.
Hope i’m allowed to bump
I would also be interested in knowing if this was possible. A quick search didn’t show me anything on this topic accept some network stuff which isn’t what I was thinking.
Have you got the Run In Background option checked in the Player Settings?
Never new about that thanks! It also seems you can set this via script too, which is very useful.
That allows me to collect input while i’m focused on some other window ?
I tried enabling this through code. It doesn’t work. “Application.runInBackground = true”. Maybe i need an actual build ? I’m running it in unity.
You probably need to have it in the build, as in the editor it doesn’t use Player Settings.
Hmm… Alright i’ll try it and let you know
Yeah it doesn’t work mate.
…
Would be sweet to add and android remote for youtube on the computer…
I did a deeper research on the youtube API. And guess what, they require .NET 4.5 which unity doesn’t support -.- This engine sometimes…
Bump…