Ejemplo n.º 1
0
        public IActionResult Index()
        {
            var dataTableListImage = MediaContentModel.GetMediaContentListImage();
            List <ImageContent> resultListImage = new List <ImageContent>();

            if (dataTableListImage.Rows.Count > 0)
            {
                resultListImage = MediaContentModel.SetDataMediaContentListImage(dataTableListImage);
            }

            var          dataTableVideo = MediaContentModel.GetMediaContentVideo();
            VideoContent resultVideo    = new VideoContent();

            if (dataTableVideo.Rows.Count > 0)
            {
                resultVideo = MediaContentModel.SetDataMediaContentVideo(dataTableVideo);
            }

            var         dataTableText = MediaContentModel.GetMediaContentTextRun();
            TextRunning resultText    = new TextRunning();

            if (dataTableText.Rows.Count > 0)
            {
                resultText = MediaContentModel.SetDataMediaContentTextRun(dataTableText);
            }

            GetAllContent result = new GetAllContent()
            {
                ListImageContent = resultListImage,
                GetVideoContent  = resultVideo,
                GetTextRun       = resultText
            };

            return(View(result));
        }
Ejemplo n.º 2
0
        public override async Task <Uri> GenerateVideoContentUrl()
        {
            if (_DmcWatchResponse == null)
            {
                return(null);
            }

            if (_DmcWatchResponse.Video.DmcInfo == null)
            {
                return(null);
            }

            VideoContent videoQuality = Video;

            if (Video == null)
            {
                return(null);
            }

            try
            {
                _DmcSessionResponse = await HohoemaApp.NiconicoContext.Video.GetDmcSessionResponse(_DmcWatchResponse, videoQuality);

                return(new Uri(_DmcSessionResponse.Data.Session.ContentUri));
            }
            catch
            {
                return(null);
            }
        }
Ejemplo n.º 3
0
        public bool Add(string url)
        {
            VideoContent model = MakeContentFromUrl(url);

            var status = false;

            try
            {
                HttpClient client = new HttpClient();
                //client.BaseAddress = new Uri("https://localhost:44384/Api/");
                client.BaseAddress = new Uri("https://ettv.azurewebsites.net/api/");
                //client.BaseAddress = new Uri("http://localhost:5000/api/");
                string              JsonString = JsonConvert.SerializeObject(model);
                StringContent       content    = new StringContent(JsonString, Encoding.UTF8, "application/json");
                HttpResponseMessage response   = client.PostAsync("VideoContent/", content).Result;

                if (response.IsSuccessStatusCode)
                {
                    status = true;
                }

                return(status);
            }
            catch (Exception ex)
            {
                //TODO loging ....
                Console.WriteLine(ex);
                return(false);
            }
        }
