Provide a videoUrl to the videoindexer with query parameters in it

121 Views Asked by At

We're in the process of implementing the videoindexer. To upload videos, we'd like to use the videoUrl method instead of uploading the video file. For this we're using url's of videos on our blob storage. These require a SAS token to be served, so the url contains query parameters. However, I'm unable to provide a videoUrl with query parameters to the endpoint on the videoindexer.

Example of a test request:

https://api.videoindexer.ai/trial/Accounts/MY_ACCOUNT_ID/Videos?accessToken=MY_ACCESS_TOKEN&name=interview&description=interview&privacy=private&partition=some_partition&indexingPreset=AudioOnly&streamingPreset=NoStreaming&videoUrl=https://manualtovideos.blob.core.windows.net/asset-xxxxx/interview.mp4?sp=rl&st=2020-12-03T16:48:42Z&se=2020-12-04T16:48:42Z&sv=2019-12-12&sr=b&sig=l57dDjKYr...8%25253D

When I shorten the blob url using a url shortener service, it works. The docs say I need to url encode the videoUrl, so I'm doing that using javascript's encodeURI But this doesn't change the url much, since it disregards ?'s and &'s.

Do I need to encode the url in a different way somehow? Or is there another way to authenticate, so I can use the blob url without the sas token, since it's also on Azure?

2

There are 2 best solutions below

0
Dyte On BEST ANSWER

So it turned out I needed to use encodeURIComponent() to encode the videoUrl parameter instead of just encodeURI() or escape()

1
Ika On

You need to encode the URL.

You can see how it's created using the Azure Video Analyzer for Media Developer Portal in the upload method.