-
Notifications
You must be signed in to change notification settings - Fork 239
/
UploadVideo.cs
52 lines (51 loc) · 1.83 KB
/
UploadVideo.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
* Developer: Ramtin Jokar [ Ramtinak@live.com ] [ RamtinJokar@outlook.com ]
*
* Github source: https://github.com/ramtinak/InstagramApiSharp
* Nuget package: https://www.nuget.org/packages/InstagramApiSharp
*
* IRANIAN DEVELOPERS
*/
using InstagramApiSharp.API;
using InstagramApiSharp.Classes.Models;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
/////////////////////////////////////////////////////////////////////
////////////////////// IMPORTANT NOTE ///////////////////////////////
// Please check wiki pages for more information:
// https://github.com/ramtinak/InstagramApiSharp/wiki
////////////////////// IMPORTANT NOTE ///////////////////////////////
/////////////////////////////////////////////////////////////////////
namespace Examples.Samples
{
internal class UploadVideo : IDemoSample
{
private readonly IInstaApi InstaApi;
public UploadVideo(IInstaApi instaApi)
{
InstaApi = instaApi;
}
public async Task DoShow()
{
var video = new InstaVideoUpload
{
// 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 InstaUserTagVideoUpload
{
Username = "rmt4006"
});
var result = await InstaApi.MediaProcessor.UploadVideoAsync(video, "ramtinak");
Console.WriteLine(result.Succeeded
? $"Media created: {result.Value.Pk}, {result.Value.Caption}"
: $"Unable to upload video: {result.Info.Message}");
}
}
}