AbuShokry
AbuShokry

Reputation: 309

Azure Video Indexer - Problem Uploading Video From Blob URL with SAS Token

I'm trying to automatically pass videos uploaded into my Azure Blob to the Azure Video Indexer Services using the Upload Video API here: https://api-portal.videoindexer.ai/docs/services/Operations/operations/Upload-Video/console

My problem is that if I pass the video_url parameter as a blob url + the SAS access token, the API returns an error

{
  "ErrorType": "INVALID_INPUT",
  "Message": "Url content type 'application/xml' is not supported. Only audio and video files are supported. You can find the supported
}

But if I upload the same video to a hosting service that gives me a direct URL to the video file, and then use that URL, it works.

The API call looks like this:

POST https://api.videoindexer.ai/trial/Accounts/{Account_ID}/Videos?name={Video_Name}&privacy=Private&videoUrl=https://{Azure_Blob_Video_URL}.mp4?{sas_token}&indexingPreset=Default&streamingPreset=Default&sendSuccessEmail=False&accessToken={access_token} HTTP/1.1
Host: api.videoindexer.ai
x-ms-client-request-id: 1012ac93-bbbb-cccc-aaaa-edf520fa7e8c
Ocp-Apim-Subscription-Key: {api_key}

Please note that if I paste the blob url + SAS token into the browser, the video plays fine, and the network tab in Chrome's Dev Tools shows that the content type is video/mp4

So how can I get the blob URLs to work?

Thank you

Upvotes: 0

Views: 962

Answers (2)

Arnoud Jonker
Arnoud Jonker

Reputation: 1

For anyone still running into this problem, I solved it by replacing the each & in the sas token with %26. %26 is the URL escape token. For other escape tokens check:

https://docs.microfocus.com/OMi/10.62/Content/OMi/ExtGuide/ExtApps/URL_encoding.htm

Upvotes: 0

Adam Marczak
Adam Marczak

Reputation: 2351

I think the combination that you make here is somehow incorrect.

https://{Azure_Blob_Video_URL}.mp4?{sas_token}

Porbably after combining this it returns 404 with XML saying Blob Not Found.

Try encoding the blob URL as the special signs in the SAS string might be the problem.

Or make it your last variable in the URL.

POST https://api.videoindexer.ai/trial/Accounts/{Account_ID}/Videos?name={Video_Name}&privacy=Private&indexingPreset=Default&streamingPreset=Default&sendSuccessEmail=False&accessToken={access_token}&videoUrl=https://{Azure_Blob_Video_URL}.mp4?{sas_token}

Upvotes: 1

Related Questions