IEnumerator VideoPlayerUpd()
{
Bind thisBind = new Bind(this.gameObject, binded);
player.GetComponent<DragController>().SetBind(ref thisBind);
float time = 0f;
yield return null;
ResourceRequest asyncRequest = Resources.LoadAsync(clipName, typeof(VideoClip));
//anim
while (!asyncRequest.isDone || time < 1f)
{
time += 0.05f;
time = Mathf.Clamp01(time);
seek.value = asyncRequest.progress * time;
yield return new WaitForSeconds(0.05f);
}
movie = (VideoClip)asyncRequest.asset;
vp.clip = movie;
asyncRequest = null;
//anim
//setsource
vp.SetTargetAudioSource(0, source);
vplayersta = VPlayerState.binded;
time = 0f;
while (true)
{
binded = thisBind.res;
if (!binded)
Unbinded();
if (vp.isPlaying)
{
//
yield return new WaitForSeconds(0.1f);
}
else
{
//
yield return new WaitForSeconds(0.25f);
}
}
}
private void UnloadResource()
{
movie = null;
vp.clip = null;
Resources.UnloadUnusedAssets();
}