Ejemplo n.º 1
0
        protected override void OnHandleIntent(Android.Content.Intent intent)
        {
            string data = intent.Extras.GetString("data");

            try {
                switch (data)
                {
                case "play":
                    MainChrome.PauseAndPlay(false);
                    break;

                case "pause":
                    MainChrome.PauseAndPlay(true);
                    break;

                case "goforward":
                    MainChrome.SeekMedia(30);
                    break;

                case "goback":
                    MainChrome.SeekMedia(-30);
                    break;

                case "stop":
                    //  MainChrome.StopCast();
                    MainChrome.JustStopVideo();
                    break;

                default:
                    break;
                }
            }
            catch (Exception) {
            }
        }
Ejemplo n.º 2
0
        async void SelectMirror()
        {
            bool succ = false;

            currentSelected--;
            while (!succ)
            {
                currentSelected++;

                if (currentSelected >= episodeResult.Mirros.Count)
                {
                    succ = true;
                }
                else
                {
                    try {
                        DescriptName = episodeResult.Mirros[currentSelected];
                    }
                    catch (Exception) {
                    }

                    succ = await MainChrome.CastVideo(episodeResult.mirrosUrls[currentSelected], episodeResult.Mirros[currentSelected]);
                }
            }
            try {
                DescriptName = episodeResult.Mirros[currentSelected];
            }
            catch (Exception) {
            }

            // CastVideo(episodeResult.mirrosUrls[currentSelected], episodeResult.Mirros[currentSelected], CurrentTime);
        }
Ejemplo n.º 3
0
        async void SelectMirror()
        {
            bool succ = false;

            currentSelected--;
            while (!succ)
            {
                currentSelected++;

                if (currentSelected >= currentChromeData.MirrorsNames.Count)
                {
                    succ = true;
                }
                else
                {
                    try {
                        DescriptName = DescriptSetName;//currentChromeData.MirrorsNames[currentSelected];
                    }
                    catch (Exception) {
                    }

                    /*
                     * string _sub = "";
                     * if (chromeMovieResult.subtitles != null) {
                     *  if (chromeMovieResult.subtitles.Count > 0) {
                     *      _sub = chromeMovieResult.subtitles[0].data;
                     *  }
                     * }
                     */
                    if (MainChrome.CurrentTime > 120)
                    {
                        changeTime = MainChrome.CurrentTime;
                        print("CHANGE TIME TO " + changeTime);
                    }

                    string subTxt = "";
                    if (subtitleIndex != -1 && HasSubtitlesOn)
                    {
                        subTxt = subtitles[subtitleIndex].data;
                    }
                    //   succ = await MainChrome.CastVideo(episodeResult.mirrosUrls[currentSelected], episodeResult.Mirros[currentSelected], subtitleUrl: subTxt, posterUrl: chromeMovieResult.title.hdPosterUrl, movieTitle: chromeMovieResult.title.name, setTime: changeTime, subtitleDelay: subtitleDelay);
                    succ = await MainChrome.CastVideo(currentChromeData.MirrorsUrls[currentSelected], currentChromeData.MirrorsNames[currentSelected], subtitleUrl : subTxt, posterUrl : currentChromeData.hdPosterUrl, movieTitle : currentChromeData.titleName, setTime : changeTime, subtitleDelay : subtitleDelay);
                }
            }
            try {
                DescriptName = DescriptSetName;// currentChromeData.MirrorsNames[currentSelected];//episodeResult.Mirros[currentSelected];
            }
            catch (Exception) {
            }

            // CastVideo(episodeResult.mirrosUrls[currentSelected], episodeResult.Mirros[currentSelected], CurrentTime);
        }
Ejemplo n.º 4
0
        async void LateCheck()
        {
            await Task.Delay(5000);

            //   App.PlatformDep.PictureInPicture();
            try {
                CheckGitHubUpdate();
                MainChrome.StartImageChanger();
                MainChrome.GetAllChromeDevices();
            }
            catch (Exception _ex) {
                error("ERROR IN LATECHECK::: " + _ex);
            }
        }
