llealloo / audiolink

Audio reactive prefabs for VRChat
Other
354 stars 40 forks source link

Add YoutubePlayer editor-only component #202

Closed rrazgriz closed 1 year ago

rrazgriz commented 1 year ago

Adds an editor-only component for piping a Youtube video link to a Unity video player, which can then output to the AudioLink source. This makes it easy to test with different audio without downloading individual audio files. It's additive on top of an audio source.

I originally built this for Avatar AudioLink testing, and it's my hope that it will be included in an easy-to-download AudioLink testing package for Avatars. It runs both with and without the VRC SDK and Udon, so it can run in Avatar, World, and non-VRC projects.

It's designed and #define'd to only run on Windows for now. Currently, it looks for a yt-dlp executable from the user's VRChat install folder. If not, it offers to download it to a hardcoded path in the project. This could be changed to a different path, and probably should for the package build.

Things that need to be added:

Design

Uses code from the following sources: UnityYoutubePlayer, courtesy iBicha (SPDX-License-Identifier: Unlicense) https://github.com/iBicha/UnityYoutubePlayer/ USharpVideo, Copyright (c) 2020 Merlin, (SPDX-License-Identifier: MIT) https://github.com/MerlinVR/USharpVideo/

Unity_MUGeewq77n

https://user-images.githubusercontent.com/47901762/195599861-e9961fde-3fd0-4d53-add7-fd44b86a8b6b.mp4

pema99 commented 1 year ago

Is this ready for review? You have the PR on draft mode.

float3 commented 1 year ago

From prior conversations, there were a couple things we wanted to explore first like having this component on the AudioLinkAvatar prefab. Also I don't think the component should be named YoutubePlayer since ytdlp is compatible with a wide variety of websites. I wouldn't be opposed to ytdlpPlayer or something like that. Also I want to adjust this script so it can be used in standalone unity use cases (non-vrc). I also wanted to try getting this to work with Internet radio or add a different component for that.

pema99 commented 1 year ago

Leave the radio thing for another pr. The other things sound reasonable

pema99 commented 1 year ago

Does this intentionally only touch the avatar prefab?

pema99 commented 1 year ago

I went ahead and addressed the remaining gripes I had, ripping out that process stuff I was complaining about. When I was testing this, one annoyance did pop up: By default, the audio produced by the AudioLinkAvatar prefab will be very low when using this setup, because the Audio Source used is set to 0.01 volume. We support using any volume you want for the Audio Source in AudioLink now, so I suppose this should just be set 1.0 for the avatar prefab (since it is meant for testing anyways). Did you hit this @rrazgriz, or were you using it differently? I just drag in the prefab and enter playmode - works, but low volume

float3 commented 1 year ago

Good point, we should definitely set the avatar prefab's volume to 1.0, I had the same issue

rrazgriz commented 1 year ago

Thanks for the changes, appreciate the help on the process handling side.

Good point, we should definitely set the avatar prefab's volume to 1.0, I had the same issue

1.0 tends to be very loud on my system - I would go for 0.25-0.3 instead by default, subjectively. But an increase is warranted for sure, I always increase to 0.1-0.2.

float3 commented 1 year ago

@pema99 if we address the volume issue then this is merge-able right?