MerlinVR / USharpVideo

A basic video player made for VRChat using Udon and UdonSharp
MIT License
322 stars 43 forks source link

Add support for custom http headers #18

Closed Lee-7723 closed 3 years ago

Lee-7723 commented 3 years ago

i find in most cases, i need both video url and specific http request headers to get the video. for example direct video url for Bilibili.com needs both "referer: https://www.bilibili.com/" and "user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.72 Safari/537.36 Edg/90.0.818.39" to be included in the request header. and also, for video in Onedrive and Aliyundrive need cookie and referer, so can you add support for custom http headers? or in current version can i modify it during develop to be some specific string? (i dont make world myself so i havent tried yet, sry for this dumb question)

MerlinVR commented 3 years ago

This is outside the scope of the abilities of video players in VRC, and it's outside the scope of VRC. This is something that you would need to add handling for in YouTubeDL which is what VRC uses to resolve video URLs. All that video players can do from Udon's side is request a URL, there is no way to customize HTTP headers.

If bilibili does not work due to incorrect HTTP headers, that is something you should make an issue YouTubeDL since they do have support for bilibili. However, before you do that you should verify that the latest version of YouTubeDL works on the websites you're having trouble with. bilibili videos resolve their URL's correctly in my testing, however they usually provide flv video by default which isn't supported by Unity's video player. OneDrive and Aliyundrive are not supported by YouTubeDL according to their supported sites list https://ytdl-org.github.io/youtube-dl/supportedsites.html