public void ReadyToPlay(CustomController.VideoCtrl videoCtrl, UniRx.ReactiveCommand onReadyTo) { videoCtrl.OnReadyToPlay = () => { onReadyTo.Execute(); }; }
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); }
//TODO 设置进度 秒数 public void Seconds(CustomController.VideoCtrl videoCtrl, UniRx.IObservable <float> seconds) { var g = gObject; var sub = seconds.Subscribe((s) => { videoCtrl.SetSeconds(s); }); uiBase.AddDisposable(sub); }
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 PauseVideo(CustomController.VideoCtrl videoCtrl, UniRx.IObservable <bool> isPause) { var g = gObject; bool isFirstSub = true; var sub = isPause.Subscribe((pause) => { if (!isFirstSub) { videoCtrl.Pause(pause); } isFirstSub = false; }); uiBase.AddDisposable(sub); }