Search Unity

Problems with Video Player in Unity 2020.2.1f1

Discussion in '2D' started by per_violet, Jan 21, 2021.

  1. per_violet

    per_violet

    Joined:
    May 18, 2020
    Posts:
    1
    I have a somehow strange problem with using the video player. (UnityEngine.Video)
    The problem occurs at least on mac with the browsers Safari, Firefox and Chrome.

    I have the following scenario: If you press a text, it changes the text (PLAY vs. STOP) and plays and pauses a streamed video.
    The video is streaming perfect, but suddenly the text is not displayed correctly. If I display other Text, other characters are missing. (Sometimes it's also working.)

    Strange enough: Within editor, Mac Stand Alone Build and even the Development Build for WebGL works perfect.
    But the normal build for WebGL produces this strange behavoir.

    Would be pleased by every tip in the right direction.

    Error in displaying STOPPED. Three letters missing.
    Bildschirmfoto 2021-01-21 um 20.04.26.png

    Here is my scene. It is just a video player and a UI Text object in a canvas.

    Components.png

    My video player config is the following

    video player config.png
    (To make it more easy I used "Camera Far Plane", originally I used a render texture, but the wrong behavior is the same)

    And finally here is the code of the small button script to stop and play the player.


    public class button : MonoBehaviour,IPointerDownHandler, IPointerUpHandler {

    public VideoPlayer videoPlayer;
    public GameObject text2Object;

    private Text text;

    void Start() {
    text = transform.GetComponent<Text>();
    }

    public void OnPointerUp(PointerEventData eventData) {
    if (!videoPlayer.isPlaying) {
    videoPlayer.Play();
    text.text="PLAY";
    } else {
    videoPlayer.Pause();
    text.text="STOPPED";
    }
    }

    public void OnPointerDown(PointerEventData eventData) {
    }
    }
     
    Last edited: Jan 21, 2021