Exemplo n.º 1
0
        private void Awake()
        {
            // initial youtubedl-core
            ytdlCore = GetComponent <YTDLCore>();
            if (ytdlCore == null)
            {
                Debug.LogErrorFormat(LOG_FORMAT, "YTDLCore component is not found!");
            }
            // bind ytdl core events
            ytdlCore.parseCompleted += ParseCompleted;
            ytdlCore.errorReceived  += ErrorReceived;

            videoPlayer = GetComponent <VideoPlayer>();
            if (videoPlayer == null)
            {
                Debug.LogErrorFormat(LOG_FORMAT, "VideoPlayer component is not found!");
            }
            // init video player
            videoPlayer.source            = VideoSource.Url;
            videoPlayer.playOnAwake       = false;
            videoPlayer.waitForFirstFrame = waitForFirstFrame;
            videoPlayer.isLooping         = loop;
            // override video player event
            videoPlayer.started             += VideoPlayerStarted;
            videoPlayer.prepareCompleted    += VideoPlayerPrepareCompleted;
            videoPlayer.frameReady          += VideoPlayerFrameReady;
            videoPlayer.seekCompleted       += VideoPlayerSeekCompleted;
            videoPlayer.clockResyncOccurred += VideoPlayerClockResyncOccurred;
            videoPlayer.loopPointReached    += VideoPlayerLoopPointReached;
            videoPlayer.errorReceived       += VideoPlayerErrorReceived;

            availableVideoFormat = new List <VideoFormat>();
        }
Exemplo n.º 2
0
        void ParseToPath(string link)
        {
            YTDLCore tempCore = Instantiate(ytdlCore, coreContainer).GetComponent <YTDLCore>();

            tempCore.parseCompleted += ParseCompleted;
            tempCore.errorReceived  += ErrorReceived;
            StartCoroutine(tempCore.PrepareAndParse(link));
        }