Example #1
0
        public void StartDownloadManager(string title, Get_Movies_Object.Movie video)
        {
            try
            {
                if (video != null && !string.IsNullOrEmpty(title))
                {
                    Video = video;
                    SqLiteDatabase dbDatabase = new SqLiteDatabase();
                    dbDatabase.Insert_WatchOfflineVideos(Video);
                    dbDatabase.Dispose();

                    Request.SetTitle(title);
                    Request.SetAllowedNetworkTypes(DownloadNetwork.Mobile | DownloadNetwork.Wifi);
                    Request.SetDestinationInExternalPublicDir("/" + Settings.Application_Name + "/Video/Movie/", Filename);
                    Request.SetNotificationVisibility(DownloadVisibility.Visible);
                    Request.SetAllowedOverRoaming(true);
                    Request.SetVisibleInDownloadsUi(true);
                    DownloadID = Downloadmanager.Enqueue(Request);

                    OnDownloadComplete onDownloadComplete = new OnDownloadComplete();
                    Application.Context.ApplicationContext.RegisterReceiver(onDownloadComplete, new IntentFilter(DownloadManager.ActionDownloadComplete));
                }
                else
                {
                    Toast.MakeText(ContextActivty, Application.Context.GetText(Resource.String.Lbl_Download_faileds), ToastLength.Short).Show();
                }
            }
            catch (Exception exception)
            {
                Crashes.TrackError(exception);
            }
        }
Example #2
0
        public void LoadVideo_Data(Get_Movies_Object.Movie videoObject)
        {
            try
            {
                if (ActivityName != "Viewer_Video")
                {
                    Exo_back_button.SetImageResource(Resource.Drawable.ic_action_arrow_down_sign);
                    Exo_back_button.Tag = "Open";
                }

                if (videoObject != null)
                {
                    Video_Titile.Text = videoObject.name;

                    Video_QualityTextView.Text  = videoObject.quality.ToUpperInvariant();
                    Video_ViewsNumber.Text      = videoObject.views + " " + ActivityContext.GetText(Resource.String.Lbl_Views);
                    Video_videoDate.Text        = ActivityContext.GetText(Resource.String.Lbl_Published_on) + " " + videoObject.release;
                    Video_videoDescription.Text = IMethods.Fun_String.DecodeString(IMethods.Fun_String.DecodeStringWithEnter(videoObject.description));
                    Video_videoCategory.Text    = videoObject.genre;
                    Video_Stars.Text            = videoObject.stars;
                    Video_Tag.Text = videoObject.producer;

                    TextSanitizerAutoLink.Load(videoObject.description);
                }
            }
            catch (Exception exception)
            {
                Crashes.TrackError(exception);
            }
        }
Example #3
0
 // Function movie
 public void Add(Get_Movies_Object.Movie movie)
 {
     try
     {
         var check = mMoviesList.FirstOrDefault(a => a.id == movie.id);
         if (check == null)
         {
             mMoviesList.Add(movie);
             NotifyItemInserted(mMoviesList.IndexOf(mMoviesList.Last()));
         }
     }
     catch (Exception exception)
     {
         Crashes.TrackError(exception);
     }
 }
Example #4
0
        //Event Menu >> Cope Link
        public void OnMenu_CopeLink_Click(Get_Movies_Object.Movie video)
        {
            try
            {
                var clipboardManager = (ClipboardManager)ActivityContext.GetSystemService(Context.ClipboardService);

                ClipData clipData = ClipData.NewPlainText("text", video.url);
                clipboardManager.PrimaryClip = clipData;

                Toast.MakeText(ActivityContext, ActivityContext.GetText(Resource.String.Lbl_Copied), ToastLength.Short).Show();
            }
            catch (Exception exception)
            {
                Crashes.TrackError(exception);
            }
        }
