Hello i need help with the the video player when i look where the video is in the editor it work perfectly fine but when im in the webGL build it doesn’t work
You have to stream videos in WebGL
public string _filename = "myVideo.mp4";
private string _streamingAssetsPathSubfolder = "video/";
private VideoPlayer _videoPlayer = null;
private void SetVideo()
{
if (_videoPlayer)
{
_videoPlayer.source = VideoSource.Url;
_videoPlayer.url = Application.streamingAssetsPath + "/" + _streamingAssetsPathSubfolder + _filename;
//_videoPlayer.loopPointReached += EndReached;
_videoPlayer.prepareCompleted += TotalTimeOfVideo;
_videoPlayer.Prepare();
}
else Debug.LogWarning("VideoPlayer not found. ( " + gameObject.name + " )");
}
private void TotalTimeOfVideo(VideoPlayer vp)
{
double time = vp.frameCount / vp.frameRate;
System.TimeSpan videoUrlLength = System.TimeSpan.FromSeconds(time);
Debug.Log("Video length: " + videoUrlLength.Seconds);
//vp.Play();
}
do i copy and past this code on to my script?
it’s just a example how you can load a file from the streamingAssets folder and use it in the videoplayer
My VideoPlayerWebGL asset works great