Git Product home page Git Product logo

mux-csharp's Introduction

mux-csharp

NuGet | Mux Docs | Mux API Reference

Mux is how developers build online video. This API encompasses both Mux Video and Mux Data functionality to help you build your video-related projects better and faster than ever before.

PLEASE NOTE: This is an early build of the Mux C# SDK, as evidenced by its pre-1.0 status, but we're reasonably certain of its stability and usability against the Mux API.. Documentation is currently best-effort, but it'll improve over time! Instead of contacting Mux Support, please file an issue on this repository or email Mux DevEx for assistance.

Frameworks supported

  • .NET Core >=1.0
  • .NET Framework >=4.6
  • Mono/Xamarin >=vNext

Dependencies

The DLLs included in the package may not be the latest version. We recommend using NuGet to obtain the latest version of the packages:

Install-Package RestSharp
Install-Package Newtonsoft.Json
Install-Package JsonSubTypes
Install-Package System.ComponentModel.Annotations

NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742

Installation

Generate the DLL using your preferred tool (e.g. dotnet build)

Then include the DLL (under the bin folder) in the C# project, and use the namespaces:

using Mux.Csharp.Sdk.Api;
using Mux.Csharp.Sdk.Client;
using Mux.Csharp.Sdk.Model;

Usage

To use the API client with a HTTP proxy, setup a System.Net.WebProxy

Configuration c = new Configuration();
System.Net.WebProxy webProxy = new System.Net.WebProxy("http://myProxyUrl:80/");
webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
c.Proxy = webProxy;

Getting Started

using System.Collections.Generic;
using System.Diagnostics;
using Mux.Csharp.Sdk.Api;
using Mux.Csharp.Sdk.Client;
using Mux.Csharp.Sdk.Model;

namespace Example
{
    public class Example
    {
        public static void Main()
        {

            Configuration config = new Configuration();
            config.BasePath = "https://api.mux.com";
            // Configure HTTP basic authorization: accessToken
            config.Username = "YOUR_USERNAME";
            config.Password = "YOUR_PASSWORD";

            var apiInstance = new AssetsApi(config);
            var createAssetRequest = new CreateAssetRequest(); // CreateAssetRequest | 

            try
            {
                // Create an asset
                AssetResponse result = apiInstance.CreateAsset(createAssetRequest);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling AssetsApi.CreateAsset: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }

        }
    }
}

Documentation for API Endpoints

All URIs are relative to https://api.mux.com