Example #5
0
        //Event Menu >> Cope Link
        private void OnCopeLink_Button_Click(Get_Movies_Object.Movie movie)
        {
            try
            {
                var clipboardManager = (ClipboardManager)Activity_Context.GetSystemService(Context.ClipboardService);

                var clipData = ClipData.NewPlainText("text", movie.url);
                clipboardManager.PrimaryClip = clipData;

                Toast.MakeText(Activity_Context, Activity_Context.GetText(Resource.String.Lbl_Copied),
                               ToastLength.Short).Show();
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }
Example #6
0
        //Event Menu >> Share
        private async void OnShare_Button_Click(Get_Movies_Object.Movie movie)
        {
            try
            {
                //Share Plugin same as video
                if (!CrossShare.IsSupported)
                {
                    return;
                }

                await CrossShare.Current.Share(new ShareMessage
                {
                    Title = movie.name,
                    Text  = movie.description,
                    Url   = movie.url
                });
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }
Example #7
0
        //Event Menu >> Share
        public async void OnMenu_ShareIcon_Click(Get_Movies_Object.Movie video)
        {
            try
            {
                //Share Plugin same as flame
                if (!CrossShare.IsSupported)
                {
                    return;
                }

                await CrossShare.Current.Share(new ShareMessage
                {
                    Title = Videodata.name,
                    Text  = Videodata.description,
                    Url   = Videodata.url
                });
            }
            catch (Exception exception)
            {
                Crashes.TrackError(exception);
            }
        }
Example #8
0
        public void Initialize(Movies_AdapterViewHolder holder, Get_Movies_Object.Movie movie)
        {
            try
            {
                var CoverSplit     = movie.cover.Split('/').Last();
                var getImage_Cover = IMethods.MultiMedia.GetMediaFrom_Disk(IMethods.IPath.FolderDiskMovie, CoverSplit);
                if (getImage_Cover != "File Dont Exists")
                {
                    if (holder.VideoImage.Tag?.ToString() != "loaded")
                    {
                        ImageServiceLoader.Load_Image(holder.VideoImage, "ImagePlacholder.jpg", getImage_Cover);
                        holder.VideoImage.Tag = "loaded";
                    }
                }
                else
                {
                    if (holder.VideoImage.Tag?.ToString() != "loaded")
                    {
                        IMethods.MultiMedia.DownloadMediaTo_DiskAsync(IMethods.IPath.FolderDiskMovie, movie.cover);
                        ImageServiceLoader.Load_Image(holder.VideoImage, "ImagePlacholder.jpg", movie.cover);
                        holder.VideoImage.Tag = "loaded";
                    }
                }

                string name = IMethods.Fun_String.DecodeString(IMethods.Fun_String.DecodeStringWithEnter(movie.name));
                holder.Txt_Title.Text       = name;
                holder.Txt_Description.Text = IMethods.Fun_String.SubStringCutOf(movie.description, 50);
                holder.Txt_duration.Text    = movie.duration + " " + Activity_Context.GetText(Resource.String.Lbl_Min);
                holder.Txt_ViewsCount.Text  = movie.views + " " + Activity_Context.GetText(Resource.String.Lbl_Views);

                IMethods.Set_TextViewIcon("1", holder.MenueView, IonIcons_Fonts.AndroidMoreVertical);

                if (!holder.MenueView.HasOnClickListeners)
                {
                    holder.MenueView.Click += (sender, args) =>
                    {
                        try
                        {
                            var ctw   = new ContextThemeWrapper(Activity_Context, Resource.Style.PopupMenuStyle);
                            var popup = new PopupMenu(ctw, holder.MenueView);
                            popup.MenuInflater.Inflate(Resource.Menu.MoreCommunities_NotEdit_Menu, popup.Menu);
                            popup.Show();
                            popup.MenuItemClick += (o, eventArgs) =>
                            {
                                var Id = eventArgs.Item.ItemId;
                                switch (Id)
                                {
                                case Resource.Id.menu_CopeLink:
                                    OnCopeLink_Button_Click(movie);
                                    break;

                                case Resource.Id.menu_Share:
                                    OnShare_Button_Click(movie);
                                    break;
                                }
                            };
                        }
                        catch (Exception e)
                        {
                            Crashes.TrackError(e);
                        }
                    }
                }
                ;
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }
Example #9
0
        public void PlayVideo(string videoUrL, Get_Movies_Object.Movie videoObject)
        {
            try
            {
                if (videoObject != null)
                {
                    Videodata = videoObject;

                    LoadVideo_Data(videoObject);

                    ReleaseVideo();

                    if (Settings.Allow_Offline_Download == false)
                    {
                        Download_icon.Visibility = ViewStates.Gone;
                    }

                    mFullScreenIcon.SetImageDrawable(ActivityContext.GetDrawable(Resource.Drawable.ic_action_ic_fullscreen_expand));

                    Android.Net.Uri videoURL;
                    if (!string.IsNullOrEmpty(videoUrL))
                    {
                        videoURL = Android.Net.Uri.Parse(videoUrL);
                    }
                    else
                    {
                        videoURL = Android.Net.Uri.Parse(Videodata.source);
                    }

                    mainHandler = new Handler();

                    AdaptiveTrackSelection.Factory videoTrackSelectionFactory = new AdaptiveTrackSelection.Factory(BANDWIDTH_METER);
                    DefaultTrackSelector           trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory);

                    Player = ExoPlayerFactory.NewSimpleInstance(ActivityContext, trackSelector);
                    DefaultDatamediaFactory = new DefaultDataSourceFactory(ActivityContext, Util.GetUserAgent(ActivityContext, Settings.Application_Name), BANDWIDTH_METER);

                    // Produces DataSource instances through which media data is loaded.
                    ExtractorMediaSource DefaultSource = new ExtractorMediaSource(videoURL, DefaultDatamediaFactory, new DefaultExtractorsFactory(), mainHandler, eventLogger);

                    videoSource = null;

                    //Set Interactive Media Ads
                    if (Player_Settings.ShowInteractiveMediaAds)
                    {
                        videoSource = CreateAdsMediaSource(DefaultSource, Player_Settings.IMAdsUri);
                    }

                    if (simpleExoPlayerView == null)
                    {
                        Initialize();
                    }

                    //Set Cache Media Load
                    if (Player_Settings.EnableOfflineMode)
                    {
                        videoSource = videoSource == null?CreateCacheMediaSource(DefaultSource, videoURL) : CreateCacheMediaSource(videoSource, videoURL);

                        if (videoSource != null)
                        {
                            Download_icon.SetImageDrawable(ActivityContext.GetDrawable(Resource.Drawable.ic_checked_red));
                            Download_icon.Tag = "Downloaded";

                            simpleExoPlayerView.Player = Player;
                            Player.Prepare(videoSource);
                            Player.AddListener(PlayerLitsener);
                            Player.PlayWhenReady = true;

                            bool haveResumePosition = resumeWindow != C.IndexUnset;
                            if (haveResumePosition)
                            {
                                Player.SeekTo(resumeWindow, resumePosition);
                            }

                            return;
                        }
                    }

                    if (videoSource == null)
                    {
                        if (!string.IsNullOrEmpty(videoUrL))
                        {
                            if (videoUrL.Contains("youtube") || videoUrL.Contains("Youtube") || videoUrL.Contains("youtu"))
                            {
                                Task.Run(async() =>
                                {
                                    var newurl  = await VideoInfoRetriever.GetEmbededVideo(Videodata.source);
                                    videoSource = CreateDefaultMediaSource(Android.Net.Uri.Parse(newurl));
                                });
                            }
                            else
                            {
                                videoSource = CreateDefaultMediaSource(Android.Net.Uri.Parse(videoUrL));

                                simpleExoPlayerView.Player = Player;
                                Player.Prepare(videoSource);
                                Player.AddListener(PlayerLitsener);
                                Player.PlayWhenReady = true;

                                bool haveResumePosition = resumeWindow != C.IndexUnset;
                                if (haveResumePosition)
                                {
                                    Player.SeekTo(resumeWindow, resumePosition);
                                }
                            }
                        }
                    }
                    else
                    {
                        simpleExoPlayerView.Player = Player;
                        Player.Prepare(videoSource);
                        Player.AddListener(PlayerLitsener);
                        Player.PlayWhenReady = true;

                        bool haveResumePosition = resumeWindow != C.IndexUnset;
                        if (haveResumePosition)
                        {
                            Player.SeekTo(resumeWindow, resumePosition);
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                Crashes.TrackError(exception);
            }
        }