unity webgl视频加载 和 检测视频是否播放完毕


```csharp
//string video_Path = "http://yuzhicai.boyaokj.cn/upload/fenjingyuyan.mp4";//网络加载视频播放
    string video_Path = "";
    public VideoPlayer videoplayer;//从场景中拖入挂载VideoPlayer组件的RawImage

    public GameObject Moves;
    public GameObject Modle;

    //检测视频是否播放完毕
    void Awake()
    {
    
    
        videoplayer.loopPointReached += test; //设置委托
    }
    void test(VideoPlayer video)//videoplayer = video2
    {
    
    
        Debug.Log("播放完毕");
        Moves.SetActive(false);
        Modle.SetActive(true);
    }
    //开始加载视频播放
    void Start()
    {
    
    
        //video_Path = Path.Combine(Application.streamingAssetsPath, "example.mp4");
        video_Path = Application.streamingAssetsPath + "/example.mp4";//本地视频加载,视频放在StreamingAssets文件夹下
        videoplayer.url = video_Path;
    }
     //点击按钮播放视频
    public void Play_Moves()
    {
    
    
        videoplayer.Play();
    }
    //点击按钮暂停视频播放
    public void Play_Stop()
    {
    
    
        videoplayer.Stop();
    }

猜你喜欢

转载自blog.csdn.net/qq_42986916/article/details/126655721