Class Method HTTP request Description
AssetsApi CreateAsset POST /video/v1/assets Create an asset
AssetsApi CreateAssetPlaybackId POST /video/v1/assets/{ASSET_ID}/playback-ids Create a playback ID
AssetsApi CreateAssetTrack POST /video/v1/assets/{ASSET_ID}/tracks Create an asset track
AssetsApi DeleteAsset DELETE /video/v1/assets/{ASSET_ID} Delete an asset
AssetsApi DeleteAssetPlaybackId DELETE /video/v1/assets/{ASSET_ID}/playback-ids/{PLAYBACK_ID} Delete a playback ID
AssetsApi DeleteAssetTrack DELETE /video/v1/assets/{ASSET_ID}/tracks/{TRACK_ID} Delete an asset track
AssetsApi GenerateAssetTrackSubtitles POST /video/v1/assets/{ASSET_ID}/tracks/{TRACK_ID}/generate-subtitles Generate track subtitles
AssetsApi GetAsset GET /video/v1/assets/{ASSET_ID} Retrieve an asset
AssetsApi GetAssetInputInfo GET /video/v1/assets/{ASSET_ID}/input-info Retrieve asset input info
AssetsApi GetAssetPlaybackId GET /video/v1/assets/{ASSET_ID}/playback-ids/{PLAYBACK_ID} Retrieve a playback ID
AssetsApi ListAssets GET /video/v1/assets List assets
AssetsApi UpdateAsset PATCH /video/v1/assets/{ASSET_ID} Update an asset
AssetsApi UpdateAssetMasterAccess PUT /video/v1/assets/{ASSET_ID}/master-access Update master access
AssetsApi UpdateAssetMp4Support PUT /video/v1/assets/{ASSET_ID}/mp4-support Update MP4 support
DRMConfigurationsApi GetDrmConfiguration GET /video/v1/drm-configurations/{DRM_CONFIGURATION_ID} Retrieve a DRM Configuration
DRMConfigurationsApi ListDrmConfigurations GET /video/v1/drm-configurations List DRM Configurations
DeliveryUsageApi ListDeliveryUsage GET /video/v1/delivery-usage List Usage
DimensionsApi ListDimensionValues GET /data/v1/dimensions/{DIMENSION_ID} Lists the values for a specific dimension
DimensionsApi ListDimensions GET /data/v1/dimensions List Dimensions
DirectUploadsApi CancelDirectUpload PUT /video/v1/uploads/{UPLOAD_ID}/cancel Cancel a direct upload
DirectUploadsApi CreateDirectUpload POST /video/v1/uploads Create a new direct upload URL
DirectUploadsApi GetDirectUpload GET /video/v1/uploads/{UPLOAD_ID} Retrieve a single direct upload's info
DirectUploadsApi ListDirectUploads GET /video/v1/uploads List direct uploads
ErrorsApi ListErrors GET /data/v1/errors List Errors
ExportsApi ListExports GET /data/v1/exports List property video view export links
ExportsApi ListExportsViews GET /data/v1/exports/views List available property view exports
FiltersApi ListFilterValues GET /data/v1/filters/{FILTER_ID} Lists values for a specific filter
FiltersApi ListFilters GET /data/v1/filters List Filters
IncidentsApi GetIncident GET /data/v1/incidents/{INCIDENT_ID} Get an Incident
IncidentsApi ListIncidents GET /data/v1/incidents List Incidents
IncidentsApi ListRelatedIncidents GET /data/v1/incidents/{INCIDENT_ID}/related List Related Incidents
LiveStreamsApi CreateLiveStream POST /video/v1/live-streams Create a live stream
LiveStreamsApi CreateLiveStreamPlaybackId POST /video/v1/live-streams/{LIVE_STREAM_ID}/playback-ids Create a live stream playback ID
LiveStreamsApi CreateLiveStreamSimulcastTarget POST /video/v1/live-streams/{LIVE_STREAM_ID}/simulcast-targets Create a live stream simulcast target
LiveStreamsApi DeleteLiveStream DELETE /video/v1/live-streams/{LIVE_STREAM_ID} Delete a live stream
LiveStreamsApi DeleteLiveStreamPlaybackId DELETE /video/v1/live-streams/{LIVE_STREAM_ID}/playback-ids/{PLAYBACK_ID} Delete a live stream playback ID
LiveStreamsApi DeleteLiveStreamSimulcastTarget DELETE /video/v1/live-streams/{LIVE_STREAM_ID}/simulcast-targets/{SIMULCAST_TARGET_ID} Delete a live stream simulcast target
LiveStreamsApi DisableLiveStream PUT /video/v1/live-streams/{LIVE_STREAM_ID}/disable Disable a live stream
LiveStreamsApi EnableLiveStream PUT /video/v1/live-streams/{LIVE_STREAM_ID}/enable Enable a live stream
LiveStreamsApi GetLiveStream GET /video/v1/live-streams/{LIVE_STREAM_ID} Retrieve a live stream
LiveStreamsApi GetLiveStreamPlaybackId GET /video/v1/live-streams/{LIVE_STREAM_ID}/playback-ids/{PLAYBACK_ID} Retrieve a live stream playback ID
LiveStreamsApi GetLiveStreamSimulcastTarget GET /video/v1/live-streams/{LIVE_STREAM_ID}/simulcast-targets/{SIMULCAST_TARGET_ID} Retrieve a live stream simulcast target
LiveStreamsApi ListLiveStreams GET /video/v1/live-streams List live streams
LiveStreamsApi ResetStreamKey POST /video/v1/live-streams/{LIVE_STREAM_ID}/reset-stream-key Reset a live stream's stream key
LiveStreamsApi SignalLiveStreamComplete PUT /video/v1/live-streams/{LIVE_STREAM_ID}/complete Signal a live stream is finished
LiveStreamsApi UpdateLiveStream PATCH /video/v1/live-streams/{LIVE_STREAM_ID} Update a live stream
LiveStreamsApi UpdateLiveStreamEmbeddedSubtitles PUT /video/v1/live-streams/{LIVE_STREAM_ID}/embedded-subtitles Update a live stream's embedded subtitles
LiveStreamsApi UpdateLiveStreamGeneratedSubtitles PUT /video/v1/live-streams/{LIVE_STREAM_ID}/generated-subtitles Update a live stream's generated subtitles
MetricsApi GetMetricTimeseriesData GET /data/v1/metrics/{METRIC_ID}/timeseries Get metric timeseries data
MetricsApi GetOverallValues GET /data/v1/metrics/{METRIC_ID}/overall Get Overall values
MetricsApi ListAllMetricValues GET /data/v1/metrics/comparison List all metric values
MetricsApi ListBreakdownValues GET /data/v1/metrics/{METRIC_ID}/breakdown List breakdown values
MetricsApi ListInsights GET /data/v1/metrics/{METRIC_ID}/insights List Insights
MonitoringApi GetMonitoringBreakdown GET /data/v1/monitoring/metrics/{MONITORING_METRIC_ID}/breakdown Get Monitoring Breakdown
MonitoringApi GetMonitoringBreakdownTimeseries GET /data/v1/monitoring/metrics/{MONITORING_METRIC_ID}/breakdown-timeseries Get Monitoring Breakdown Timeseries
MonitoringApi GetMonitoringHistogramTimeseries GET /data/v1/monitoring/metrics/{MONITORING_HISTOGRAM_METRIC_ID}/histogram-timeseries Get Monitoring Histogram Timeseries
MonitoringApi GetMonitoringTimeseries GET /data/v1/monitoring/metrics/{MONITORING_METRIC_ID}/timeseries Get Monitoring Timeseries
MonitoringApi ListMonitoringDimensions GET /data/v1/monitoring/dimensions List Monitoring Dimensions
MonitoringApi ListMonitoringMetrics GET /data/v1/monitoring/metrics List Monitoring Metrics
PlaybackIDApi GetAssetOrLivestreamId GET /video/v1/playback-ids/{PLAYBACK_ID} Retrieve an asset or live stream ID
PlaybackRestrictionsApi CreatePlaybackRestriction POST /video/v1/playback-restrictions Create a Playback Restriction
PlaybackRestrictionsApi DeletePlaybackRestriction DELETE /video/v1/playback-restrictions/{PLAYBACK_RESTRICTION_ID} Delete a Playback Restriction
PlaybackRestrictionsApi GetPlaybackRestriction GET /video/v1/playback-restrictions/{PLAYBACK_RESTRICTION_ID} Retrieve a Playback Restriction
PlaybackRestrictionsApi ListPlaybackRestrictions GET /video/v1/playback-restrictions List Playback Restrictions
PlaybackRestrictionsApi UpdateReferrerDomainRestriction PUT /video/v1/playback-restrictions/{PLAYBACK_RESTRICTION_ID}/referrer Update the Referrer Playback Restriction
PlaybackRestrictionsApi UpdateUserAgentRestriction PUT /video/v1/playback-restrictions/{PLAYBACK_RESTRICTION_ID}/user_agent Update the User Agent Restriction
RealTimeApi GetRealtimeBreakdown GET /data/v1/realtime/metrics/{REALTIME_METRIC_ID}/breakdown Get Real-Time Breakdown
RealTimeApi GetRealtimeHistogramTimeseries GET /data/v1/realtime/metrics/{REALTIME_HISTOGRAM_METRIC_ID}/histogram-timeseries Get Real-Time Histogram Timeseries
RealTimeApi GetRealtimeTimeseries GET /data/v1/realtime/metrics/{REALTIME_METRIC_ID}/timeseries Get Real-Time Timeseries
RealTimeApi ListRealtimeDimensions GET /data/v1/realtime/dimensions List Real-Time Dimensions
RealTimeApi ListRealtimeMetrics GET /data/v1/realtime/metrics List Real-Time Metrics
SigningKeysApi CreateSigningKey POST /system/v1/signing-keys Create a signing key
SigningKeysApi DeleteSigningKey DELETE /system/v1/signing-keys/{SIGNING_KEY_ID} Delete a signing key
SigningKeysApi GetSigningKey GET /system/v1/signing-keys/{SIGNING_KEY_ID} Retrieve a signing key
SigningKeysApi ListSigningKeys GET /system/v1/signing-keys List signing keys
SpacesApi CreateSpace POST /video/v1/spaces Create a space
SpacesApi CreateSpaceBroadcast POST /video/v1/spaces/{SPACE_ID}/broadcasts Create a space broadcast
SpacesApi DeleteSpace DELETE /video/v1/spaces/{SPACE_ID} Delete a space
SpacesApi DeleteSpaceBroadcast DELETE /video/v1/spaces/{SPACE_ID}/broadcasts/{BROADCAST_ID} Delete a space broadcast
SpacesApi GetSpace GET /video/v1/spaces/{SPACE_ID} Retrieve a space
SpacesApi GetSpaceBroadcast GET /video/v1/spaces/{SPACE_ID}/broadcasts/{BROADCAST_ID} Retrieve space broadcast
SpacesApi ListSpaces GET /video/v1/spaces List spaces
SpacesApi StartSpaceBroadcast POST /video/v1/spaces/{SPACE_ID}/broadcasts/{BROADCAST_ID}/start Start a space broadcast
SpacesApi StopSpaceBroadcast POST /video/v1/spaces/{SPACE_ID}/broadcasts/{BROADCAST_ID}/stop Stop a space broadcast
TranscriptionVocabulariesApi CreateTranscriptionVocabulary POST /video/v1/transcription-vocabularies Create a Transcription Vocabulary
TranscriptionVocabulariesApi DeleteTranscriptionVocabulary DELETE /video/v1/transcription-vocabularies/{TRANSCRIPTION_VOCABULARY_ID} Delete a Transcription Vocabulary
TranscriptionVocabulariesApi GetTranscriptionVocabulary GET /video/v1/transcription-vocabularies/{TRANSCRIPTION_VOCABULARY_ID} Retrieve a Transcription Vocabulary
TranscriptionVocabulariesApi ListTranscriptionVocabularies GET /video/v1/transcription-vocabularies List Transcription Vocabularies
TranscriptionVocabulariesApi UpdateTranscriptionVocabulary PUT /video/v1/transcription-vocabularies/{TRANSCRIPTION_VOCABULARY_ID} Update a Transcription Vocabulary
URLSigningKeysApi CreateUrlSigningKey POST /video/v1/signing-keys Create a URL signing key
URLSigningKeysApi DeleteUrlSigningKey DELETE /video/v1/signing-keys/{SIGNING_KEY_ID} Delete a URL signing key
URLSigningKeysApi GetUrlSigningKey GET /video/v1/signing-keys/{SIGNING_KEY_ID} Retrieve a URL signing key
URLSigningKeysApi ListUrlSigningKeys GET /video/v1/signing-keys List URL signing keys
VideoViewsApi GetVideoView GET /data/v1/video-views/{VIDEO_VIEW_ID} Get a Video View
VideoViewsApi ListVideoViews GET /data/v1/video-views List Video Views
WebInputsApi CreateWebInput POST /video/v1/web-inputs Create a new Web Input
WebInputsApi DeleteWebInput DELETE /video/v1/web-inputs/{WEB_INPUT_ID} Delete a Web Input
WebInputsApi GetWebInput GET /video/v1/web-inputs/{WEB_INPUT_ID} Retrieve a Web Input
WebInputsApi LaunchWebInput PUT /video/v1/web-inputs/{WEB_INPUT_ID}/launch Launch a Web Input
WebInputsApi ListWebInputs GET /video/v1/web-inputs List Web Inputs
WebInputsApi ReloadWebInput PUT /video/v1/web-inputs/{WEB_INPUT_ID}/reload Reload a Web Input
WebInputsApi ShutdownWebInput PUT /video/v1/web-inputs/{WEB_INPUT_ID}/shutdown Shut down a Web Input
WebInputsApi UpdateWebInputUrl PUT /video/v1/web-inputs/{WEB_INPUT_ID}/url Update Web Input URL

