private void playVideoWithStartPos(CustomController.VideoCtrl videoCtrl, FairyGUI.FillType fillType, UniRx.IObservable <string> videoPath, UniRx.IObservable <float> startPos) { var g = gObject; var sub = videoPath.CombineLatest(startPos, (a, b) => new UniRx.Tuple <string, float>(a, b)).Sample(videoPath).Subscribe((t) => { videoCtrl.Init(g, fillType); videoCtrl.PlayVideoWithStartPos(t.Item1, t.Item2); }); uiBase.AddDisposable(sub); }
public void PlayVideo(CustomController.VideoCtrl videoCtrl, FairyGUI.FillType fillType, UniRx.IObservable <string> videoPath, UniRx.IObservable <float> progress, bool isFullView = false) { var g = gObject; var sub = videoPath.CombineLatest(progress, (a, b) => new UniRx.Tuple <string, float>(a, b)).Sample(videoPath).Subscribe((t) => { videoCtrl.Init(g, fillType, isFullView); videoCtrl.PlayVideo(t.Item1, t.Item2); }); uiBase.AddDisposable(sub); }
public void PlayVideoWithStartUrlAndPos(CustomController.VideoCtrl videoCtrl, FairyGUI.FillType fillType, UniRx.IObservable <Tuple <string, float> > videoPathAndStartPos, bool isFullView = false, bool autoVisible = true) { var g = gObject; var sub = videoPathAndStartPos.Subscribe((t) => { if (videoCtrl.IsInited && videoCtrl.LastUrl == t.Item1) { Debug.Log("$$ change second"); videoCtrl.SetSeconds(t.Item2); } if (videoCtrl.IsInited && videoCtrl.LastUrl != t.Item1) { Debug.Log("$$ change url old:" + videoCtrl.LastUrl + " new:" + t.Item1); videoCtrl.Rewind(true); videoCtrl.PlayVideoWithStartPos(t.Item1, t.Item2, autoVisible); } else if (!videoCtrl.IsInited) { Debug.Log("$$ init player"); videoCtrl.Init(g, fillType, isFullView); videoCtrl.PlayVideoWithStartPos(t.Item1, t.Item2, autoVisible); } }); uiBase.AddDisposable(sub); }