Ejemplo n.º 4
0
        public DmcVideoStreamingSession(DmcWatchData res, NicoVideoQuality requestQuality, NiconicoContext context)
            : base(context)
        {
            RequestedQuality = requestQuality;
            _DmcWatchData    = res;
            DmcWatchResponse = res.DmcWatchResponse;

#if DEBUG
            Debug.WriteLine($"Id/Bitrate/Resolution/Available");
            foreach (var q in _DmcWatchData.DmcWatchResponse.Video.DmcInfo.Quality.Videos)
            {
                Debug.WriteLine($"{q.Id}/{q.Bitrate}/{q.Available}/{q.Resolution}");
            }
#endif

            VideoContent = ResetActualQuality();

            if (VideoContent == null || !VideoContent.Available)
            {
                VideoContent = DmcWatchResponse.Video.DmcInfo.Quality.Videos.FirstOrDefault(x => x.Available);
                _Quality     = NicoVideoVideoContentHelper.VideoContentToQuality(VideoContent);
            }
            else
            {
                _Quality = requestQuality;
            }

            if (VideoContent != null)
            {
                Debug.WriteLine($"quality={_Quality}");
                Debug.WriteLine($"{VideoContent.Id}/{VideoContent.Bitrate}/{VideoContent.Available}/w={VideoContent.Resolution.Width} h={VideoContent.Resolution.Height}");
            }
        }
        public void ShouldBeReturnResultsAfterAddOneVideoContent()
        {
            var options = new DbContextOptionsBuilder <EttvDbContext>()
                          .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString())
                          .Options;
            var context = new EttvDbContext(options);

            Seed(context);

            var videocontentservice = new VideoContentService(unitOfWork: new UnitOfWork(context));

            VideoContent vc = new VideoContent
            {
                VideoId      = "videoId4",
                Title        = "title4",
                Thumbnail    = "thumbnail4",
                Tag          = "tag4",
                SrcUri       = "https://www.youtube.com/watch?v=",
                SrcExtention = "youtube",
                AppUserId    = 1,
                Duration     = 1000
            };

            Assert.Equal(vc, videocontentservice.Save(vc).VideoContent);
            Assert.Equal(4, videocontentservice.List().Count());
        }
        public void ShouldBeReturnResultsAfterUpdateOneVideoContent()
        {
            var options = new DbContextOptionsBuilder <EttvDbContext>()
                          .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString())
                          .Options;
            var context = new EttvDbContext(options);

            Seed(context);

            var videocontentservice = new VideoContentService(unitOfWork: new UnitOfWork(context));

            VideoContent vc = new VideoContent
            {
                VideoId      = "videoId3",
                Title        = "title3",
                Thumbnail    = "thumbnail3",
                Tag          = "tag3_Updated",
                SrcUri       = "https://www.youtube.com/watch?v=",
                SrcExtention = "youtube",
                AppUserId    = 2,
                Duration     = 3000
            };

            Assert.Equal(vc.Tag, videocontentservice.Update("videoId3", vc).VideoContent.Tag);
            Assert.Equal(vc.Title, videocontentservice.Update("videoId3", vc).VideoContent.Title);
            Assert.Equal(vc.SrcUri, videocontentservice.Update("videoId3", vc).VideoContent.SrcUri);
            Assert.Equal(vc.SrcExtention, videocontentservice.Update("videoId3", vc).VideoContent.SrcExtention);
        }
Ejemplo n.º 7
0
        public bool TagEdit(VideoContent model)
        {
            var status = false;

            try
            {
                if (model.VideoId != null)
                {
                    HttpClient client = new HttpClient();
                    //client.BaseAddress = new Uri("https://localhost:44384/api/");
                    client.BaseAddress = new Uri("https://ettv.azurewebsites.net/api/");
                    //client.BaseAddress = new Uri("http://localhost:5000/api/");
                    string              JsonString = JsonConvert.SerializeObject(model);
                    StringContent       content    = new StringContent(JsonString, Encoding.UTF8, "application/json");
                    HttpResponseMessage response   = client.PutAsync("VideoContent/" + model.VideoId, content).Result;
                    //Booking result = null;

                    if (response.IsSuccessStatusCode)
                    {
                        status = true;
                    }
                }
                return(status);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                return(false);
            }
        }
Ejemplo n.º 8
0
 public bool Equals(PocketItem other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(Id.Equals(other.Id) &&
            ResolvedId.Equals(other.ResolvedId) &&
            Equals(GivenUrl, other.GivenUrl) &&
            Equals(GivenTitle, other.GivenTitle) &&
            IsFavorite.Equals(other.IsFavorite) &&
            Status.Equals(other.Status) &&
            TimeAdded.Equals(other.TimeAdded) &&
            TimeUpdated.Equals(other.TimeUpdated) &&
            TimeRead.Equals(other.TimeRead) &&
            TimeFavorited.Equals(other.TimeFavorited) &&
            TimeSyncDatabaseAdded.Equals(other.TimeSyncDatabaseAdded) &&
            TimeSyncDatabaseUpdated.Equals(other.TimeSyncDatabaseUpdated) &&
            Equals(ResolvedTitle, other.ResolvedTitle) &&
            Equals(ResolvedUrl, other.ResolvedUrl) &&
            Equals(Excerpt, other.Excerpt) &&
            IsArticle.Equals(other.IsArticle) &&
            IsIndex.Equals(other.IsIndex) &&
            ImageContent.Equals(other.ImageContent) &&
            VideoContent.Equals(other.VideoContent) &&
            WordCount.Equals(other.WordCount) &&
            Equals(AmpUrl, other.AmpUrl) &&
            Equals(Encoding, other.Encoding) &&
            Equals(MimeType, other.MimeType) &&
            Equals(LeadImage, other.LeadImage));
 }
