Skip to content

DolbyIO/dolbyio-rest-apis-client-dotnet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build NuGet Package Publish NuGet Package .NET Nuget License

Dolby.io REST APIs Client for .NET

.NET wrapper for the Dolby Millicast and Media APIs.

Install this SDK

If you want to use NuGet, use the following command:

dotnet add package DolbyIO.Rest

Real-time Streaming Examples

Create a publish token

using System;
using DolbyIO.Rest;
using DolbyIO.Rest.Streaming.Models;
using Newtonsoft.Json;

const string API_SECRET = "api_secret";

using DolbyIOClient client = new DolbyIOClient();

CreatePublishToken create = new CreatePublishToken
{
    Label = "My token",
    Streams = new List<PublishTokenStream>
    {
        new PublishTokenStream
        {
            StreamName = "feedA"
        }
    }
};
PublishToken token = await client.Streaming.PublishToken.CreateAsync(API_SECRET, create);

Create a subscribe token

using System;
using DolbyIO.Rest;
using DolbyIO.Rest.Streaming.Models;
using Newtonsoft.Json;

const string API_SECRET = "api_secret";

using DolbyIOClient client = new DolbyIOClient();

CreateSubscribeToken create = new CreateSubscribeToken
{
    Label = "My token",
    Streams = new List<SubscribeTokenStream>
    {
        new SubscribeTokenStream
        {
            StreamName = "feedA"
        }
    }
};
SubscribeToken token = await client.Streaming.SubscribeToken.CreateAsync(API_SECRET, create);

Media Examples

Start an enhance job

To start an enhance job, use the following code:

using System;
using DolbyIO.Rest;
using DolbyIO.Rest.Media.Models;
using Newtonsoft.Json;

const string APP_KEY = "app_key";
const string APP_SECRET = "app_secret";

using DolbyIOClient client = new DolbyIOClient();

JwtToken jwt = await client.Media.Authentication.GetApiAccessTokenAsync(APP_KEY, APP_SECRET);

string jobDescription = JsonConvert.SerializeObject(new {
    content = new { type = "podcast" },
    input = "dlb://in/file.mp4",
    output = "dlb://out/file.mp4"
});

string jobId = await client.Media.Enhance.StartAsync(jwt, jobDescription);
Console.WriteLine($"Job ID: {jobId}");