Ejemplo n.º 5
0
        async void SelectMirror()
        {
            bool succ = false;

            currentSelected--;
            while (!succ)
            {
                currentSelected++;

                if (currentSelected >= episodeResult.Mirros.Count)
                {
                    succ = true;
                }
                else
                {
                    try {
                        DescriptName = episodeResult.Mirros[currentSelected];
                    }
                    catch (Exception) {
                    }

                    string _sub = "";
                    if (chromeMovieResult.subtitles != null)
                    {
                        if (chromeMovieResult.subtitles.Count > 0)
                        {
                            _sub = chromeMovieResult.subtitles[0].data;
                        }
                    }

                    if (MainChrome.CurrentTime > 120)
                    {
                        changeTime = MainChrome.CurrentTime;
                        print("CHANGE TIME TO " + changeTime);
                    }

                    succ = await MainChrome.CastVideo(episodeResult.mirrosUrls[currentSelected], episodeResult.Mirros[currentSelected], subtitleUrl : _sub, posterUrl : chromeMovieResult.title.hdPosterUrl, movieTitle : chromeMovieResult.title.name, setTime : changeTime);
                }
            }
            try {
                DescriptName = episodeResult.Mirros[currentSelected];
            }
            catch (Exception) {
            }

            // CastVideo(episodeResult.mirrosUrls[currentSelected], episodeResult.Mirros[currentSelected], CurrentTime);
        }
Ejemplo n.º 6
0
        async void WaitChangeChromeCast()
        {
            if (MainChrome.IsCastingVideo)
            {
                Device.BeginInvokeOnMainThread(() => {
                    OpenChromecastView(1, EventArgs.Empty);
                });
            }
            else
            {
                List <string> names = MainChrome.GetChromeDevicesNames();
                if (MainChrome.IsConnectedToChromeDevice)
                {
                    names.Add("Disconnect");
                }
                string a = await ActionPopup.DisplayActionSheet("Cast to", names.ToArray());                //await DisplayActionSheet("Cast to", "Cancel", MainChrome.IsConnectedToChromeDevice ? "Disconnect" : null, names.ToArray());

                if (a != "Cancel")
                {
                    MainChrome.ConnectToChromeDevice(a);
                }
            }
        }