Ejemplo n.º 9
0
        /// <summary>
        /// 提取视频内容
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        private static VideoContent GetVideoContent(this XmlNode node)
        {
            string nw = node.Attributes["Width"] == null ? "0" : node.Attributes["Width"].Value;
            string nh = node.Attributes["Height"] == null ? "0" : node.Attributes["Height"].Value;
            string time = node.Attributes["Duration"] == null ? "0" : node.Attributes["Duration"].Value;
            int    width = 0, height = 0, duration = 0;

            int.TryParse(nw, out width);
            int.TryParse(nh, out height);
            int.TryParse(time, out duration);

            VideoContent content = new VideoContent
            {
                Url      = node.Attributes["Url"] == null ? string.Empty : node.Attributes["Url"].Value,
                Duration = duration,
                ThumbUrl = node.Attributes["ThumbUrl"] == null ? string.Empty : node.Attributes["ThumbUrl"].Value,
                Width    = width,
                Height   = height
            };

            if (!string.IsNullOrEmpty(content.Url))
            {
                content.Url = content.Url.ImageUrlFixed();
            }

            if (!string.IsNullOrEmpty(content.ThumbUrl))
            {
                content.ThumbUrl = content.ThumbUrl.ImageUrlFixed();
            }

            return(content);
        }
Ejemplo n.º 10
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = 47;
         hashCode = (hashCode * 53) ^ Id.GetHashCode();
         hashCode = (hashCode * 53) ^ ResolvedId.GetHashCode();
         if (GivenUrl != null)
         {
             hashCode = (hashCode * 53) ^ GivenUrl.GetHashCode();
         }
         if (GivenTitle != null)
         {
             hashCode = (hashCode * 53) ^ GivenTitle.GetHashCode();
         }
         hashCode = (hashCode * 53) ^ IsFavorite.GetHashCode();
         hashCode = (hashCode * 53) ^ (int)Status;
         hashCode = (hashCode * 53) ^ TimeAdded.GetHashCode();
         hashCode = (hashCode * 53) ^ TimeUpdated.GetHashCode();
         hashCode = (hashCode * 53) ^ TimeRead.GetHashCode();
         hashCode = (hashCode * 53) ^ TimeFavorited.GetHashCode();
         hashCode = (hashCode * 53) ^ TimeSyncDatabaseAdded.GetHashCode();
         hashCode = (hashCode * 53) ^ TimeSyncDatabaseUpdated.GetHashCode();
         if (ResolvedTitle != null)
         {
             hashCode = (hashCode * 53) ^ ResolvedTitle.GetHashCode();
         }
         if (ResolvedUrl != null)
         {
             hashCode = (hashCode * 53) ^ ResolvedUrl.GetHashCode();
         }
         if (Excerpt != null)
         {
             hashCode = (hashCode * 53) ^ Excerpt.GetHashCode();
         }
         hashCode = (hashCode * 53) ^ IsArticle.GetHashCode();
         hashCode = (hashCode * 53) ^ IsIndex.GetHashCode();
         hashCode = (hashCode * 53) ^ ImageContent.GetHashCode();
         hashCode = (hashCode * 53) ^ VideoContent.GetHashCode();
         hashCode = (hashCode * 53) ^ WordCount.GetHashCode();
         if (AmpUrl != null)
         {
             hashCode = (hashCode * 53) ^ AmpUrl.GetHashCode();
         }
         if (Encoding != null)
         {
             hashCode = (hashCode * 53) ^ Encoding.GetHashCode();
         }
         if (MimeType != null)
         {
             hashCode = (hashCode * 53) ^ MimeType.GetHashCode();
         }
         if (LeadImage != null)
         {
             hashCode = (hashCode * 53) ^ LeadImage.GetHashCode();
         }
         return(hashCode);
     }
 }
Ejemplo n.º 11
0
 public ActionResult TagEdit(VideoContent model)
 {
     if (!ModelState.IsValid)
     {
         return(View(model));
     }
     _contentService.TagEdit(model);
     return(RedirectToAction("Index"));
 }
Ejemplo n.º 12
0
        public async Task <string> AddVideoToPost(string postId)
        {
            VideoContent video = new VideoContent(postId);
            var          post  = await this.socialNetworkDbContext.Posts.FindAsync(postId);

            post.Videos.Add(video);
            await this.socialNetworkDbContext.SaveChangesAsync();

            return(video.Id);
        }
