You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sample for transform and job operations with MK.IO SDK
using MK.IO;using MK.IO.Models;// **********************// MK.IO Client creation// **********************varclient=new MKIOClient("mkiosubscriptionname","mkiotoken");// *********************// transform operations// *********************// Create a transformvartransform= client.Transforms.CreateOrUpdate("simpletransform",new TransformProperties
{Description="Encoding to 720p single bitrate",Outputs=newList<TransformOutput>{new TransformOutput
{Preset=new BuiltInStandardEncoderPreset(EncoderNamedPreset.H264SingleBitrate720p),RelativePriority= TransformOutputPriorityType.Normal
}}});// ***************// job operations// ***************// list all jobsvarjobs= client.Jobs.ListAll();// create output assetvaroutputAssetName= MKIOClient.GenerateUniqueName("asset");varoutputAsset= client.Assets.CreateOrUpdate(outputAssetName, outputAssetName, config["StorageName"],"output asset for job");// create a job with the output asset created and with an asset as a sourcevarnewJob= client.Jobs.Create(transform.Name, MKIOClient.GenerateUniqueName("job"),new JobProperties
{Description=$"My Job using an asset source with transform {transform.Name}",Priority= JobPriorityType.Normal,Input=new JobInputAsset("copy-ef2058b692-copy",newList<string>{"switch_1920x1080_AACAudio_3677.mp4"}),Outputs=newList<JobOutputAsset>(){new JobOutputAsset(){AssetName=outputAssetName}}});// job with http source as a sourcevarnewJobH= client.Jobs.Create(transform.Name, MKIOClient.GenerateUniqueName("job"),new JobProperties
{Description=$"My job using a https source with transform {transform.Name}",Priority= TransformOutputPriorityType.Normal,Input=new JobInputHttp(null,newList<string>{"https://myurltovideofile.mp4"}),Outputs=newList<JobOutputAsset>(){new JobOutputAsset(){AssetName=outputAssetName}}});// wait for the job to completewhile(newJobH.Properties.State == JobState.Queued || newJobH.Properties.State == JobState.Scheduled || newJobH.Properties.State == JobState.Processing){newJobH= client.Jobs.Get(tranform.Name, newJobH.Name);
Console.WriteLine(jobHttp.Properties.State);
Thread.Sleep(10000);}// Get a jobvarjob2= client.Jobs.Get(tranform.Name,"testjob1");// Cancel a job
client.Jobs.Cancel(tranform.Name,"testjob2");// Delete a job
client.Jobs.Delete(tranform.Name,"testjob3");