Hi, i’m trying to do something when a VideoPlayer has ended (well, it’s VideoClip) so I used a Courutine but the variable that has to be true only when the Video Player ends begins in true and I don’t know why is this happenning. It supose that isVideoFinished should be false until the while’s condition is false.
public class VideoPlayerController : MonoBehaviour
{
public VideoPlayer videoPlayer;
private void Start()
{
// Assuming you have a reference to the VideoPlayer component
videoPlayer.loopPointReached += OnVideoEnd;
}
private void OnVideoEnd(VideoPlayer vp)
{
// Video has ended
Debug.Log("Video ended");
}
// Alternatively, you can also check the isPlaying property
private void Update()
{
if (!videoPlayer.isPlaying)
{
// Video has ended
Debug.Log("Video ended");
}
}
Thank you but I mean, using typescript for a needle in script/src . In needle there are no events for the component VideoPlayer (like .loopPoinReached) and neither the “length” property.
Thank you! It Works ! It really works, I didn’t know about the .videoElement, I don´t know why the event ended works better than the isPlaying but it works. And thank uo for the link
Issue : A class 's static boolean attribute change inside a Generator(from typescript or a Courutine in C#) when It suppose not to change unless the VideoPlayer.isPlaying = false. About VideoPlayer component :Play On Awake : True , Wait For First Frame : False, Loop : FalseSkip On Drop : True Video Format :.mp4 with Override for EmbeddedLinux : checked Unity Version :Unity 2021.3.18f1 Personal Needle Engine Version :Exporter 3.7.3-exp Engine 3.7.3 - alpha
Solved : Using VideoPlayer.videoElement.ended event from HTML Audio/Video DOM Reference