Ejemplo n.º 13
0
        public override async Task <Uri> GenerateVideoContentUrl()
        {
            if (DmcWatchResponse == null)
            {
                return(null);
            }

            if (DmcWatchResponse.Video.DmcInfo == null)
            {
                return(null);
            }

            VideoContent videoQuality = Video;

            if (Video == null)
            {
                return(null);
            }

            try
            {
                // 直前に同一動画を見ていた場合には、動画ページに再アクセスする
                DmcSessionResponse clearPreviousSession = null;
                if (_DmcSessionResponse != null && DmcWatchEnvironment != null)
                {
                    if (_DmcSessionResponse.Data.Session.RecipeId.EndsWith(RawVideoId))
                    {
                        clearPreviousSession = _DmcSessionResponse;
                        _DmcSessionResponse  = null;
                        _DmcWatchResponse    = await HohoemaApp.NiconicoContext.Video.GetDmcWatchJsonAsync(RawVideoId, DmcWatchEnvironment.PlaylistToken);

                        videoQuality = Video;
                    }
                }

                _DmcSessionResponse = await HohoemaApp.NiconicoContext.Video.GetDmcSessionResponse(DmcWatchResponse, videoQuality);

                if (_DmcSessionResponse == null)
                {
                    return(null);
                }

                if (clearPreviousSession != null)
                {
                    await HohoemaApp.NiconicoContext.Video.DmcSessionExitHeartbeatAsync(DmcWatchResponse, clearPreviousSession);
                }

                return(new Uri(_DmcSessionResponse.Data.Session.ContentUri));
            }
            catch
            {
                return(null);
            }
        }
    static void Main()
    {
        // If using Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        var presentation = new PresentationDocument();

        // Create new presentation slide.
        var slide = presentation.Slides.AddNew(SlideLayoutType.Custom);

        // Create and add audio content.
        AudioContent audio = null;

        using (var stream = File.OpenRead("Applause.wav"))
            audio = slide.Content.AddAudio(AudioContentType.Wav, stream, 2, 2, LengthUnit.Centimeter);

        // Set the ending fade durations for the media.
        audio.Fade.End = TimeOffset.From(300, TimeOffsetUnit.Millisecond);

        // Get the picture associated with this media.
        var picture = audio.Picture;

        // Set drawing properties.
        picture.Action.Click.Set(ActionType.PlayMedia);
        picture.Layout.Width  = Length.From(7, LengthUnit.Centimeter);
        picture.Layout.Height = Length.From(7, LengthUnit.Centimeter);
        picture.Name          = "Applause.wav";

        // Create and add video content.
        VideoContent video = null;

        using (var stream = File.OpenRead("Wildlife.wmv"))
            video = slide.Content.AddVideo("video/x-ms-wmv", stream, 10, 2, 10, 5.6, LengthUnit.Centimeter);

        // Set drawing properties.
        video.Picture.Action.Click.Set(ActionType.PlayMedia);
        video.Picture.Name = "Wildlife.wmv";

        // Set the amount of time to be trimmed from the start and end of the media.
        video.Trim.Start = TimeOffset.From(600, TimeOffsetUnit.Millisecond);
        video.Trim.End   = TimeOffset.From(800, TimeOffsetUnit.Millisecond);

        // Set the starting and ending fade durations for the media.
        video.Fade.Start = TimeOffset.From(100, TimeOffsetUnit.Millisecond);
        video.Fade.End   = TimeOffset.From(200, TimeOffsetUnit.Millisecond);

        // Add video bookmarks.
        video.Bookmarks.Add(TimeOffset.From(1500, TimeOffsetUnit.Millisecond));
        video.Bookmarks.Add(TimeOffset.From(3000, TimeOffsetUnit.Millisecond));

        presentation.Save("Audio and Video.pptx");
    }
        public async Task <IActionResult> UploadFiles(FileDescriptionShort fileDescriptionShort)
        {
            if (ModelState.IsValid)
            {
                foreach (var file in fileDescriptionShort.File)
                {
                    if (file.Length > 0 && file.ContentType.Contains("image"))
                    {
                        using (var memoryStream = new MemoryStream())
                        {
                            await file.CopyToAsync(memoryStream);

                            var imageMessage = new ImageMessage
                            {
                                ImageHeaders = "data:" + file.ContentType + ";base64,",
                                ImageBinary  = memoryStream.ToArray()
                            };

                            await _hubContext.Clients.All.SendAsync("ImageMessage", imageMessage);
                        }
                    }
                    else if (file.Length > 0 && file.ContentType.Contains("video"))
                    {
                        using (var memoryStream = new MemoryStream())
                        {
                            await file.CopyToAsync(memoryStream);


                            var videoContent = new VideoContent
                            {
                                VideoBinary = memoryStream.ToArray()
                            };

                            Guid myNewGuid = Program._simpleDreamerContentProvider.AddVideoData(videoContent);

                            var videoMessage = new VideoMessage
                            {
                                ImageHeaders = "data:" + file.ContentType + ";base64,",
                                Url          = "http://localhost:48445/api/streaming/2a2154f7-4b87-43d6-bcae-c15b88f263b2" //$"/api/streaming/{myNewGuid}"
                            };

                            if (!myNewGuid.Equals(Guid.Empty))
                            {
                                await _hubVideoStreamContext.Clients.All.SendAsync("VideoMessage", videoMessage);
                            }
                        }
                    }
                }
            }

            return(Redirect("/FileClient/Index"));
        }