Documentation for Models

Documentation for Authorization

accessToken

  • Type: HTTP basic authentication

mux-csharp's People

Contributors

baynezy avatar dependabot[bot] avatar eropple avatar jaredsmith avatar jsanford8 avatar philcluff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mux-csharp's Issues

CreateAssetAsync() - how to upload video from a local file

Hello,

I am trying to create a new video asset from a local video file. The CreateAssetAsync() method's CreatesAssetRequest has the Url field, but I am not able to figure out how to upload a local file.

Example code:

using mux = Mux.Csharp.Sdk.Client;

mux.Configuration config = new();
config.BasePath = "https://api.mux.com";
config.Username = "9074...";
config.Password = "XtR....";

var api = new AssetsApi(config);
var request = new CreateAssetRequest
{
	Test = true,
	PlaybackPolicy = new List<PlaybackPolicy> { PlaybackPolicy.Signed },
	Input = new List<InputSettings> { new InputSettings {
	Type = InputSettings.TypeEnum.Video, 

	//Url = @"c:\Users\Radek\Desktop\test AT media\sample-mp4-file-small.mp4"
	//Url = "file:///c:/Users/Radek/Desktop/test AT media/sample-mp4-file-small.mp4"

	----> how should I specify a local file here????
	} }
};

AssetResponse response = await api.CreateAssetAsync(request);
return response ?? throw new Exception("MUX API CreateAssetAsync did not return any data");

I can see that the Post<T> method in ApiClient.cs supports posting files via the RequestOptions parameter, however the CreateAssetAsync() method does not contain any code to pass the filestream to the RequestOptions.Data property.

Can you suggest what am I doing wrong?

Thanks.

R.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.