How can I simply control the playback speed of a video player in Unity. Right now I have this code but the problem is I can only debug the output in the console log, is there a way to do it on the actual Video Player?
Video Player Script:
public Slider mySlider;
// Start is called before the first frame update
void Start()
{
mySlider.onValueChanged.AddListener(delegate { ValueChangeCheck(); });
}
public void ValueChangeCheck()
{
Debug.Log(mySlider.value);
}
Here is my UI
CodePudding user response:
This should work, but if I'm not mistaken you need to make sure the video has been prepared (essentially fully loaded) in order to change the playback speed, take a look at the official Unity documentation for the Video Player here
public Slider mySlider;
// Start is called before the first frame update
void Start()
{
mySlider.onValueChanged.AddListener(delegate { AdjustSpeed(); });
}
public void AdjustSpeed()
{
videoPlayer.playbackSpeed = mySlider.value
}