Ejemplo n.º 16
0
 public VideoContentResponce Save(VideoContent videoContent)
 {
     try
     {
         _unitOfWork.videoContentRepository.Add(videoContent);
         _unitOfWork.Commit();
         return(new VideoContentResponce(videoContent));
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
         return(new VideoContentResponce($"An error occurred when saving the videoContent: {ex.Message}"));
     }
 }
        public void GetVideoDetailsForWhenFolderStructureNotCreated()
        {
            //Arrange
            VideoFileDetail videoObj          = new VideoFileDetail();
            string          appStartPath      = @"D:\git-code\ImageProcessing\KantarImageProcessing\Test.ImageVideoGrabber\bin\Debug";//Application.StartupPath;
            string          frameName         = Guid.NewGuid().ToString();
            string          outputImgFilePath = appStartPath + @"\bin\img1\";
            string          filePath          = @"D:\videos\images\unitTest\bill2.mp4";
            string          batchFilePath     = appStartPath + @"\a\a\ff-prompt.bat";

            videoObj.ApplicationStartupPath = appStartPath;
            videoObj.OutputImagePath        = outputImgFilePath;
            videoObj.InputFilePath          = filePath;
            videoObj.BatchFilePath          = batchFilePath;
            //Act
            VideoContent actualOutput = _grab.GetVideoDetails(videoObj);
        }
        public void ShouldBeReturnResultsAfterDeleteOneVideoContent()
        {
            var options = new DbContextOptionsBuilder <EttvDbContext>()
                          .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString())
                          .Options;
            var context = new EttvDbContext(options);

            Seed(context);

            var videocontentservice = new VideoContentService(unitOfWork: new UnitOfWork(context));

            VideoContent vc = videocontentservice.Delete("videoId1").VideoContent;

            Assert.Equal("tag1", vc.Tag);
            Assert.Equal("title1", vc.Title);
            Assert.Equal(2, videocontentservice.List().Count());
        }
        public async Task GetRecentVideos_ReturnVideosAreNotTheSame_ItemsInOrder()
        {
            var videoCombiner = new IntegrationVideoCombiner(new YoutubeDataClientFake(), new TwitchClientFake(), new FakeBrothershipUnitOfWork());
            var videos        = await videoCombiner.GetRecentVideos(1, 25);

            VideoContent previousVideo = null;

            foreach (var video in videos)
            {
                System.Diagnostics.Debug.WriteLine(video.Id + " " + video.ContentType + " " + video.UploadTime);
            }

            foreach (var video in videos)
            {
                Assert.IsTrue(videos.Count(p => p.Id == video.Id) <= 1);

                previousVideo = video;
            }
        }
