.NET Video Upload Exception
We are using the .NET Cloudinary.Core 1.31.0 package inside of a Xamarin.Droid project and consistently get the following exception on some devices:
"Error while copying content to a stream."
at System.Net.Http.HttpContent.CopyToAsyncCore (System.Threading.Tasks.ValueTask copyTask)
when running the following code that uploads a video asynchronously:
public async Task<string> UploadVideo(byte[] data)
{
VideoUploadResult uploadResult = null;
try
{
Stream stream = new MemoryStream(data);
if (stream != null && stream.Length > 0)
{
var uploadParams = new VideoUploadParams()
{
File = new FileDescription(GetVideoGuid, stream),
PublicId = GetVideoGuid,
};
uploadResult = await _cloudinary.UploadAsync(uploadParams);
}
}
catch (Exception ex)
{
}
return (uploadResult != null && uploadResult.PublicId !=null) ? uploadResult.PublicId.ToString() : null;
}
Our upload test case seems to work with many devices, however, some devices consistently fail this test case with the above exception.
We have initialized _cloudinary by only specifying our account info (attempting to use all default values).
_cloudinary = new Cloudinary(account);
Properties for the video that resulted in the exception on a device (note on another device, this same video upload has been successful):
Size: 51,290,475 bytes
Kind: MPEG-4 movie
Dimensions: 2160 × 3840
Codecs: AAC, H.264
Color Profile: HD (1-1-1)
Duration: 00:06
Audio Channels: Stereo
Devices where we have observed the exception:
- Galaxy S10+ running Android 12
- Galaxy A71 running Android 12
-
Hi Raavi,
In order for us to be able to debug and investigate further on the issue, can you please help to open a support ticket here (https://support.cloudinary.com/hc/en-us/requests/new) and to provide us with the stack trace error log file?
0
Post is closed for comments.
Comments
1 comment