public void AddToWatchLater(VideoObject video, int count = 0) { try { if (UserDetails.IsLogin) { var item = ActivityContext?.LibraryFragment?.MAdapter?.LibraryList?.FirstOrDefault(a => a.SectionId == "2"); if (item == null) { return; } item.VideoCount = count != 0 ? count : item.VideoCount + 1; if (video != null) { item.BackgroundImage = video.Thumbnail; } else { item.BackgroundImage = "blackdefault"; item.VideoCount = 0; } ActivityContext?.LibraryFragment?.MAdapter?.NotifyItemChanged(1); } else { PopupDialogController dialog = new PopupDialogController(Activity, video, "Login"); dialog.ShowNormalDialog(Activity.GetText(Resource.String.Lbl_Warning), Activity.GetText(Resource.String.Lbl_Please_sign_in_WatchLater), Activity.GetText(Resource.String.Lbl_Yes), Activity.GetText(Resource.String.Lbl_No)); } } catch (Exception e) { Console.WriteLine(e); } }
public async void ShareVideo(VideoObject video) { try { //Share Plugin same as video if (!CrossShare.IsSupported) { return; } await CrossShare.Current.Share(new ShareMessage { Title = video.Title, Text = video.Description, Url = video.Url }); var sqlEntity = new SqLiteDatabase(); sqlEntity.Insert_SharedVideos(video); sqlEntity.Dispose(); AddToShareVideo(video); } catch (Exception exception) { Console.WriteLine(exception); } }
public void AddToPlaylist(VideoObject video) { try { if (Methods.CheckConnectivity()) { if (UserDetails.IsLogin) { PopupDialogController dialog = new PopupDialogController(ActivityContext, video, "PlayList"); dialog.ShowPlayListDialog(); } else { PopupDialogController dialog = new PopupDialogController(ActivityContext, video, "Login"); dialog.ShowNormalDialog(Activity.GetText(Resource.String.Lbl_Warning), Activity.GetText(Resource.String.Lbl_Please_sign_in_playlist), Activity.GetText(Resource.String.Lbl_Yes), Activity.GetText(Resource.String.Lbl_No)); } } else { Toast.MakeText(Activity, Activity.GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); } } catch (Exception exception) { Console.WriteLine(exception); } }
public void AddToShareVideo(VideoObject video, int count = 0) { try { var item = ActivityContext?.LibraryFragment?.MAdapter?.LibraryList?.FirstOrDefault(a => a.SectionId == "7"); if (item == null) { return; } item.VideoCount = count != 0 ? count : item.VideoCount + 1; if (video != null) { item.BackgroundImage = video.Thumbnail; } else { item.BackgroundImage = "blackdefault"; item.VideoCount = 0; } ActivityContext?.LibraryFragment?.MAdapter?.NotifyItemChanged(6); var sqlEntity = new SqLiteDatabase(); sqlEntity.InsertLibraryItem(item); sqlEntity.Dispose(); } catch (Exception exception) { Console.WriteLine(exception); } }
public async Task <VideoDetailResponse> VideoDetail(VideoDetailRequest request) { try { using (IDbConnection connection = new SqlConnection(_configuration.GetValue <string>("ConnectionStrings:DefaultConnection"))) { VideoObject video = new VideoObject(); DynamicParameters parameters = new DynamicParameters(); parameters.Add("@id", request.Id); parameters.Add("@portalid", request.PortalId); await Task.Run(() => video = connection.Query <VideoObject>("Videos_SelectByID", parameters, null, true, null, CommandType.StoredProcedure).FirstOrDefault() ); return(new VideoDetailResponse { Status = ResponseStatus.Success, Message = ResponseStatus.Success.ToString(), Video = video, }); } } catch (Exception ex) { return(new VideoDetailResponse { Status = ResponseStatus.Faile, Message = ex.Message, }); } }
public void ChangeVideo(int selectionIndex) { videosList[findUIIndex(curVideo)].selected = false; pCInterface.player.Stop(); rendTex.Release(); curVideo = videosList[selectionIndex].thisVideo; rendTex.width = (int)curVideo.videoClip.width; rendTex.height = (int)curVideo.videoClip.height; switch (curVideo.layout) { case VideoObject.MappingType.TwoD: RenderSettings.skybox = videoMats[0]; break; case VideoObject.MappingType.OverUnder: RenderSettings.skybox = videoMats[1]; break; case VideoObject.MappingType.SideBySide: RenderSettings.skybox = videoMats[2]; break; } videosList[selectionIndex].selected = true; pCInterface.player.clip = curVideo.videoClip; }
private void OnMenuRemove_Click(VideoObject video) { try { var index = SubscriptionsList.IndexOf(SubscriptionsList.FirstOrDefault(a => a.VideoData?.VideoId == video.VideoId)); if (index != -1) { SubscriptionsList.RemoveAt(index); NotifyItemRemoved(index); Toast.MakeText(ActivityContext, ActivityContext.GetText(Resource.String.Lbl_Video_Removed), ToastLength.Short).Show(); var data = ListUtils.GlobalNotInterestedList.FirstOrDefault(a => a.VideoId == video.VideoId); if (data == null) { ListUtils.GlobalNotInterestedList.Add(video); } var sqlEntity = new SqLiteDatabase(); sqlEntity.Insert_NotInterestedVideos(video); sqlEntity.Dispose(); } } catch (Exception exception) { Console.WriteLine(exception); } }
public void ToString_VideoGoogleStructuredData_ReturnsExpectedJsonLd() { var videoObject = new VideoObject() { Name = "Title", // Required Description = "Video description", // Required ThumbnailUrl = new Uri("https://www.example.com/thumbnail.jpg"), // Required Expires = new DateTimeOffset(2016, 2, 5, 8, 0, 0, TimeSpan.Zero), // Recommended UploadDate = new DateTimeOffset(2015, 2, 5, 8, 0, 0, TimeSpan.Zero), // Required Duration = new TimeSpan(0, 1, 33), // Recommended Publisher = new Organization() { Name = "Example Publisher", // Required Logo = new ImageObject() // Required { Height = 60, // Required Url = new Uri("https://example.com/logo.jpg"), // Required Width = 600 // Required } }, ContentUrl = new Uri("https://www.example.com/video123.flv"), // Recommended EmbedUrl = new Uri("https://www.example.com/videoplayer.swf?video=123"), // Recommended InteractionStatistic = new InteractionCounter() { UserInteractionCount = 2347 // Recommended }, }; var expectedJson = "{" + "\"@context\":\"http://schema.org\"," + "\"@type\":\"VideoObject\"," + "\"name\":\"Title\"," + "\"description\":\"Video description\"," + "\"interactionStatistic\":{" + "\"@type\":\"InteractionCounter\"," + "\"userInteractionCount\":2347" + "}," + "\"publisher\":{" + "\"@type\":\"Organization\"," + "\"name\":\"Example Publisher\"," + "\"logo\":{" + "\"@type\":\"ImageObject\"," + "\"url\":\"https://example.com/logo.jpg\"," + "\"height\":60," + "\"width\":600" + "}" + "}," + "\"thumbnailUrl\":\"https://www.example.com/thumbnail.jpg\"," + "\"contentUrl\":\"https://www.example.com/video123.flv\"," + "\"duration\":\"PT1M33S\"," + "\"embedUrl\":\"https://www.example.com/videoplayer.swf?video=123\"," + "\"expires\":\"2016-02-05T08:00:00+00:00\"," + "\"uploadDate\":\"2015-02-05T08:00:00+00:00\"" + "}"; var json = videoObject.ToString(); Assert.Equal(expectedJson, json); }
/// <summary> /// 分享视频 /// </summary> /// <param name="videoObject">视频信息</param> /// <param name="thumbnail">缩略图</param> /// <param name="url">点击链接 URI</param> /// <param name="title">标题</param> /// <param name="description">描述</param> /// <returns>是否发送成功,不等于分享成功</returns> public bool ShareVideo(VideoObject videoObject, Bitmap thumbnail = null, string url = null, string title = null, string description = null) { if (thumbnail != null) { videoObject.SetThumbImage(thumbnail); } set(videoObject, url, title, description); return(Share(videoObject)); }
private void initLibrary() { string path = @"Database\MaterialItems.txt"; string[] materialData; materialData = File.ReadAllLines(path); foreach (string data in materialData) { string[] datas = data.Split('|'); string name = datas[1]; string author = datas[2]; string publisher = datas[3]; DateTime publishDate = Convert.ToDateTime(datas[4]); int stock = 0; bool isFile = false; if (datas[5] == "F") { isFile = true; stock = 0; } else { stock = Convert.ToInt16(datas[5]); } string type = datas[6]; switch (datas[0]) { case "Book": BookObject newBook = new BookObject(name, author, publisher, publishDate, stock); BookObserver newBookObserver = new BookObserver(newBook); this.materialList.Add(newBookObserver); break; case "EBook": EBookObject newEBook = new EBookObject(name, author, publisher, publishDate); EBookObserver newEBookObserver = new EBookObserver(newEBook); this.materialList.Add(newEBookObserver); break; case "Video": VideoObject newVideo = new VideoObject(name, type, author, publishDate, publisher, isFile, stock); VideoObserver newVideoObserver = new VideoObserver(newVideo); this.materialList.Add(newVideoObserver); break; case "Audio": AudioObject newAudio = new AudioObject(name, type, author, publishDate, publisher, isFile, stock); AudioObserver newAudioObserver = new AudioObserver(newAudio); this.materialList.Add(newAudioObserver); break; default: break; } } return; }
private static void SetLinkWithQuality(VideoObject videoData) { try { if (videoData == null || !string.IsNullOrEmpty(videoData.Twitch) || !string.IsNullOrEmpty(videoData.Vimeo) || !string.IsNullOrEmpty(videoData.Youtube) || !string.IsNullOrEmpty(videoData.Ok) || !string.IsNullOrEmpty(videoData.Daily) || !string.IsNullOrEmpty(videoData.Facebook) || videoData.VideoType == "VideoObject/youtube" || videoData.VideoLocation.Contains("Youtube") || videoData.VideoLocation.Contains("youtu")) { return; } var explodeVideo = videoData.VideoLocation.Split("_video"); if (explodeVideo.Length <= 0) { return; } videoData.VideoAuto = explodeVideo[1].Replace("video", "").Replace("converted.mp4", "").Replace("_", ""); if (videoData.The240P == "1" && string.IsNullOrEmpty(videoData.Video240P)) { videoData.Video240P = explodeVideo[0] + "_video_240p_converted.mp4"; } if (videoData.The360P == "1" && string.IsNullOrEmpty(videoData.Video360P)) { videoData.Video360P = explodeVideo[0] + "_video_360p_converted.mp4"; } if (videoData.The480P == "1" && string.IsNullOrEmpty(videoData.Video480P)) { videoData.Video480P = explodeVideo[0] + "_video_480p_converted.mp4"; } if (videoData.The720P == "1" && string.IsNullOrEmpty(videoData.Video720P)) { videoData.Video720P = explodeVideo[0] + "_video_720p_converted.mp4"; } if (videoData.The1080P == "1" && string.IsNullOrEmpty(videoData.Video1080P)) { videoData.Video1080P = explodeVideo[0] + "_video_1080p_converted.mp4"; } if (videoData.The4096P == "1" && string.IsNullOrEmpty(videoData.Video4096P)) { videoData.Video4096P = explodeVideo[0] + "_video_4096p_converted.mp4"; } if (videoData.The2048P == "1" && string.IsNullOrEmpty(videoData.Video2048P)) { videoData.Video2048P = explodeVideo[0] + "_video_2048p_converted.mp4"; } } catch (Exception e) { Console.WriteLine(e); } }
public int findUIIndex(VideoObject vidToFind) { for (int i = 0; i < videosList.Length; i++) { if (videosList[i].thisVideo == vidToFind) { return(i); } } return(0); }
public static string GetLinkWithQuality(VideoObject videoData, string quality) { try { if (videoData == null || !string.IsNullOrEmpty(videoData.Twitch) || !string.IsNullOrEmpty(videoData.Vimeo) || !string.IsNullOrEmpty(videoData.Youtube) || !string.IsNullOrEmpty(videoData.Ok) || !string.IsNullOrEmpty(videoData.Daily) || !string.IsNullOrEmpty(videoData.Facebook) || videoData.VideoType == "VideoObject/youtube" || videoData.VideoLocation.Contains("Youtube") || videoData.VideoLocation.Contains("youtu")) { return(videoData?.VideoLocation ?? ""); } if (quality.Contains("Auto") && !string.IsNullOrEmpty(videoData.VideoAuto)) { return(videoData.VideoAuto); } if (quality.Contains("240p") && videoData.The240P == "1" && !string.IsNullOrEmpty(videoData.Video240P)) { return(videoData.Video240P); } if (quality.Contains("360p") && videoData.The360P == "1" && !string.IsNullOrEmpty(videoData.Video360P)) { return(videoData.Video360P); } if (quality.Contains("480p") && videoData.The480P == "1" && !string.IsNullOrEmpty(videoData.Video480P)) { return(videoData.Video480P); } if (quality.Contains("720p") && videoData.The720P == "1" && !string.IsNullOrEmpty(videoData.Video720P)) { return(videoData.Video720P); } if (quality.Contains("1080p") && videoData.The1080P == "1" && !string.IsNullOrEmpty(videoData.Video1080P)) { return(videoData.Video1080P); } if (quality.Contains("4096p") && videoData.The4096P == "1" && !string.IsNullOrEmpty(videoData.Video4096P)) { return(videoData.Video4096P); } if (quality.Contains("2048p") && videoData.The2048P == "1" && !string.IsNullOrEmpty(videoData.Video2048P)) { return(videoData.Video2048P); } return(videoData.VideoLocation ?? ""); } catch (Exception e) { Console.WriteLine(e); return(videoData?.VideoLocation ?? ""); } }
public static void ShowGlobalBadgeSystem(TextView videoTypeIcon, VideoObject item) { try { if (!string.IsNullOrEmpty(item.Twitch) && AppSettings.SetTwichTypeBadgeIcon) { videoTypeIcon.Visibility = ViewStates.Visible; FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, videoTypeIcon, IonIconsFonts.SocialTwitch); videoTypeIcon.BackgroundTintList = ColorStateList.ValueOf(Color.ParseColor("#6441A4")); } else if (!string.IsNullOrEmpty(item.Vimeo) && AppSettings.SetVimeoTypeBadgeIcon) { FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, videoTypeIcon, IonIconsFonts.SocialVimeo); videoTypeIcon.Visibility = ViewStates.Visible; videoTypeIcon.BackgroundTintList = ColorStateList.ValueOf(Color.ParseColor("#0D94CD")); } else if (!string.IsNullOrEmpty(item.Youtube) && AppSettings.SetYoutubeTypeBadgeIcon) { FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, videoTypeIcon, IonIconsFonts.SocialYoutube); videoTypeIcon.Visibility = ViewStates.Visible; videoTypeIcon.BackgroundTintList = ColorStateList.ValueOf(Color.ParseColor("#FF0000")); } else if (!string.IsNullOrEmpty(item.Ok) && AppSettings.SetOkTypeBadgeIcon) { videoTypeIcon.Text = "Ok"; videoTypeIcon.Visibility = ViewStates.Visible; videoTypeIcon.BackgroundTintList = ColorStateList.ValueOf(Color.ParseColor("#F0932A")); } else if (!string.IsNullOrEmpty(item.Daily) && AppSettings.SetDailyMotionTypeBadgeIcon) { videoTypeIcon.Text = "d"; videoTypeIcon.Visibility = ViewStates.Visible; videoTypeIcon.BackgroundTintList = ColorStateList.ValueOf(Color.ParseColor("#00d2f3")); } else if (!string.IsNullOrEmpty(item.Facebook) && AppSettings.SetFacebookTypeBadgeIcon) { videoTypeIcon.Text = "FB"; videoTypeIcon.Visibility = ViewStates.Visible; videoTypeIcon.BackgroundTintList = ColorStateList.ValueOf(Color.ParseColor("#3b5999")); } else { videoTypeIcon.Visibility = ViewStates.Gone; } } catch (Exception e) { Console.WriteLine(e); } }
//Event Menu >> Help public void OnMenuHelpClick(VideoObject videoObject) { try { var intent = new Intent(Activity, typeof(LocalWebViewActivity)); intent.PutExtra("URL", Client.WebsiteUrl + "/contact-us"); intent.PutExtra("Type", Activity.GetText(Resource.String.Lbl_Help)); Activity.StartActivity(intent); } catch (Exception exception) { Console.WriteLine(exception); } }
public void SetVideoIframe(VideoObject videoObject) { try { //DisplayMetrics displayMetrics = new DisplayMetrics(); //Activity.WindowManager.DefaultDisplay.GetMetrics(displayMetrics); //int width = Resources.Configuration.ScreenWidthDp; //int height = Resources.Configuration.ScreenHeightDp; //Console.WriteLine(width+ " , " + height); string videoIframe = string.Empty; if (!string.IsNullOrEmpty(videoObject.Vimeo)) { videoObject.VideoType = "Vimeo"; videoIframe = "https://player.vimeo.com/video/" + videoObject.Vimeo + "?autoplay=1"; } else if (!string.IsNullOrEmpty(videoObject.Twitch)) { videoObject.VideoType = "Twitch"; videoIframe = "https://player.twitch.tv/?autoplay=true&video=" + videoObject.Twitch; } else if (!string.IsNullOrEmpty(videoObject.Daily)) { videoObject.VideoType = "Daily"; videoIframe = "https://www.dailymotion.com/embed/video/" + videoObject.Daily + "?autoPlay=1"; } else if (!string.IsNullOrEmpty(videoObject.Ok)) { videoObject.VideoType = "Ok"; videoIframe = "https://ok.ru/videoembed/" + videoObject.Ok + "?autoplay=1"; } else if (!string.IsNullOrEmpty(videoObject.Facebook)) { videoObject.VideoType = "Facebook"; videoIframe = "https://www.facebook.com/video/embed?video_id=" + videoObject.Facebook; } if (!string.IsNullOrEmpty(videoIframe)) { WebViewPlayer.LoadUrl(videoIframe); } } catch (Exception e) { Console.WriteLine(e); } }
public void PlayVideo(string videoUrL, VideoObject videoObject, long resumePosition) { try { if (Player != null) { SetStopvideo(); Player?.Release(); Player = null; //GC Collecter GC.Collect(); } AdaptiveTrackSelection.Factory trackSelectionFactory = new AdaptiveTrackSelection.Factory(); var trackSelector = new DefaultTrackSelector(trackSelectionFactory); var newParameters = new DefaultTrackSelector.ParametersBuilder() .SetMaxVideoSizeSd() .SetPreferredAudioLanguage("deu") .Build(); trackSelector.SetParameters(newParameters); Player = ExoPlayerFactory.NewSimpleInstance(ActivityContext, trackSelector); FullWidthSetting(); DefaultDataMediaFactory = new DefaultDataSourceFactory(ActivityContext, Util.GetUserAgent(ActivityContext, AppSettings.ApplicationName), BandwidthMeter); VideoSource = null; VideoSource = GetMediaSourceFromUrl(Uri.Parse(videoUrL), "normal"); SimpleExoPlayerView.Player = Player; Player.Prepare(VideoSource); Player.AddListener(PlayerListener); Player.PlayWhenReady = true; Player.AddVideoListener(this); bool haveResumePosition = ResumeWindow != C.IndexUnset; if (haveResumePosition) { Player.SeekTo(ResumeWindow, resumePosition); } } catch (Exception e) { Console.WriteLine(e); } }
public FullViewVideoVM(VideoObject videoObject, string email) { this._email = email; this._videoObject = videoObject; //Subscribe to event from FullViewVideoPage OnAppearing override method to load page then video => appears as better performance MessagingCenter.Subscribe <FullViewVideoPage>(this, "LoadPage", (sender) => { Download(); }); //Subscribe to event from FullViewVideoPage OnDisappearing override method to check state of download button MessagingCenter.Subscribe <FullViewVideoPage>(this, "BackButtonPressed", (sender) => { //check to see if download button clicked, delete video if not clicked CheckDownloadButtonState(); }); }
public void AddToSubscriptions(VideoObject video, int count = 0) { try { if (UserDetails.IsLogin) { var item = ActivityContext?.LibraryFragment?.MAdapter?.LibraryList?.FirstOrDefault(a => a.SectionId == "1"); if (item == null) { return; } if (count != 0) { item.VideoCount = count; } else { item.VideoCount = item.VideoCount + 1; } if (video != null) { item.BackgroundImage = video.Thumbnail; } else { item.BackgroundImage = "blackdefault"; item.VideoCount = 0; } ActivityContext?.LibraryFragment?.MAdapter?.NotifyItemChanged(0); var sqlEntity = new SqLiteDatabase(); sqlEntity.InsertLibraryItem(item); sqlEntity.Dispose(); } else { PopupDialogController dialog = new PopupDialogController(Activity, video, "Login"); dialog.ShowNormalDialog(Activity.GetText(Resource.String.Lbl_Warning), Activity.GetText(Resource.String.Lbl_Please_sign_in_Subcribed), Activity.GetText(Resource.String.Lbl_Yes), Activity.GetText(Resource.String.Lbl_No)); } } catch (Exception e) { Console.WriteLine(e); } }
public static string GetCategoryName(VideoObject videoObject) { try { if (videoObject == null) { return(Application.Context.GetString(Resource.String.Lbl_Unknown)); } if (videoObject.IsMovie == "1") { string name = Methods.FunString.DecodeString(ListCategoriesMovies?.FirstOrDefault(a => a.Id == (videoObject.CategoryId))?.Name); if (!string.IsNullOrEmpty(name)) { return(name); } } else if (!string.IsNullOrEmpty(videoObject.CategoryId) && !string.IsNullOrEmpty(videoObject.SubCategory) && videoObject.SubCategory != "0") { var category = ListCategories?.FirstOrDefault(a => a.Id == videoObject.CategoryId); if (category != null) { string name = Methods.FunString.DecodeString(category.SubList.FirstOrDefault(a => a.Id == (videoObject.CategoryId))?.Name); if (!string.IsNullOrEmpty(name)) { return(name); } } } else { string name = Methods.FunString.DecodeString(ListCategories?.FirstOrDefault(a => a.Id == (videoObject.CategoryId))?.Name); if (!string.IsNullOrEmpty(name)) { return(name); } } return(Application.Context.GetString(Resource.String.Lbl_Unknown)); } catch (Exception e) { Console.WriteLine(e); return(Application.Context.GetString(Resource.String.Lbl_Unknown)); } }
public static List <string> GetListQualityVideo(VideoObject videoData) { try { var arrayAdapter = new List <string>(); if (!string.IsNullOrEmpty(videoData.VideoAuto)) { arrayAdapter.Add("Auto (" + videoData.VideoAuto + ")"); } if (videoData.The240P == "1") { arrayAdapter.Add("240p"); } if (videoData.The360P == "1") { arrayAdapter.Add("360p"); } if (videoData.The480P == "1") { arrayAdapter.Add("480p"); } if (videoData.The720P == "1") { arrayAdapter.Add("720p - HD"); } if (videoData.The1080P == "1") { arrayAdapter.Add("1080p - HD"); } if (videoData.The4096P == "1") { arrayAdapter.Add("4096p - 4K"); } if (videoData.The2048P == "1") { arrayAdapter.Add("2048p - 4K"); } return(arrayAdapter); } catch (Exception e) { Console.WriteLine(e); return(new List <string>()); } }
private void SetData() { try { VideoClass = JsonConvert.DeserializeObject <VideoObject>(Arguments.GetString("ItemDataVideo")); if (VideoClass == null) { return; } GlideImageLoader.LoadImage(Activity, VideoClass.Thumbnail, Image, ImageStyle.CenterCrop, ImagePlaceholders.Drawable); TitleEditText.Text = Methods.FunString.DecodeString(VideoClass.Title); DescriptionEditText.Text = Methods.FunString.DecodeString(VideoClass.Description); TagsEditText.Text = VideoClass.Tags; CategoryEditText.Text = CategoriesController.GetCategoryName(VideoClass); AgeRestrictionEditText.Text = GetString(VideoClass.AgeRestriction == "1" ? Resource.String.Lbl_AgeRestrictionText0 : Resource.String.Lbl_AgeRestrictionText1); switch (VideoClass.Privacy) { case "0": //Public PrivacyEditText.Text = GetText(Resource.String.Radio_public); break; case "1": //Private PrivacyEditText.Text = GetText(Resource.String.Radio_private); break; case "2": //Unlisted PrivacyEditText.Text = GetText(Resource.String.Lbl_Unlisted); break; } Privacy = VideoClass.Privacy; IdCategory = VideoClass.CategoryId; IdAgeRestriction = VideoClass.AgeRestriction; PathImage = VideoClass.Thumbnail; } catch (Exception e) { Console.WriteLine(e); } }
public void AddReportVideo(VideoObject video) { try { if (UserDetails.IsLogin) { PopupDialogController dialog = new PopupDialogController(Activity, video, "Report"); dialog.ShowEditTextDialog(Activity.GetText(Resource.String.Lbl_Report_This_Video), Activity.GetText(Resource.String.Lbl_Report_This_Video_Text), Activity.GetText(Resource.String.Lbl_Submit), Activity.GetText(Resource.String.Lbl_Cancel)); } else { PopupDialogController dialog = new PopupDialogController(Activity, video, "Login"); dialog.ShowNormalDialog(Activity.GetText(Resource.String.Lbl_Warning), Activity.GetText(Resource.String.Lbl_Please_sign_in_Report), Activity.GetText(Resource.String.Lbl_Yes), Activity.GetText(Resource.String.Lbl_No)); } } catch (Exception exception) { Console.WriteLine(exception); } }
private void OnVideoObjectClicked(VideoObject sender) { if (_clicked) { return; } _clicked = true; int answer = Array.IndexOf(_videosObjects, sender); bool rightAnswer = answer == _goodAnswer; sender.Feedback(rightAnswer); if (!rightAnswer) { _videosObjects[_goodAnswer].Feedback(true); } DOVirtual.DelayedCall(1f, () => OnQuestionAnswered?.Invoke(answer, rightAnswer)); }
public void PlayFullScreen(VideoObject videoObject) { try { VideoData = videoObject; if (FullScreenPlayerView != null) { Player.AddListener(PlayerListener); Player.AddVideoListener(this); FullScreenPlayerView.Player = Player; if (FullScreenPlayerView.Player != null) { FullScreenPlayerView.Player.PlayWhenReady = true; } MFullScreenIcon.SetImageDrawable(ActivityContext.GetDrawable(Resource.Drawable.ic_action_ic_fullscreen_skrink)); } } catch (Exception exception) { Console.WriteLine(exception); } }
public void StartDownloadManager(string title, VideoObject video, string fromActivity) { try { if (video != null && !string.IsNullOrEmpty(title)) { Video = video; FromActivity = fromActivity; var sqlEntity = new SqLiteDatabase(); sqlEntity.Insert_WatchOfflineVideos(Video); Request.SetTitle(title); Request.SetAllowedNetworkTypes(DownloadNetwork.Mobile | DownloadNetwork.Wifi); Request.SetDestinationInExternalPublicDir("/" + AppSettings.ApplicationName + "/Video/", Filename); Request.SetNotificationVisibility(DownloadVisibility.Visible); Request.SetAllowedOverRoaming(true); DownloadId = Downloadmanager.Enqueue(Request); var onDownloadComplete = new OnDownloadComplete { ActivityContext = ActivityContext, TypeActivity = fromActivity, Video = Video }; ActivityContext.ApplicationContext.RegisterReceiver(onDownloadComplete, new IntentFilter(DownloadManager.ActionDownloadComplete)); } else { Toast.MakeText(ActivityContext, ActivityContext.GetText(Resource.String.Lbl_Download_faileds), ToastLength.Short).Show(); } } catch (Exception exception) { Console.WriteLine(exception); } }
//this attempts to load a video from the preloaded video cache, // stops the last video playing to this texture if nobody else is using it, // and calls a method to resize the texture if necessary. //returns true if it could find the video that has been attempted to load. //returns false if it can't. virtual public bool drawVideoToTexture(int index){ //print(videos[index] + " is ATTEMPTING TO LOAD"); //if the movie you're trying to load does not have a null name and is less than the video count if(index < videos.Count && !System.String.IsNullOrEmpty(videos[index])){ //if the list of videos actually contains that video if(videoManagerScript.preLoadedInstances.ContainsKey(videos[index])){ //get the object we want to load, selected from the name we chose VideoObject myObj = videoManagerScript.preLoadedInstances[videos[index]]; if(myObj.getErrorVideoLoading()){ //Debug.Log(gameObject.name + "VideoTexture:drawVideoToTexture:: ERROR LOADING"); return false; } playingVideoIndex = index; if(myObj == videoObject){ //Debug.Log(gameObject.name + "VideoTexture:drawVideoToTexture:: trying to load an already loaded file"); //trying to load a video that already is playing on this object. //there are a number of ways to handle this- i just chose this for myself. you may change this... myObj.setVideoPosition(0.0f); myObj.setVideoPaused(false); return true; } //cache old video VideoObject cachedObj = videoObject; //test if someone else is using the currently loaded video bool someoneElseIsUsingTheVideo = isAnyoneElseUsingThisVideo(); //assign the new video videoObject = myObj; //initialize using the volume, speed, isPaused, and loopType settings from the last video played. videoObject.initFrom(cachedObj); resizeTexturesFromVideoResolution(); //clean up the old video if(!someoneElseIsUsingTheVideo){ cachedObj.setVideoPosition(0.0f); cachedObj.setVideoPaused(true); } }//contains the video requested else{ return false; } } //array index > the videos in the queue or video requested is null string else{ print("VideoInstance::drawVideoToTexture: tried to pass a null string as video name!"); return false; } return true; }
//this will be called remotely from the plugin using assembly search, caching and call with mono_runtime_invoke //'myptr' refers to the video instance of the movie it found. if myptr is null when it returns from this method, // the plugin is saying the movie didn't load successfully. //thus, it attempts to load the next movie, if there is one in the queue to load. public static void videoLoaded(IntPtr myptr, bool loadSuccess){ VideoManager self = Camera.main.gameObject.GetComponent<VideoManager>(); VideoObject myObject = new VideoObject(); foreach(KeyValuePair<string,VideoObject> entry in self.preLoadedInstances) { if(myptr == entry.Value.getVideoInstance()) myObject = entry.Value; } if(self.videosToLoad.Count == 0){ self.loadingVideo = ""; } if(!loadSuccess){ Debug.LogError(myObject.getVideoName() + " did not load successfully, returned false from plugin."); //this is tagged as such so that the video manager inspector can display an error message. myObject.setVideoErrorLoading(true); //move on to the next video to load, and if you're not at the end of the loading list, load that. if(self.videosToLoad.Count > 0){ self.loadingVideo = self.videosToLoad[0]; self.preLoadedInstances[self.videosToLoad[0]].preLoadVideo(); self.videosToLoad.RemoveAt(0); } } else{ //Debug.LogError(myObject.getVideoName() + " DID load successfully, returned true from plugin."); //otherwise, the movie loaded successfully, //so mark the video object itself as loaded. myObject.setVideoLoaded(true); myObject.setVideoProperties(); myObject.setVideoErrorLoading(false); foreach(VideoTexture myTexture in self.myVideoTextures){ if(myTexture.videos.Count > 0 && myTexture.videos[myTexture.playingVideoIndex] == myObject.getVideoName()) myTexture.beginPlayback(); } //move on to the next, and load that. if(self.videosToLoad.Count > 0){ self.loadingVideo = self.videosToLoad[0]; self.preLoadedInstances[self.videosToLoad[0]].preLoadVideo(); self.videosToLoad.RemoveAt(0); } } }
public void PlayVideo(string videoUrL, VideoObject videoObject, RestrictedVideoFragment restrictedVideoPlayerFragment, Activity activity) { try { //RestrictedVideoPlayerFragment = restrictedVideoPlayerFragment; //ActivityFragment = activity; if (videoObject != null) { VideoData = videoObject; ReleaseVideo(); bool vidMonit = ListUtils.MySettingsList?.UsrVMon == "on" && VideoData.Monetization == "1" && VideoData.Owner.VideoMon == "1"; if (ListUtils.ArrayListPlay.Count > 0) { ListUtils.ArrayListPlay.Remove(VideoData); } var isPro = ListUtils.MyChannelList.FirstOrDefault()?.IsPro ?? "0"; if (!AppSettings.AllowOfflineDownload || AppSettings.AllowDownloadProUser && isPro == "0") { DownloadIcon.Visibility = ViewStates.Gone; } MFullScreenIcon.SetImageDrawable(ActivityContext.GetDrawable(Resource.Drawable.ic_action_ic_fullscreen_expand)); LoadingProgressBar.Visibility = ViewStates.Visible; Uri url; //Rent Or Sell if (!string.IsNullOrEmpty(VideoData.SellVideo) && VideoData.SellVideo != "0" || !string.IsNullOrEmpty(VideoData.RentPrice) && VideoData.RentPrice != "0" && AppSettings.RentVideosSystem) { if (!string.IsNullOrEmpty(VideoData.Demo) && VideoData.IsPurchased == "0") { if (!VideoData.Demo.Contains(Client.WebsiteUrl)) { VideoData.Demo = Client.WebsiteUrl + "/" + VideoData.Demo; } url = Uri.Parse(VideoData.Demo); ShowRestrictedVideo = true; } else if (VideoData.IsPurchased != "0") { url = Uri.Parse(!string.IsNullOrEmpty(videoUrL) ? videoUrL : VideoData.VideoLocation); } else { if (!string.IsNullOrEmpty(VideoData.SellVideo) && VideoData.SellVideo != "0") { ShowRestrictedVideoFragment(restrictedVideoPlayerFragment, activity, "purchaseVideo"); } else if (!string.IsNullOrEmpty(VideoData.RentPrice) && VideoData.RentPrice != "0" && AppSettings.RentVideosSystem) { ShowRestrictedVideoFragment(restrictedVideoPlayerFragment, activity, "RentVideo"); } return; } } else { url = Uri.Parse(!string.IsNullOrEmpty(videoUrL) ? videoUrL : VideoData.VideoLocation); } AdaptiveTrackSelection.Factory trackSelectionFactory = new AdaptiveTrackSelection.Factory(); var trackSelector = new DefaultTrackSelector(trackSelectionFactory); var newParameters = new DefaultTrackSelector.ParametersBuilder() .SetMaxVideoSizeSd() .SetPreferredAudioLanguage("deu") .Build(); trackSelector.SetParameters(newParameters); Player = ExoPlayerFactory.NewSimpleInstance(ActivityContext, trackSelector); FullWidthSetting(); DefaultDataMediaFactory = new DefaultDataSourceFactory(ActivityContext, Util.GetUserAgent(ActivityContext, AppSettings.ApplicationName), BandwidthMeter); VideoSource = null; // Produces DataSource instances through which media data is loaded. VideoSource = GetMediaSourceFromUrl(url, "normal"); if (SimpleExoPlayerView == null) { Initialize(); } //Set Cache Media Load if (PlayerSettings.EnableOfflineMode) { VideoSource = CreateCacheMediaSource(VideoSource, url); if (VideoSource != null) { DownloadIcon.SetImageResource(Resource.Drawable.ic_checked_red); DownloadIcon.Tag = "Downloaded"; RunVideoWithAds(VideoSource, vidMonit); return; } } //Set Interactive Media Ads if (isPro == "0" && PlayerSettings.ShowInteractiveMediaAds && vidMonit) { VideoSource = CreateMediaSourceWithAds(VideoSource, PlayerSettings.ImAdsUri); } if (VideoSource == null) { VideoSource = GetMediaSourceFromUrl(url, "normal"); RunVideoWithAds(VideoSource, vidMonit); } else { RunVideoWithAds(VideoSource, vidMonit); } } } catch (Exception exception) { Console.WriteLine(exception); } }
public PopupDialogController(Activity activity, VideoObject videoobje, string typeDialog) { ActivityContext = activity; Videodata = videoobje; TypeDialog = typeDialog; }
public void destroyVideoTexture(){ videoObject = null; videoManagerScript.removeInstance(this); killVideoTexture(videoTextureInstance); }
void OnListViewItemTapped(object sender, ItemTappedEventArgs e) { VideoObject tappedItem = e.Item as VideoObject; App.Current.MainPage.Navigation.PushAsync(new FullViewVideoPage(tappedItem, localEmail)); }
public void initFrom(VideoObject copy){ if(videoInstance != (IntPtr)0){ setVideoVolume(copy.videoVolume); setVideoSpeed(copy.videoSpeed); setVideoPaused(copy.isPaused); setVideoLoopType(copy.videoLoopType); if(copy.isPaused) setVideoFrame(0); } }
//videoLoopType public void setVideoLoopType(VideoObject.VideoLoopType loopType){ videoLoopType = loopType; if(videoInstance != (IntPtr)0) setLoopState(videoInstance, (int)videoLoopType); }
public async Task <IActionResult> IndexAsync([FromQuery] string theme, long id, CancellationToken token) { _userManager.TryGetLongUserId(User, out var userId); var query = new DocumentById(id, userId); var model = await _queryBus.QueryAsync(query, token); if (model == null) { return(NotFound()); } if (model.DuplicateId.HasValue && id != model.DuplicateId) { var url = Url.RouteUrl("ShortDocumentLink2", new { id = model.DuplicateId.Value }, "https"); Response.Headers.Add("Link", $"<{url}>; rel=\"canonical\""); } ViewBag.title = _localizer["Title", model.Document.Course, model.Document.Title]; ViewBag.metaDescription = _localizer["Description", model.Document.Course]; Country country = model.Document.User.Country; if (model.Document.DocumentType == DocumentType.Video && !string.IsNullOrEmpty(model.Document.Snippet)) { var jsonLd = new VideoObject() { Description = model.Document.Snippet, Name = model.Document.Title, ThumbnailUrl = new Uri(_urlBuilder.BuildDocumentImageShareEndpoint(model.Document.Id, new { width = 703, height = 395, mode = "crop", theme, rtl = country.MainLanguage.Info.TextInfo.IsRightToLeft.ToString() })), UploadDate = model.Document.DateTime, Duration = model.Document.Duration, }; ViewBag.jsonLd = jsonLd; } ViewBag.ogImage = new Uri(_urlBuilder.BuildDocumentImageShareEndpoint(model.Document.Id, new { width = 1200, height = 630, mode = "crop", theme, rtl = country.MainLanguage.Info.TextInfo.IsRightToLeft.ToString() })); ViewBag.ogTitle = model.Document.Title; ViewBag.ogDescription = _localizer.WithCulture(country.MainLanguage.Info) ["OgDescription", model.Document.Course]; ViewBag.ogImageWidth = 1200; ViewBag.ogImageHeight = 630; return(View()); }
public void createVideoObject(){ VideoObject cachedObj = videoObject; //create a new movie object reference with the path videoObject = new VideoObject(fullPathToMovie); //set it to use the full path, instead of one relative to your video manager's pre-set path videoObject.setUseAbsolutePath(true); //store the settings that you setup in the inspector. videoObject.initFrom(cachedObj); }