iBicha / UnityYoutubePlayer

Play YouTube videos in Unity
The Unlicense
336 stars 63 forks source link

Increase GetMetaData speed #62

Closed jeffries7 closed 2 years ago

jeffries7 commented 3 years ago

I'm wondering if there is any way to speed up getting video metadata? I'm trying to display metadata (title, description & duration) for multiple videos in a similar way to your playlist branch.

However, currently, it can take anywhere between 15-20 seconds to load all the relevant data. I've deployed my own instance on Heroku. Could this be faster if deployed on local hardware and not on Heroku? Or is it a software limitation?

Thank you for this plugin, it's amazing!

iBicha commented 3 years ago

It really depends on how you are doing this. If you are fetching metadata for each video with one request each, of course it will be slow. But you can fetch the data about a playlist with one request, but at the same time you will not get all the information about all the videos at once. In the playlist example, I'm using the --flat-playlist flag, which will only fetch information about the playlist, without a lot of details for each video. I used this flag specifically to make it fast to load the playlist info and display them on the UI. Take a look at the flags possible with https://github.com/ytdl-org/youtube-dl

iBicha commented 2 years ago

Hi, I've added the playlist PR to the latest release. As I said, the flat playlist does not seem to have all the info about each video (unless I'm doing something wrong) And for that you still might need to make a request per video. If you are targeting Desktop, you can use the local instance in the new package version, which might be a bit faster than a request to heroku. Let me know if this helps. Thanks