avprovideo插件获取视频长度并显示成分钟


public Text text1;
void Update()
		{
			
                Debug.Log("Time: " + (time * 0.001f).ToString("F1") + "s / " + (duration *         0.001f).ToString("F1") + "s");
                //text1.text = ((duration-time) * 0.001f).ToString("F1");
                float countDown = ((duration - time) * 0.001f);
                if (countDown > 0)
                {
                    countDown -= Time.deltaTime;
                    countDown = countDown < 0 ? 0 : countDown;
                    float minute = Mathf.Floor(countDown / 60);//转成分钟
                    float seconds = countDown % 60;//转成秒
                    text1.text = minute.ToString("00") + ":" + seconds.ToString("00");
                    if (countDown <= 0)
                    {
                        Debug.Log("GameOver");
                    }
                }

            }
		}

赋值即可

avprovideo插件获取视频长度并显示成分钟_第1张图片

你可能感兴趣的:(插件使用)