1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- using System.Collections;
- using System.Collections.Generic;
- using RenderHeads.Media.AVProVideo;
- using UnityEngine;
- public class seturl : MonoBehaviour
- {
- public List<MediaPlayer> mp;
- public List<GameObject> mpView;
- List<string> urls = new List<string>();
- int ct;
- int pl = 0;
- int hc = 1;
- // Start is called before the first frame update
- void Start()
- {
- ct = 0;
- StartCoroutine(playVieo());
- }
- IEnumerator playVieo()
- {
- while(true)
- {
- if(urls.Count>0)
- {
- if(!mpView[0].activeSelf&& !mpView[1].activeSelf)
- {
- string url = urls[ct];
- MediaPath mpath = new MediaPath(url, MediaPathType.AbsolutePathOrURL);
- mp[pl].OpenMedia(mpath, true);
- }
- int hcct = ct;
- hcct++;
- if (hcct >= urls.Count)
- {
- hcct = 0;
- }
- string url2 = urls[hcct];
- MediaPath mpath2 = new MediaPath(url2, MediaPathType.AbsolutePathOrURL);
- mp[hc].OpenMedia(mpath2, true);
- mpView[pl].SetActive(true);
- mpView[hc].SetActive(false);
- int lspl = pl;
- pl = hc;
- hc = lspl;
- yield return new WaitForSeconds(20);
- while(!mp[pl].Control.IsPlaying())
- {
- yield return null;
- }
- ct++;
- if (ct >= urls.Count)
- {
- ct = 0;
- }
- }
- else
- {
- yield return null;
- }
- }
- }
- public void url(List<string> urls)
- {
- this.urls = urls;
- }
- }
|