Not specifically babylon question but related and probably of interest to many :
Is it possible to get the MP4 stream of a Youtube video and use this as video texture in Babylon? I have seen several CSS3DRenderer based examples but like to stay away from this as I have a rather complex scene. Any suggestions?
Via Google API (need app key etc) I can get the metadata of a YT video (made a node server API endpoint for this, using the YT video ID). This provides me with a long json with several ‘formats’ and the actual mp4 stream URLs, like this one:
But when assigning to a video texture, I get a CORS error:
Access to video at 'https://rr5---sn-gqn-vu2e7.googlevideo.com/videoplayback?expire=1667253227&ei=i.....' from origin 'https://...my domain ..' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
However, I can open this link directly in the browser and see/hear all fine.
No browser (without security restrictions removed) would let you do this at the moment. The proxy server could work but you should be careful with the risk involved and the egress cost of transferring so much data
to close this question: HLS.js works fine.just find the m3u8 stream url from youtube and create a video player with hls. all rest is same as normal video texture, incl html5 media/video events like metadataloaded, canplay, etc.