Example #1
0
        public void EditVideoUpload(VideoUpload videoUpload)
        {
            var original = this.FindVideoUpload(videoUpload.Id);

            original.Name        = videoUpload.Name;
            original.Description = videoUpload.Description;
            original.VideoLink   = videoUpload.VideoLink;
            _repo.SaveChanges();
        }
 public ActionResult Edit(VideoUpload videoUpload)
 {
     if (ModelState.IsValid)
     {
         _videoUploadService.EditVideoUpload(videoUpload);
         return(RedirectToAction("Index"));
     }
     return(View());
 }
Example #3
0
        private async Task <string> UploadVideo(UserAuthorization user)
        {
            var videoUrl  = "https://diricostorage.blob.core.windows.net/48131979-e14a-47c4-bf19-e02bb7226732/cb07d670-6fc8-410f-b21e-3456a284f523/4cf54e39-afdb-47b1-bf7d-020464985554/8b896ee0-d73d-48bc-bc92-60ce09407028/data";
            var videoData = await ImageUtils.PrepareImageFromUrl(videoUrl, 10485760);

            var ownerUrn       = "urn:li:organization:18568129";
            var videoUploadUrn = await VideoUpload.UploadVideoAsync(api, user, ownerUrn, videoData);

            return(videoUploadUrn);
        }
Example #4
0
        public async void UploadVideo()
        {
            var video = new VideoUpload
            {
                Video          = new InstaVideo(@"c:\video1.mp4", 0, 0),
                VideoThumbnail = new InstaImage(@"c:\video thumbnail 1.jpg", 0, 0)
            };
            var result = await api.MediaProcessor.UploadVideoAsync(video, "ramtinak").ConfigureAwait(false);

            Console.WriteLine(result.Succeeded
                                  ? $"Story created: {result.Value.Pk}"
                                  : $"Unable to upload video story: {result.Info.Message}");
        }
        static void Main(string[] args)
        {
            var mailSender    = new MailSender();
            var videoUploader = new VideoUpload();
            var webService    = new WebService();

            var workflow = new Workflow(new List <IActivity>()
            {
                mailSender, videoUploader, webService
            });
            var workflowEngine = new WorkflowEngine(workflow);

            workflowEngine.Run();
        }
Example #6
0
        protected override void Seed(Rocbook.Models.ApplicationDbContext context)
        {
            var videoUploads = new VideoUpload[]
            {
                new VideoUpload {
                    Name = "Tosin Abasi", Description = "The Woven Web", VideoLink = "https://www.youtube.com/embed/TNwx84UPzFY"
                },
                new VideoUpload {
                    Name = "Animals As Leaders", Description = "Tempting Time", VideoLink = "https://www.youtube.com/embed/StKMAijQcpk"
                }
            };

            context.VideoUploads.AddOrUpdate(v => v.Name, videoUploads);
        }
Example #7
0
        public async Task <VideoUpload> SaveVideo(string url)
        {
            if (url == null)
            {
                return(null);
            }
            using (var client = new HttpClient())
            {
                try
                {
                    using (var result = await client.GetAsync(url))
                    {
                        if (!result.IsSuccessStatusCode)
                        {
                            return(null);
                        }
                        var upload = new VideoUpload();
                        var file   = await result.Content.ReadAsByteArrayAsync();

                        var ext          = MimeTypeMap.GetExtension(result.Content.Headers.ContentType.MediaType);
                        var folderUpload = SupportVideo.CreatePathFolder();
                        var pathToSave   = SupportVideo.CreatePathToSave(folderUpload);
                        if (file == null)
                        {
                            return(null);
                        }
                        upload.State      = 1;
                        upload.DateUpload = DateTime.Now;
                        upload.FileName   = SupportVideo.RandomNameFile(ext);
                        upload.Path       = Path.Combine(folderUpload, upload.FileName);
                        var fullPath = Path.Combine(pathToSave, upload.FileName);
                        using (var stream = new FileStream(fullPath, FileMode.Create, FileAccess.Write))
                        {
                            stream.Write(file, 0, file.Length);
                        }
                        return(upload);
                    }
                }
                catch (Exception ex)
                {
                    throw;
                }
            }
        }
