Example #1
0
        private void playFromUrl(IUrl ui)
        {
            if (ui is ITimePeriod)
            {
                ITimePeriod tp = ui as ITimePeriod;
                playCtrl.ViewModel.UpdateTimePeriod(tp.BeginTime, tp.EndTime);
            }
            //更新数据源。
            VideoInfoManager.Instance.UpdateSource(ui);
            int         sourceIndex = VideoInfoManager.Instance.SourceIndex;
            UrlAndIndex uai         = new UrlAndIndex(ui, sourceIndex);

            new Thread(initPlay)
            {
                IsBackground = true,
                Name         = "InitPlayVideos"
            }.Start(uai);
        }
Example #2
0
        private void initPlay(object uaiObj)
        {
            UrlAndIndex uai   = (UrlAndIndex)uaiObj;
            IUrl        ui    = uai.Url;
            int         index = uai.Index;

            if (ui.VideoInfos == null || ui.VideoInfos.Length == 0)
            {
                return;
            }
            while (index == VideoInfoManager.Instance.SourceIndex)
            {
                PlayControlViewModel vm = getPlayCtrlModel();
                if (vm.IsReadyToPlay())
                {
                    this.Dispatcher.BeginInvoke(new Action(() =>
                    {
                        playVideoInfos(vm, ui);
                    }), null);
                    break;
                }
                Thread.Sleep(100);
            }
        }