Welcome to the Panopto Community

Please note: All new registrants to the Panopto Community Forum must be approved by a forum moderator or admin. As such, if you navigate to a feature that is members-only, you may receive an error page if your registration has not yet been approved. We apologize for any inconvenience and are approving new members as quickly as possible.
Options

Uploading video file using s3 multipart upload protocol

edited April 2023 in API

I'm developing an .Net application that will upload videos stored locally into Panopto.

I've managed to get the uploadTarget url which i understand is needed for the s3 protocol.

However, i'm having trouble initiating the s3 client as my experience with AWS is fairly limited. I keep getting a bucket not found error so its probably a configuration issue but i'm not sure where.

uploadTarget i get when creating a panopto session is something like "https://{SERVER}/Panopto/Upload/3768054f-80a4-4e95-85f4-afe3012ad49b" My server is in EU west

My code below:

        string[] nUploadTarget = UploadTarget.Split("/");

        string service_endpoint = nUploadTarget[2];

        service_endpoint = "https://" + service_endpoint;

        string prefix = nUploadTarget[4]; // in this case "Upload"

        string bucket = nUploadTarget[5]; // in this case "3768054f-80a4-4e95-85f4-afe3012ad49b"

        string objectKey = $"{prefix}/{file}";

        long PART_SIZE = 5 * 1024 * 1024; // 5MB


        //Initalise the s3 client

        var config = new AmazonS3Config

        {

            ServiceURL = service_endpoint,

            ForcePathStyle = true,

            SignatureVersion = "s3v4",

            UseHttp = true,

            RegionEndpoint = RegionEndpoint.EUWest1

        };

        var credentials = new BasicAWSCredentials("", "");

        var client = new AmazonS3Client(credentials, config);


        //Initiate the upload sequence

        InitiateMultipartUploadRequest initiateRequest = new InitiateMultipartUploadRequest

        {

            BucketName = ,

            Key = objectKey

        };


        InitiateMultipartUploadResponse initiateResponse = await client.InitiateMultipartUploadAsync(initiateRequest);



Any help is appreciated.


Thanks



EDIT: I found the issue turns out that despite setting the serviceURL in the config variable it wasn't actually being set for some reason. I just reset the attribute immediately after and that did it.

Tagged:
Sign In or Register to comment.