Inheritance: MonoBehaviour
 protected override void Start()
 {
     base.Start();
     mPlayVideo = FindObjectOfType <PlayVideo>();
 }
        /// <summary>
        /// Subtitles are in full
        /// </summary>
        /// <param name="urls"></param>
        /// <param name="name"></param>
        /// <param name="subtitles"></param>
        public VideoPage(PlayVideo video, int _maxEpisodes = 1)
        {
            currentVideo   = video;
            maxEpisodes    = _maxEpisodes;
            IsSingleMirror = video.isSingleMirror;

            InitializeComponent();
            Core.Initialize();
            lockElements     = new VisualElement[] { NextMirror, NextMirrorBtt, BacktoMain, GoBackBtt, EpisodeLabel, PausePlayClickBtt, PausePlayBtt, SkipForward, SkipForwardBtt, SkipForwardImg, SkipForwardSmall, SkipBack, SkipBackBtt, SkipBackImg, SkipBackSmall };
            settingsElements = new VisualElement[] { EpisodesTap, MirrorsTap, SubTap, NextEpisodeTap, };

            void SetIsLocked()
            {
                LockImg.Source    = App.GetImageSource(isLocked ? LOCKED_IMAGE : UN_LOCKED_IMAGE);
                LockTxt.TextColor = Color.FromHex(isLocked ? "#617EFF" : "#FFFFFF");
                // LockTap.SetValue(XamEffects.TouchEffect.ColorProperty, Color.FromHex(isLocked ? "#617EFF" : "#FFFFFF"));
                LockTap.SetValue(XamEffects.TouchEffect.ColorProperty, Color.FromHex(isLocked ? "#99acff" : "#FFFFFF"));
                LockImg.Transformations = new List <FFImageLoading.Work.ITransformation>()
                {
                    (new FFImageLoading.Transformations.TintTransformation(isLocked ? MainPage.DARK_BLUE_COLOR : "#FFFFFF"))
                };
                VideoSlider.InputTransparent = isLocked;
                foreach (var visual in lockElements)
                {
                    visual.IsEnabled = !isLocked;
                    visual.IsVisible = !isLocked;
                }

                foreach (var visual in settingsElements)
                {
                    visual.Opacity   = isLocked ? 0 : 1;
                    visual.IsEnabled = !isLocked;
                }

                if (!isLocked)
                {
                    ShowNextMirror();
                }
            }

            SkipForward.TranslationX    = TRANSLATE_START_X;
            SkipForwardImg.Source       = App.GetImageSource("netflixSkipForward.png");
            SkipForwardBtt.TranslationX = TRANSLATE_START_X;
            Commands.SetTap(SkipForwardBtt, new Command(() => {
                SeekMedia(SKIPTIME);
                lastClick = DateTime.Now;
                SkipFor();
            }));

            SkipBack.TranslationX    = -TRANSLATE_START_X;
            SkipBackImg.Source       = App.GetImageSource("netflixSkipBack.png");
            SkipBackBtt.TranslationX = -TRANSLATE_START_X;
            Commands.SetTap(SkipBackBtt, new Command(() => {
                SeekMedia(-SKIPTIME);
                lastClick = DateTime.Now;
                SkipBac();
            }));
            Commands.SetTap(LockTap, new Command(() => {
                isLocked = !isLocked;
                CurrentTap++;
                FadeEverything(false);
                SetIsLocked();
            }));

            MirrorsTap.IsVisible     = AllMirrorsUrls.Count > 1;
            SubTap.IsVisible         = false; // TODO: ADD SUBTITLES
            EpisodesTap.IsVisible    = false; // TODO: ADD EPISODES SWITCH
            NextEpisodeTap.IsVisible = false; // TODO: ADD NEXT EPISODE


            Commands.SetTap(MirrorsTap, new Command(async() => {
                string action = await DisplayActionSheet("Mirrors", "Cancel", null, AllMirrorsNames.ToArray());
                App.ToggleRealFullScreen(true);
                print("ACTION = " + action);
                if (action != "Cancel")
                {
                    for (int i = 0; i < AllMirrorsNames.Count; i++)
                    {
                        if (AllMirrorsNames[i] == action)
                        {
                            print("SELECT MIRR" + action);
                            SelectMirror(i);
                        }
                    }
                }
            }));


            // ======================= SETUP =======================

            _libVLC      = new LibVLC();
            _mediaPlayer = new MediaPlayer(_libVLC)
            {
                EnableHardwareDecoding = true
            };

            vvideo.MediaPlayer = _mediaPlayer; // = new VideoView() { MediaPlayer = _mediaPlayer };



            // ========== IMGS ==========
            // SubtitlesImg.Source = App.GetImageSource("netflixSubtitlesCut.png"); //App.GetImageSource("baseline_subtitles_white_48dp.png");
            MirrosImg.Source   = App.GetImageSource("baseline_playlist_play_white_48dp.png");
            EpisodesImg.Source = App.GetImageSource("netflixEpisodesCut.png");
            NextImg.Source     = App.GetImageSource("baseline_skip_next_white_48dp.png");
            BacktoMain.Source  = App.GetImageSource("baseline_keyboard_arrow_left_white_48dp.png");
            NextMirror.Source  = App.GetImageSource("baseline_skip_next_white_48dp.png");

            //  GradientBottom.Source = App.GetImageSource("gradient.png");
            // DownloadImg.Source = App.GetImageSource("netflixEpisodesCut.png");//App.GetImageSource("round_more_vert_white_48dp.png");

            SetIsLocked();
            // LockImg.Source = App.GetImageSource("wlockUnLocked.png");
            SubtitleImg.Source = App.GetImageSource("outline_subtitles_white_48dp.png");


            Commands.SetTap(EpisodesTap, new Command(() => {
                //do something
                print("Hello");
            }));
            Commands.SetTap(NextMirrorBtt, new Command(() => {
                SelectNextMirror();
            }));


            //Commands.SetTapParameter(view, someObject);
            // ================================================================================ UI ================================================================================
            PausePlayBtt.Source = PAUSE_IMAGE;//App.GetImageSource(PAUSE_IMAGE);
            //PausePlayClickBtt.set
            Commands.SetTap(PausePlayClickBtt, new Command(() => {
                //do something
                PausePlayBtt_Clicked(null, EventArgs.Empty);
                print("Hello");
            }));
            Commands.SetTap(GoBackBtt, new Command(() => {
                print("DAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAdddddddddddAAAAAAAA");
                Navigation.PopModalAsync();
                //Navigation.PopModalAsync();
            }));



            void SetIsPaused(bool paused)
            {
                PausePlayBtt.Source   = paused ? PLAY_IMAGE : PAUSE_IMAGE;//App.GetImageSource(paused ? PLAY_IMAGE : PAUSE_IMAGE);
                PausePlayBtt.Opacity  = 1;
                LoadingCir.IsVisible  = false;
                BufferLabel.IsVisible = false;
                isPaused = paused;
            }

            Player.Paused += (o, e) => {
                Device.BeginInvokeOnMainThread(() => {
                    SetIsPaused(true);
                    //   LoadingCir.IsEnabled = false;
                });
            };
            Player.Playing += (o, e) => {
                Device.BeginInvokeOnMainThread(() => {
                    SetIsPaused(false);
                });

                //   LoadingCir.IsEnabled = false;
            };
            Player.TimeChanged += (o, e) => {
                PlayerTimeChanged(Player.Time);
            };


            Player.Buffering += (o, e) => {
                Device.BeginInvokeOnMainThread(() => {
                    if (e.Cache == 100)
                    {
                        SetIsPaused(!Player.IsPlaying);
                    }
                    else
                    {
                        //BufferBar.ProgressTo(e.Cache / 100.0, 50, Easing.Linear);
                        BufferLabel.Text      = "" + (int)e.Cache + "%";
                        BufferLabel.IsVisible = true;
                        PausePlayBtt.Opacity  = 0;
                        LoadingCir.IsVisible  = true;
                    }
                });
            };
            Player.EncounteredError += (o, e) => {
                // TODO: SKIP TO NEXT
                ErrorWhenLoading();
            };
            SelectMirror(0);
            ShowNextMirror();

            //  Player.AddSlave(MediaSlaveType.Subtitle,"") // ADD SUBTITLEs
        }
Exemple #3
0
 void Start()
 {
     playVideoInstance = GetComponent <PlayVideo>();
     objMaterial.SetColor("_OutlineColor", Color.green);
 }
Exemple #4
0
 void Start()
 {
     playVideoInstance = GetComponent<PlayVideo>();
     objMaterial.SetColor("_OutlineColor", Color.green);
 }
Exemple #5
0
 // Start is called before the first frame update
 void Start()
 {
     videoScript = FindObjectOfType <PlayVideo>();
     OpenModule(0);
 }
Exemple #6
0
 private void OnPlayVideo(PlayVideoEventArgs eventArgs)
 {
     PlayVideo?.Invoke(this, eventArgs);
 }