Ejemplo n.º 7
0
        public ChromeCastPage(ChromecastData data)
        {
            currentChromeData = data;
            isActive          = true;
            //episodeResult = MovieResult.chromeResult;
            //  chromeMovieResult = MovieResult.chromeMovieResult;

            InitializeComponent();

            if (lastId != currentChromeData.episodeId)        //chromeMovieResult.title.id) {
            {
                lastId         = currentChromeData.episodeId; //chromeMovieResult.title.id;
                subtitles      = new List <Subtitle>();
                subtitleDelay  = 0;
                subtitleIndex  = -1;
                HasSubtitlesOn = false;
                print("NOT THE SAME AT LAST ONE");
                if (globalSubtitlesEnabled)
                {
                    PopulateSubtitle();
                }
            }
            else
            {
                //subtitles = lastSubtitles;
            }

            Subbutton.Source   = App.GetImageSource("outline_subtitles_white_48dp.png");
            BindingContext     = this;
            TitleName          = currentChromeData.titleName;                                                    //chromeMovieResult.title.name;
            EpisodeTitleName   = currentChromeData.episodeTitleName;                                             //episodeResult.Title;
            PosterUrl          = CloudStreamCore.ConvertIMDbImagesToHD(currentChromeData.hdPosterUrl, 150, 225); //chromeMovieResult.title.hdPosterUrl, 150, 225);
            EpisodePosterUrl   = currentChromeData.episodePosterUrl;                                             //episodeResult.PosterUrl;
            EpisodeDescription = currentChromeData.descript;                                                     //episodeResult.Description;
            BackgroundColor    = Settings.BlackRBGColor;
            //  CloudStreamForms.MainPage.mainPage.BarBackgroundColor = Color.Transparent;
            ChromeLabel.Text = "Connected to " + MainChrome.chromeRecivever.FriendlyName;

            try {
                DescriptName = DescriptSetName;// currentChromeData.MirrorsNames[currentSelected];//episodeResult.Mirros[currentSelected];
            }
            catch (Exception _ex) {
                print("ERROR LOADING MIRROR " + _ex);
            }



            //https://material.io/resources/icons/?style=baseline
            VideoSlider.DragStarted += (o, e) => {
                draging = true;
            };


            VideoSlider.DragCompleted += (o, e) => {
                MainChrome.SetChromeTime(VideoSlider.Value * CurrentCastingDuration);
                draging = false;
                UpdateTxt();
            };

            const bool rotateAllWay = false;
            const int  rotate       = 90;
            const int  time         = 100;

            Commands.SetTap(FastForwardBtt, new Command(async() => {
                SeekMedia(FastForwardTime);
                FastForward.Rotation = 0;
                if (rotateAllWay)
                {
                    await FastForward.RotateTo(360, 200, Easing.SinOut);
                }
                else
                {
                    FastForward.ScaleTo(0.9, time, Easing.SinOut);
                    await FastForward.RotateTo(rotate, time, Easing.SinOut);
                    FastForward.ScaleTo(1, time, Easing.SinOut);
                    await FastForward.RotateTo(0, time, Easing.SinOut);
                }
            }));

            Commands.SetTap(BackForwardBtt, new Command(async() => {
                SeekMedia(-BackForwardTime);
                BackForward.Rotation = 0;
                if (rotateAllWay)
                {
                    await BackForward.RotateTo(-360, 200, Easing.SinOut);
                }
                else
                {
                    BackForward.ScaleTo(0.9, time, Easing.SinOut);
                    await BackForward.RotateTo(-rotate, time, Easing.SinOut);
                    BackForward.ScaleTo(1, time, Easing.SinOut);
                    await BackForward.RotateTo(0, time, Easing.SinOut);
                }
            }));

            StopAll.Clicked += (o, e) => {
                //  MainChrome.StopCast();
                JustStopVideo();
                OnStop();
            };

            if (currentChromeData.isFromFile)
            {
                UpperIconHolder.TranslationX  = 20;
                LowerIconHolder.ColumnSpacing = 40;

                PlayList.IsEnabled = false;
                PlayList.IsVisible = false;

                SkipForward.IsEnabled = false;
                SkipForward.IsVisible = false;

                SkipBack.IsEnabled = false;
                SkipBack.IsVisible = false;

                Grid.SetColumn(Subbutton, 0);
                Grid.SetColumn(StopAll, 1);
                Grid.SetColumn(Audio, 2);

                if (currentChromeData.movieType == MovieType.YouTube)
                {
                    Subbutton.IsEnabled = false;
                    Subbutton.Opacity   = 0;
                    //TODO Add youtube subtitles download
                }
            }
            else
            {
                PlayList.Clicked += async(o, e) => {
                    //ListScale();
                    string a = await ActionPopup.DisplayActionSheet("Select Mirror", currentChromeData.MirrorsNames.ToArray()); //await DisplayActionSheet("Select Mirror", "Cancel", null, episodeResult.Mirros.ToArray());

                    //ListScale();
                    for (int i = 0; i < currentChromeData.MirrorsNames.Count; i++)
                    {
                        if (a == currentChromeData.MirrorsNames[i])
                        {
                            currentSelected = i;
                            SelectMirror();
                            return;
                        }
                    }
                };

                SkipForward.Clicked += async(o, e) => {
                    currentSelected++;
                    if (currentSelected > currentChromeData.MirrorsNames.Count)
                    {
                        currentSelected = 0;
                    }
                    SelectMirror();
                    await SkipForward.TranslateTo(6, 0, 50, Easing.SinOut);

                    await SkipForward.TranslateTo(0, 0, 50, Easing.SinOut);
                };

                SkipBack.Clicked += async(o, e) => {
                    currentSelected--;
                    if (currentSelected < 0)
                    {
                        currentSelected = currentChromeData.MirrorsNames.Count - 1;
                    }
                    SelectMirror();
                    await SkipBack.TranslateTo(-6, 0, 50, Easing.SinOut);

                    await SkipBack.TranslateTo(0, 0, 50, Easing.SinOut);
                };
            }
            ConstUpdate();

            MainChrome.Volume = (MainChrome.Volume);

            /*
             * LowVol.Source = GetImageSource("round_volume_down_white_48dp.png");
             * MaxVol.Source = GetImageSource("round_volume_up_white_48dp.png");*/

            //   UserDialogs.Instance.TimePrompt(new TimePromptConfig() { CancelText = "Cancel", Title = "da", Use24HourClock = false, OkText = "OK", IsCancellable = true });
        }