Ejemplo n.º 20
0
        public bool AddProgram(string videoId, DateTime starTime)
        {
            var status = false;

            // if startTime is earlier than DateTime.Now ??
            if (GetAll().Any(x => x.StartTime.TrimSeconds() < starTime.TrimSeconds() && x.EndTime.TrimSeconds() > starTime.TrimSeconds()))
            {
                return(status);
            }
            else
            {
                VideoContent   currentContent = _contentService.GetAll().Where(v => v.VideoId == videoId).SingleOrDefault();
                ChannelProgram cp             = new ChannelProgram
                {
                    StartTime           = starTime,
                    EndTime             = starTime.AddMilliseconds(currentContent.Duration),
                    AppUserId           = UserSession.CurrentUser.Id,
                    VideoContentVideoId = videoId
                };
                try
                {
                    HttpClient client = new HttpClient();
                    //client.BaseAddress = new Uri("https://localhost:44384/Api/");
                    client.BaseAddress = new Uri("https://ettv.azurewebsites.net/api/");
                    //client.BaseAddress = new Uri("http://localhost:5000/api/");
                    string              JsonString = JsonConvert.SerializeObject(cp);
                    StringContent       content    = new StringContent(JsonString, Encoding.UTF8, "application/json");
                    HttpResponseMessage response   = client.PostAsync("channelprogram/", content).Result;

                    if (response.IsSuccessStatusCode)
                    {
                        status = true;
                    }

                    return(status);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                    return(false);
                }
            }
        }
        public void GetVideoDetailsForValidBlankVideo()
        {
            //Arrange
            VideoFileDetail videoObj          = new VideoFileDetail();
            string          appStartPath      = @"D:\git-code\ImageProcessing\KantarImageProcessing\Test.ImageVideoGrabber\bin\Debug";//Application.StartupPath;
            string          frameName         = Guid.NewGuid().ToString();
            string          outputImgFilePath = appStartPath + @"\bin\img\";
            string          filePath          = @"D:\videos\images\unitTest\blank.mp4";
            string          batchFilePath     = appStartPath + @"\ff-prompt.bat";

            videoObj.ApplicationStartupPath = appStartPath;
            videoObj.OutputImagePath        = outputImgFilePath;
            videoObj.InputFilePath          = filePath;
            videoObj.BatchFilePath          = batchFilePath;
            //Act
            VideoContent actualOutput = _grab.GetVideoDetails(videoObj);

            //Assert
            Assert.IsTrue(actualOutput != null, "Exception occourred in getting video details for valid blank video file");
        }
        public void GetVideoDetailsForInvalidVideoPath()
        {
            //Arrange
            VideoFileDetail videoObj          = new VideoFileDetail();
            string          appStartPath      = @"D:\git-code\ImageProcessing\KantarImageProcessing\Test.ImageVideoGrabber\bin\Debug";//Application.StartupPath;
            string          frameName         = Guid.NewGuid().ToString();
            string          outputImgFilePath = appStartPath + @"\bin\img\";
            string          filePath          = @":\videos\images\unitTest\bill2.mp4";
            string          batchFilePath     = appStartPath + @"\ff-prompt.bat";

            videoObj.ApplicationStartupPath = appStartPath;
            videoObj.OutputImagePath        = outputImgFilePath;
            videoObj.InputFilePath          = filePath;
            videoObj.BatchFilePath          = batchFilePath;
            //Act
            VideoContent actualResult = _grab.GetVideoDetails(videoObj);

            //Assert
            Assert.IsTrue((actualResult.AudioMessage == "" && actualResult.ColorList.Count == 0 && actualResult.ContentMessage == "" && actualResult.VideoInfo == ""),
                          "Exception occurred in getting video details from invalid video path");
        }