Example #8
0
        public async Task DoShow()
        {
            var video = new VideoUpload
            {
                // leave zero, if you don't know how height and width is it.
                Video          = new InstaVideo(@"c:\video1.mp4", 0, 0),
                VideoThumbnail = new InstaImage(@"c:\video thumbnail 1.jpg", 0, 0)
            };

            // Add user tag (tag people)
            video.UserTags.Add(new UserTagVideoUpload {
                Username = "******"
            });
            var result = await api.MediaProcessor.UploadVideoAsync(video, "ramtinak").ConfigureAwait(false);

            Console.WriteLine(result.Succeeded
                                  ? $"Media created: {result.Value.Pk}, {result.Value.Caption}"
                                  : $"Unable to upload video: {result.Info.Message}");
        }
        public VideoUpload Get(string Id, string gps, string url, string alt, string metaData,
                               string textDescription, Int32 ratio)
        {
            VideoUpload    imgInfoObj = new VideoUpload(Id, gps, url, alt, metaData, textDescription, ratio);
            TemoingnageJsn infoImg    = new TemoingnageJsn
            {
                ClientId        = Id,
                Description     = textDescription,
                Gps             = gps,
                ImageData       = metaData,
                AltDescription  = alt,
                RatioImportance = ratio,
                UrlVideo        = url
            };

            DocDbAzure.InsertDocument(infoImg);

            VideoUpload descErreur = new VideoUpload();

            return(imgInfoObj);
        }
Example #10
0
    protected void UploadBtn_Click(object sender, EventArgs e)
    {
        HttpPostedFile ChoosenVideo = VideoUpload.PostedFile;
        string         VideoName    = Path.GetFileName(ChoosenVideo.FileName);
        string         VideoFormat  = Path.GetExtension(VideoName);
        string         CatIndex     = CategoriesText.SelectedItem.Value;
        int            VideoSize    = ChoosenVideo.ContentLength;

        if (VideoName == "")
        {
            UploadLabel.ForeColor = System.Drawing.Color.Red;
            UploadLabel.Text      = "Please Select a Video";
        }
        else
        {
            if (VideoFormat.ToLower() == ".mp4" || VideoFormat.ToLower() == ".ogg" || VideoFormat.ToLower() == ".webm")
            {
                if (VideoSize > 50000000)
                {
                    UploadLabel.ForeColor = System.Drawing.Color.Red;
                    UploadLabel.Text      = "Video Exceeded the Size Limit. Please Try Again";
                }
                else
                {
                    string textarea   = DescriptionText.Value;
                    string category   = CategoriesText.SelectedItem.Text;
                    string today      = DateTime.Today.ToString("dd/MM/yyyy");
                    int    UserUpload = Convert.ToInt32(UserUploadString);

                    if (TitleText.Text == "" || category == "" || textarea == "")
                    {
                        UploadLabel.ForeColor = System.Drawing.Color.Red;
                        UploadLabel.Text      = "Please Make Sure All Information are Filled";
                    }
                    else
                    {
                        con3.Open();
                        String       DuplicateVideoName = "SELECT * FROM [dbo].[Video] WHERE Title = @title";
                        SqlCommand   com3         = new SqlCommand(DuplicateVideoName, con3);
                        SqlParameter getVideoName = new SqlParameter("@title", TitleText.Text);
                        com3.Parameters.Add(getVideoName);
                        SqlDataReader retrieve3 = com3.ExecuteReader();
                        if (retrieve3.HasRows)
                        {
                            UploadLabel.ForeColor = System.Drawing.Color.Red;
                            UploadLabel.Text      = "Video's Title Existed. Please Try Another One";
                        }
                        else
                        {
                            String path = VideoName.Replace(" ", "");
                            con.Open();
                            String       query       = "INSERT INTO [dbo].[Video] (VideoFile,Title,Description,Categories,CategoriesIndex,TotalView,TotalLike,TotalDislike,Date,Status,UserID) VALUES (@video,@title,@description,@category,@index,'0','0','0',@today,'Pending',@userID)";
                            SqlCommand   com         = new SqlCommand(query, con);
                            SqlParameter addVideo    = new SqlParameter("@video", path);
                            SqlParameter addTitle    = new SqlParameter("@title", TitleText.Text);
                            SqlParameter addDesc     = new SqlParameter("@description", textarea);
                            SqlParameter addcategory = new SqlParameter("@category", category);
                            SqlParameter addIndex    = new SqlParameter("@index", CatIndex);
                            SqlParameter addDate     = new SqlParameter("@today", today);
                            SqlParameter addUserID   = new SqlParameter("@userID", UserUpload);
                            com.Parameters.Add(addVideo);
                            com.Parameters.Add(addTitle);
                            com.Parameters.Add(addDesc);
                            com.Parameters.Add(addcategory);
                            com.Parameters.Add(addIndex);
                            com.Parameters.Add(addDate);
                            com.Parameters.Add(addUserID);
                            com.ExecuteNonQuery();


                            VideoUpload.SaveAs(Server.MapPath("Content\\" + path));
                            UploadLabel.ForeColor = System.Drawing.Color.Yellow;
                            UploadLabel.Text      = "Video Uploaded Successfully";
                            con.Close();
                            DescriptionText.Value = "";
                            TitleText.Text        = "";

                            SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
                            client.EnableSsl             = true;
                            client.DeliveryMethod        = SmtpDeliveryMethod.Network;
                            client.UseDefaultCredentials = false;
                            client.Credentials           = new NetworkCredential("*****@*****.**", "eelxusivywsyjmcr");
                            MailMessage msgobj = new MailMessage();
                            msgobj.To.Add(Email);
                            msgobj.From    = new MailAddress("*****@*****.**");
                            msgobj.Subject = "Video Uploaded Successfully #Do Not Reply";
                            msgobj.Body    = "Congratulation, your video was uploaded successfully. Please be patient for the approval." +
                                             Environment.NewLine + "Video Name: " + VideoName + Environment.NewLine +
                                             "Video Category: " + category + Environment.NewLine +
                                             Environment.NewLine +
                                             "Thank You. Have a Nice Day.";

                            client.Send(msgobj);
                        }
                        con3.Close();
                        con.Close();
                    }
                }
            }
            else
            {
                UploadLabel.ForeColor = System.Drawing.Color.Red;
                UploadLabel.Text      = "Video Format Not Supported. Please Try Again.";
            }
        }
    }
 /// <summary>
 ///     Upload video to Instagram TV with progress
 /// </summary>
 /// <param name="progress">Progress action</param>
 /// <param name="video">
 ///     Video to upload (aspect ratio is very important for thumbnail and video | range 0.5 - 1.0 | Width =
 ///     480, Height = 852)
 /// </param>
 /// <param name="title">Title</param>
 /// <param name="caption">Caption</param>
 public Task <IResult <InstaMedia> > UploadVideoAsync(Action <UploaderProgress> progress, VideoUpload video, string title, string caption)
 {
     InstaUserAuthValidator.Validate(userAuthValidate);
     return(instaApi.HelperProcessor.SendIgtvVideoAsync(progress, video, title, caption));
 }
 /// <summary>
 ///     Upload video to Instagram TV
 /// </summary>
 /// <param name="video">
 ///     Video to upload (aspect ratio is very important for thumbnail and video | range 0.5 - 1.0 | Width =
 ///     480, Height = 852)
 /// </param>
 /// <param name="title">Title</param>
 /// <param name="caption">Caption</param>
 public Task <IResult <InstaMedia> > UploadVideoAsync(VideoUpload video, string title, string caption)
 {
     return(UploadVideoAsync(null, video, title, caption));
 }