Ejemplo n.º 8
0
        public ChromeCastPage()
        {
            isActive          = true;
            episodeResult     = MovieResult.chromeResult;
            chromeMovieResult = MovieResult.chromeMovieResult;

            InitializeComponent();
            BindingContext     = this;
            TitleName          = chromeMovieResult.title.name;
            EpisodeTitleName   = episodeResult.Title;
            PosterUrl          = CloudStreamCore.ConvertIMDbImagesToHD(chromeMovieResult.title.hdPosterUrl, 150, 225);
            EpisodePosterUrl   = episodeResult.PosterUrl;
            EpisodeDescription = episodeResult.Description;
            BackgroundColor    = Settings.BlackRBGColor;
            //  CloudStreamForms.MainPage.mainPage.BarBackgroundColor = Color.Transparent;
            ChromeLabel.Text = "Connected to " + MainChrome.chromeRecivever.FriendlyName;

            try {
                DescriptName = episodeResult.Mirros[currentSelected];
            }
            catch (Exception _ex) {
                print("ERROR LOADING MIRROR " + _ex);
            }

            MainChrome.OnDisconnected += (o, e) => {
                OnStop();
            };

            MainChrome.OnPauseChanged += (o, e) => {
                SetPause(e);
            };

            //https://material.io/resources/icons/?style=baseline
            VideoSlider.DragStarted += (o, e) => {
                draging = true;
            };

            VideoSlider.DragCompleted += (o, e) => {
                MainChrome.SetChromeTime(VideoSlider.Value * CurrentCastingDuration);
                draging = false;
                UpdateTxt();
            };
            const bool rotateAllWay = false;
            const int  rotate       = 90;

            FastForward.Clicked += async(o, e) => {
                SeekMedia(FastForwardTime);
                FastForward.Rotation = 0;
                if (rotateAllWay)
                {
                    await FastForward.RotateTo(360, 200, Easing.SinOut);
                }
                else
                {
                    await FastForward.RotateTo(rotate, 50, Easing.SinOut);

                    await FastForward.RotateTo(0, 50, Easing.SinOut);
                }
            };

            BackForward.Clicked += async(o, e) => {
                SeekMedia(-BackForwardTime);
                BackForward.Rotation = 0;
                if (rotateAllWay)
                {
                    await BackForward.RotateTo(-360, 200, Easing.SinOut);
                }
                else
                {
                    await BackForward.RotateTo(-rotate, 50, Easing.SinOut);

                    await BackForward.RotateTo(0, 50, Easing.SinOut);
                }
            };

            StopAll.Clicked += (o, e) => {
                MainChrome.StopCast();
                OnStop();
            };

            SkipForward.Clicked += async(o, e) => {
                currentSelected++;
                if (currentSelected > episodeResult.Mirros.Count)
                {
                    currentSelected = 0;
                }
                SelectMirror();
                await SkipForward.TranslateTo(6, 0, 50, Easing.SinOut);

                await SkipForward.TranslateTo(0, 0, 50, Easing.SinOut);
            };

            SkipBack.Clicked += async(o, e) => {
                currentSelected--;
                if (currentSelected < 0)
                {
                    currentSelected = episodeResult.Mirros.Count - 1;
                }
                SelectMirror();
                await SkipBack.TranslateTo(-6, 0, 50, Easing.SinOut);

                await SkipBack.TranslateTo(0, 0, 50, Easing.SinOut);
            };

            PlayList.Clicked += async(o, e) => {
                //ListScale();
                string a = await DisplayActionSheet("Select Mirror", "Cancel", null, episodeResult.Mirros.ToArray());

                //ListScale();

                for (int i = 0; i < episodeResult.Mirros.Count; i++)
                {
                    if (a == episodeResult.Mirros[i])
                    {
                        currentSelected = i;
                        SelectMirror();
                        return;
                    }
                }
            };
            ConstUpdate();

            MainChrome.Volume = (MainChrome.Volume);

            /*
             * LowVol.Source = GetImageSource("round_volume_down_white_48dp.png");
             * MaxVol.Source = GetImageSource("round_volume_up_white_48dp.png");*/

            //   UserDialogs.Instance.TimePrompt(new TimePromptConfig() { CancelText = "Cancel", Title = "da", Use24HourClock = false, OkText = "OK", IsCancellable = true });
        }
Ejemplo n.º 9
0
 public override void OnStop()
 {
     MainChrome.JustStopVideo();
 }
Ejemplo n.º 10
0
 public override void OnSeekTo(long pos)
 {
     MainChrome.SetChromeTime(pos / 1000.0);
 }
Ejemplo n.º 11
0
 public override void OnPlay()
 {
     MainChrome.PauseAndPlay(false);
 }
Ejemplo n.º 12
0
 public override void OnPause()
 {
     MainChrome.PauseAndPlay(true);
 }