public async Task<Video> CreateVideoAsync(string title, string description, string name, string type, Stream dataStream)
        {
            // TODO: Start encoding uploaded video - BuildVideoServicecsCreate
            VideoStorage videoStorage = new VideoStorage();
            var videoUrl = await videoStorage.UploadVideoAsync(dataStream, name, type);
            videoUrl = videoStorage.GetVideoUrl(videoUrl);
            string jobId = null;

            var video = new Video
                {
                    Title = title,
                    Description = description,
                    SourceVideoUrl = videoUrl,
                    JobId = jobId
                };

            this.context.Videos.Add(video);
            await this.context.SaveChangesAsync();

            return video;
        }
Example #2
0
        public async Task <Video> CreateVideoAsync(string title, string description, string name, string type, Stream dataStream)
        {
            // TODO: Start encoding uploaded video - BuildVideoServicecsCreate
            VideoStorage videoStorage = new VideoStorage();
            var          videoUrl     = await videoStorage.UploadVideoAsync(dataStream, name, type);

            videoUrl = videoStorage.GetVideoUrl(videoUrl);
            string jobId = null;

            var video = new Video
            {
                Title          = title,
                Description    = description,
                SourceVideoUrl = videoUrl,
                JobId          = jobId
            };

            this.context.Videos.Add(video);
            await this.context.SaveChangesAsync();

            return(video);
        }