Example #13
0
 public void CreateVideoUpload(VideoUpload videoUpload)
 {
     _repo.Add <VideoUpload>(videoUpload);
     _repo.SaveChanges();
 }
Example #14
0
    protected void ImageButton9_Click(object sender, ImageClickEventArgs e)
    {
        if (TextBox1.Text.Length < 250)
        {
            Label1.Text = "Maximum Text Limit is 250.";
        }
        else if (antiSqlInjection() == 0)
        {
            Label1.Text = "";
            if (!PhotoUpload.HasFile)
            {
                invalid += 1;
            }
            if (!VideoUpload.HasFile)
            {
                invalid += 1;
            }
            if (!AudioUpload.HasFile)
            {
                invalid += 1;
            }
            if (invalid == 3 && TextBox1.Text.Trim() == "")      // No Contents
            {
                Label1.Text = " Nothing to Upload.";
            }
            else
            {
                Label1.Text = "";
            }
        }
        if (recipient.Text.Trim().Length != 0 && invalid < 3)
        {
            SqlCommand check = new SqlCommand("Select Count(*) from user_db where phone_no='" + recipient.Text + "'", conn);
            int        phone = (int)check.ExecuteScalar();
            String     temp = (phone + 100001).ToString(), pic = "", aud = "", vid = "";
            if (phone == 1)        // Phone exist
            {
                if (PhotoUpload.HasFile)
                {
                    pic = "pic" + temp + ".jpg";
                    PhotoUpload.SaveAs(Server.MapPath("~/uploads/feed" + pic));
                }
                else
                {
                    pic = "";
                }
                if (VideoUpload.HasFile)
                {
                    vid = "vid" + temp + ".3gp";
                    VideoUpload.SaveAs(Server.MapPath("~/uploads/feed" + vid));
                }
                else
                {
                    pic = "";
                }
                if (AudioUpload.HasFile)
                {
                    aud = "aud" + temp + ".amr";
                    AudioUpload.SaveAs(Server.MapPath("~/uploads/feed" + aud));
                }
                else
                {
                    aud = "";
                }
                SqlCommand enter = new SqlCommand("Insert into feed_db(user_id,recipient_id,pic_id,text,vid_id,aud_id) values('" + temp + "'" + recipient.Text.Trim() + "'" + pic + "'" + vid + "'" + aud + "')", conn);
                enter.ExecuteNonQuery();
                Label1.Text = " Mail Sent Successfully";
            }
            else             // invalid phone number
            {
                Label1.Text = " No user Found.";
            }

            // SqlCommand enter = new SqlCommand("Insert into feed_db'" + recipient.Text + "'", conn);
        }
    }