Ejemplo n.º 23
0
 public IActionResult EditVideoContent(int?id, VideoContent model)
 {
     if (id == null)
     {
         return(NotFound());
     }
     if (ModelState.IsValid)
     {
         try
         {
             _context.Entry(model).State = EntityState.Modified;
             _context.SaveChanges();
         }
         catch (DbUpdateConcurrencyException)
         {
             throw;
         }
         return(RedirectToAction(nameof(VideoContentIndex)));
     }
     return(View(model));
 }
    IEnumerator LoadContent(VideoContent content)
    {
        print("Fetching Content from: " + content.WebURL);
        string url = content.WebURL;
        //MovieTexture tex = new MovieTexture();
        WWW www = new WWW(url);

        while (www.isDone == false)
        {
            yield return(null);
        }
        //tex = www.movie;
        //while (tex.isReadyToPlay == false)
        //{
        //    yield return 0;
        //}

        //content.MovieTex = tex;

        itemsLoaded++;
        Core.BroadcastEvent("OnUpdateProgress", this, Progress);
    }
        /// <summary>
        /// Run the example.
        /// </summary>
        /// <param name="parsedArgs">Parsed arguments for the example.</param>
        protected override void Run(Dictionary <string, object> parsedArgs)
        {
            string accountId = (string)parsedArgs["account_id"];
            string parent    = $"buyers/{accountId}";

            VideoContent videoContent = new VideoContent();

            videoContent.VideoUrl = (string)parsedArgs["video_url"];

            Creative newCreative = new Creative();

            newCreative.AdvertiserName           = (string)parsedArgs["advertiser_name"];
            newCreative.CreativeId               = (string)parsedArgs["creative_id"];
            newCreative.DeclaredAttributes       = (IList <string>)parsedArgs["declared_attributes"];
            newCreative.DeclaredClickThroughUrls = (IList <string>)parsedArgs[
                "declared_click_urls"];
            newCreative.DeclaredRestrictedCategories = (IList <string>)parsedArgs[
                "declared_restricted_categories"];
            newCreative.DeclaredVendorIds = (IList <int?>)parsedArgs["declared_vendor_ids"];
            newCreative.Video             = videoContent;

            BuyersResource.CreativesResource.CreateRequest request =
                rtbService.Buyers.Creatives.Create(newCreative, parent);
            Creative response = null;

            Console.WriteLine("Creating video creative for buyer: {0}", parent);

            try
            {
                response = request.Execute();
            }
            catch (System.Exception exception)
            {
                throw new ApplicationException(
                          $"Real-time Bidding API returned error response:\n{exception.Message}");
            }

            Utilities.PrintCreative(response);
        }
Ejemplo n.º 26
0
 public static NicoVideoQuality VideoContentToQuality(VideoContent content)
 {
     if (content.Bitrate >= 4000_000)
     {
         return(NicoVideoQuality.Dmc_SuperHigh);
     }
     else if (content.Bitrate >= 1400_000)
     {
         return(NicoVideoQuality.Dmc_High);
     }
     else if (content.Bitrate >= 1000_000)
     {
         return(NicoVideoQuality.Dmc_Midium);
     }
     else if (content.Bitrate >= 600_000)
     {
         return(NicoVideoQuality.Dmc_Low);
     }
     else
     {
         return(NicoVideoQuality.Dmc_Mobile);
     }
 }
Ejemplo n.º 27
0
        public VideoContentResponce Update(string videoId, VideoContent videoContent)
        {
            var existingVideo = _unitOfWork.videoContentRepository.GetByStringId(videoId);

            if (existingVideo == null)
            {
                return(new VideoContentResponce("Video Content not found."));
            }

            existingVideo.Tag = videoContent.Tag;

            try
            {
                _unitOfWork.videoContentRepository.Update(existingVideo);
                _unitOfWork.Commit();

                return(new VideoContentResponce(existingVideo));
            }
            catch (Exception ex)
            {
                //TODO some logging stuff here
                return(new VideoContentResponce($"An error occurred when updating the VideoContents Tag: {ex.Message}"));
            }
        }
Ejemplo n.º 28
0
        private FrameworkElement ProcessVideo(PageBlockVideo block)
        {
            var galleryItem = new GalleryVideoItem(ViewModel.ProtoService, block.Video, block.Caption?.ToString());

            ViewModel.Gallery.Items.Add(galleryItem);

            var message = GetMessage(new MessageVideo(block.Video, null));
            var element = new StackPanel {
                Tag = message, Style = Resources["BlockVideoStyle"] as Style
            };

            if (block.Video.Thumbnail != null)
            {
                _filesMap[block.Video.Thumbnail.Photo.Id].Add(element);
            }

            _filesMap[block.Video.VideoData.Id].Add(element);

            var content = new VideoContent(message);

            content.HorizontalAlignment = HorizontalAlignment.Center;
            content.ClearValue(MaxWidthProperty);
            content.ClearValue(MaxHeightProperty);

            element.Children.Add(content);

            var caption = ProcessText(block, true);

            if (caption != null)
            {
                caption.Margin = new Thickness(0, 8, 0, 0);
                element.Children.Add(caption);
            }

            return(element);
        }
Ejemplo n.º 29
0
 public VideoContentResponce(bool success, string message, VideoContent videoContent) : base(success, message)
 {
     VideoContent = videoContent;
 }
Ejemplo n.º 30
0
 public VideoContentResponce(VideoContent videoContent) : this(true, string.Empty, videoContent)
 {
 }