I keep getting an error using the C# 18.4 version of the Client Library when attempting to create a Media Event. The media event code is below
static List<string> CreateMediaEvent(Entry entry, Client client)
{
List<string> Ids = new List<string>();
MediaEntry mediaEntry = new MediaEntry
{
MediaType = MediaType.VIDEO,
Type = EntryType.MEDIA_CLIP,
Name = entry.Title,
Tags = entry.Tags,
UserId = "RecordScheduleGroup",
EntitledUsersEdit = entry.CoEditors,
EntitledUsersPublish = entry.CoPublishers,
CategoriesIds = entry.CategoryIds
};
bool done = false;
OnCompletedHandler<MediaEntry> handler = new OnCompletedHandler<MediaEntry>(
(MediaEntry result, Exception e) =>
{
Ids.Add(result.Id);
Ids.Add(result.ReferenceId);
Ids.Add(result.RootEntryId);
Ids.Add(result.TemplateEntryId);
WriteLog("MediaEntry List for Create Media Entry result: " + ResponseToString(result));
done = true;
});
MediaService.Add(mediaEntry)
.SetCompletion(handler)
.Execute(client);
while (!done)
{
Thread.Sleep(100);
}
return Ids;
}
My client code is
static Client createKalturaClient()
{
Configuration config = new Configuration();
config.ServiceUrl = "https://www.kaltura.com/";
Client client = new Client(config);
SessionType type = SessionType.ADMIN;
int expiry = 86400;
string privileges = "";
client.KS = client.GenerateSession(<client id>, <admin secret from https://developer.kaltura.com/>, <my publisher email with admin privs> type, expiry, privileges);
return client;
}
Error message is below
System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.BeginReceive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, AsyncCallback callback, Object state)
at System.Net.Sockets.NetworkStream.BeginRead(Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state)
--- End of inner exception stack trace ---
at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult)
at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult, TransportContext& context)
at System.Net.Http.HttpClientHandler.GetRequestStreamCallback(IAsyncResult ar)
--- End of inner exception stack trace ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Kaltura.Request.BaseRequestBuilder`1.<ExecuteAsync>d__22.MoveNext()
I am able to get a session with type ADMIN and a client.KS string, yet when I try to perform any action I get denied.
What does the error mean? That my session does not have privileges to do what I am requesting?
Is there an API call that can return information on the privileges of the session I am running?
Thank you