VideoPlayer sometime play without image

I have the video player that play video on raw image with this code running:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Video;

public class PlayVideo : MonoBehaviour
{
    public RawImage rawImage;
    public VideoPlayer videoPlayer;
    public AudioSource audioSource;

    // Start is called before the first frame update
    void Start()
    {
        StartCoroutine(VideoPlay());
    }

    IEnumerator VideoPlay()
    {
        videoPlayer.Prepare();
        WaitForSeconds waitForSeconds = new WaitForSeconds(1);
        while (!videoPlayer.isPrepared)
        {
            yield return waitForSeconds;
            break;
        }
        rawImage.texture = videoPlayer.texture;
        videoPlayer.Play();
        audioSource.Play();
    }

    public void VideoControl()
    {
        if (videoPlayer.isPlaying)
        {
            videoPlayer.Pause();
        }
        else if (videoPlayer.isPaused)
        {
            videoPlayer.Play();
        }

    }
}

The code works fine, but sometimes when the scene started there is no video image render on raw image and then I have to restart the scene to make the video player works properly. Does anyone know what cause this and how to solve it.

Already find the solution. There is the issue with getting the texture, so I have to check it a bit.
Here is the code that works with button click to change videos:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using UnityEngine.Video;

public class PlayVideo : MonoBehaviour
{
    public RawImage rawImage;
    public VideoPlayer videoPlayer;
    public AudioSource audioSource;
    public static bool finish;
    public static bool start;
    public VideoClip[] clip;
    public GameObject videoGrid;

    void Update()
    {
        videoPlayer.loopPointReached += EndReached;
        if (videoPlayer.isPlaying)
        {
            start = true;
        }

        if (videoPlayer.isPlaying && videoPlayer.targetTexture == null)
        {
            rawImage.texture = videoPlayer.texture;
        }
    }

    IEnumerator VideoPlay()
    {
        videoPlayer.Prepare();
        WaitForSeconds waitForSeconds = new WaitForSeconds(1);
        while (!videoPlayer.isPrepared)
        {
            yield return waitForSeconds;
            break;
        }
        rawImage.texture = videoPlayer.texture;
        videoPlayer.Play();
        audioSource.Play();
    }

    void EndReached(VideoPlayer vp)
    {
        finish = true;
        videoGrid.SetActive(true);
    }

    public void SelectVideo(string videoIndex)
    {
        if (videoIndex == "1")
        {
            videoPlayer.clip = clip[0];
            StartCoroutine(VideoPlay());
            videoGrid.SetActive(false);
            finish = false;
        }
        if (videoIndex == "2")
        {
            videoPlayer.clip = clip[1];
            StartCoroutine(VideoPlay());
            videoGrid.SetActive(false);
            finish = false;
        }
        if (videoIndex == "3")
        {
            videoPlayer.clip = clip[2];
            StartCoroutine(VideoPlay());
            videoGrid.SetActive(false);
            finish = false;
        }
        if (videoIndex == "4")
        {
            videoPlayer.clip = clip[3];
            StartCoroutine(VideoPlay());
            videoGrid.SetActive(false);
            finish = false;
        }
        if (videoIndex == "5")
        {
            videoPlayer.clip = clip[4];
            StartCoroutine(VideoPlay());
            videoGrid.SetActive(false);
            finish = false;
        }
        if (videoIndex == "6")
        {
            videoPlayer.clip = clip[5];
            StartCoroutine(VideoPlay());
            videoGrid.SetActive(false);
            finish = false;
        }
        if (videoIndex == "7")
        {
            videoPlayer.clip = clip[6];
            StartCoroutine(VideoPlay());
            videoGrid.SetActive(false);
            finish = false;
        }
        if (videoIndex == "8")
        {
            videoPlayer.clip = clip[7];
            StartCoroutine(VideoPlay());
            videoGrid.SetActive(false);
            finish = false;
        }
        if (videoIndex == "9")
        {
            videoPlayer.clip = clip[8];
            StartCoroutine(VideoPlay());
            videoGrid.SetActive(false);
            finish = false;
        }
    }
}