Exemplo n.º 1
0
    public void init(string url, MediaSource.MediaPrepared mediaPrepared)
    {
        this.mediaPrepared = mediaPrepared;

        transform.Find("YTDLPlayer_360").gameObject.SetActive(false);
        transform.Find("YTDLPlayer").gameObject.SetActive(false);
        playerObject.SetActive(true);

        string playerStr = "YTDLPlayer";

        if (url.EndsWith("360"))
        {
            playerStr = "YTDLPlayer_360";
            url       = url.Substring(0, url.Length - "360".Length);
            Debug.Log("33333333333333333333360 YOUTUBE VIDEO TEST " + url);
        }
        GameObject sink = transform.Find(playerStr).gameObject;

        ytdlPlayer  = sink.GetComponentInChildren <YTDLPlayer>();
        ytdlCore    = sink.GetComponentInChildren <YTDLCore>();
        videoPlayer = ytdlCore.GetComponent <VideoPlayer>();

        videoPlayer.started += videoPlayerStarted;

        //ytdlPlayer.SetVideoUrl(url);
        ytdlPlayer.url = url;

        ytdlPlayer.parseCompleted += parseCompleted;
        ytdlPlayer.Parse(false);
    }
Exemplo n.º 2
0
 private void Awake()
 {
     ytdlCore = GetComponent <YTDLCore>();
     instance = this;
 }