UnityYoutubePlayer icon indicating copy to clipboard operation
UnityYoutubePlayer copied to clipboard

How can i play FHD, UHD, 4K, 8K panoramic videos?

Open mhadji05 opened this issue 4 years ago • 6 comments

How can i play FHD, UHD, 4K, 8K panoramic videos?

In previous version i used this: var streamInfo = streamManifest.Video.LastOrDefault(s => s.VideoQualityLabel == "1080p60"

Now something changed. Please let me know..

mhadji05 avatar Jul 09 '21 15:07 mhadji05

See

YoutubePlayer.PlayVideoAsync(string videoUrl = null, YoutubeDlOptions options = null, CancellationToken cancellationToken = default)

YoutubeDlOptions is an object to specify options passed to youtube-dl, such as format (quality) and user agent.

  • The default for regular videos is best which is the highest video quality with both video and audio streams (usually at 720p)
  • The default for 360 is bestvideo[height<=?1080] which is the highest video quality with only the video stream, and smaller or equal to 1080p.
  • If you want to specify higher qualities, you might to set [ext=mp4] (e.g. bestvideo[ext=mp4]) so you don't get a webm file which Unity video player will fail to load.
  • See format for more details.

iBicha avatar Jul 09 '21 17:07 iBicha

Τo which script should I add this code to play a 1440s60 quality for 360 YouTube video for example?

mhadji05 avatar Jul 13 '21 18:07 mhadji05

PlayVideoAsync is a method on the YoutubePlayer Monobehaviour

iBicha avatar Jul 27 '21 01:07 iBicha

I cant play 360 video in 4k quality.

Can you please write a script for different qualities or maybe update with example scene?

Thanks in advance!

mhadji05 avatar Jul 27 '21 17:07 mhadji05

Thanks for the suggestion, I tagged this as a feature request (adding example scene with different qualities)

iBicha avatar Aug 08 '21 21:08 iBicha

It would be even more interesting if you could add the original feature of YouTube for auto quality setting depending on the speed of the internet connection.

mhadji05 avatar Aug 08 '21 22:08 mhadji05