Quantcast
Channel: Kaltura - Latest topics
Viewing all articles
Browse latest Browse all 2994

Retrieving duration of an uploaded video

$
0
0

@dohsoft wrote:

Hi,

I have a requirement as a part of an import routine I am writing to get the duration of the uploaded video so this value can be stored on a local database.

I am using the following code to do the upload and this is working fine, the duration of the video is visible in the KMC when I look at the details for the video:

FileStream fileStream = new FileStream(context.Server.MapPath("~") + @"\" + fileName, FileMode.Open, FileAccess.Read);

                    KalturaClient client = new KalturaClient(GetConfig());
                    string ks = client.GenerateSession(ADMIN_SECRET, USER_ID, KalturaSessionType.ADMIN, PARTNER_ID, 86400, "");
                    client.KS = ks;
                    KalturaUploadToken uploadToken = client.UploadTokenService.Add();
                    client.UploadTokenService.Upload(uploadToken.Id, fileStream);
                    KalturaUploadedFileTokenResource mediaResource = new KalturaUploadedFileTokenResource();
                    mediaResource.Token = uploadToken.Id;
                    KalturaMediaEntry mediaEntry = new KalturaMediaEntry();
                    mediaEntry.Name = ds.Tables[0].Rows[0]["Synopsis"].ToString();
                    mediaEntry.ReferenceId = prefix + "-" + objectid;
                    mediaEntry.MediaType = KalturaMediaType.VIDEO;
                    mediaEntry = client.MediaService.Add(mediaEntry);
                    mediaEntry = client.MediaService.AddContent(mediaEntry.Id, mediaResource);

When I then go to the mediaEntry object to get .Duration it is always 0.

Any ideas please?

Thanks,
Steve

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 2994

Trending Articles