Reputation: 3378
Using the BitMovin Streams service, I want to:
No transformation or muxing. The Bitmovin dashboard offers this feature out of the box: select a file -> it gets uploaded -> no setup to be done -> the stream is ready.
The steps are straight forward:
I'm looking for a way to do exactly that (and nothing more) using the SDK (C#, but any documentation would do).
Uploading works thanks to their example. I currently tried some examples from the documentation but it seems very convoluted while the dashboard flow shows a very easy process.
The (simplified) code below uploads successfully, creates encoding and stream, but in the end: I have no manifest, no stream-id.
var fileInput = await _bitmovinApi.Encoding.Inputs.DirectFileUpload.CreateAsync(new());
var fileContent = new StreamContent(fileStream);
var fileUploadContent = new MultipartFormDataContent { { fileContent, "file", filename } };
var fileUploadResponse = await _httpClient.PutAsync(fileInput.UploadUrl, fileUploadContent, args.CancellationToken);
if (!fileUploadResponse.IsSuccessStatusCode)
throw await fileUploadResponse.Content.ReadAsStringAsync();
var codecConfig = await _bitmovinApi.Encoding.Configurations.Video.H264.CreateAsync(new()
{
DynamicRangeFormat = H264DynamicRangeFormat.SDR
});
var encoding = await _bitmovinApi.Encoding.Encodings.CreateAsync(new()
{
Name = filename
});
var stream = await _bitmovinApi.Encoding.Encodings.Streams.CreateAsync(encoding.Id, new()
{
InputStreams = [new()
{
InputId = fileInput.Id,
InputPath = fileInput.UploadUrl,
}],
CodecConfigId = codecConfig.Id
});
Is there a easier way to create a stream programmatically? Am I looking at the wrong service/provider to do such a simple scenario?
Upvotes: 1
Views: 60
Reputation: 23678
I believe you are using the wrong API here. The workflow you refer to is the Streams product, our all-in-one API that enables this seamless workflow and it is a different API from the main Encoding API that you're referencing in the post.
What you are looking for is described in our documentation here: https://developer.bitmovin.com/streams/docs/use-cdn-file-upload-with-streams
As you can see the main endpoint to create a stream and retrieve a streamId
is the POST
call to https://api.bitmovin.com/v1/streams/video
(doc)
The create streams call requires a file to be already uploaded to the internet and that's where the Direct File Upload API comes in which you're already correctly using.
Hope this helps.
Upvotes: 1