1.unity设置需要勾选后台运行;
2.我用的是4L-lite播放器;
代码如下:
void Start ()
{
Process.Start("D:\\Video-1\\1-1.mp4");//开始外部视频
StartCoroutine(CloseVideoFunction());
}
// Update is called once per frame
void Update ()
{
}
IEnumerator CloseVideoFunction()//关闭视频播放器
{
yield return new WaitForSeconds(5f);
ToKillProcessFunction("mpc-hc64_nvo");
}
private void ToKillProcessFunction(string name)关闭方法
{
Process[] ps = Process.GetProcessesByName(name);
foreach(var item in ps)
{
print("kill");
item.Kill();
}
}
播放器地址:
链接:https://pan.baidu.com/s/1xZszaKNYeNCxIh9pJ9-S0w
提取码:n276
网友评论