- Home /
WebGL VideoPlayer only Plays Once
I have found the answer and figured I would post this for anyone who runs into the same problem.
I have been looking through the Forums, Answers, and Issue Tracker here and cannot find an answer.
I am using streaming assets for my video clips. The URL is assigned in the Awake and it waits for button presses to play, pause, reset, and stop the video player. The video player itself is set to render on the far plane of the camera. I have narrowed it down to my Pause in background method.
public void PauseInBackground(){
if (pausedInBackgroud) return;
fade.StartFadeIn(fadeSpeed, InternalPauseInBackground);
}
void InternalPauseInBackground()
{
Pause();
pausedInBackgroud = true;
m_camera.enabled = videoPlayer.enabled = false;
ActivateElements(true);
fade.StartFadeOut(fadeSpeed * 0.5f);
}
In the WebGL build,
->start app
->press play
Video Plays then I...
->Press ui to "Pause in background"
Video Pauses and switches back to the main screen
->Then press Play
The Audio plays but the video does not
================================ Answer =================================
As I was writing this I realized that the Pause In Background method was disabling the video player. Which means it was getting enabled and Calling its OnEnabled message every time I hit play. However I do not know what it does in this message. So I just disabled the camera and NOT the video player. and it seems that I am able to play the video more than once now.
Your answer
Follow this Question
Related Questions
WebGL play video using VideoPlayer and StreamingAssets 2 Answers
Problem with AssetBundles and StreamingAssets in Android an WebGL 1 Answer
VideoPlayer: No audio when playing from StreamingAssets 1 Answer
UnityWebRequestMultimedia.GetAudioClip dont't work in WebGL build (2019.3.15f1). 1 Answer
Application.streamingAssetsPath not working with WebGL build 0 Answers