Azure SAS expiry for audio files

156 views Asked by At

Our audio files are stored in Azure blob storage.

The user is provided with a SAS URL link for playing the audio files. The SAS URL has an expiry of 5 mins. But, for long audio files (Say 10 mins), the streaming of audio stops while the audio is playing after 5 mins because the token expires which is the right thing to do.

However, what is the right way to fix this? Does the client request the backend for a new SAS token before the expiry time?

4

There are 4 answers

0
Rahul Shukla On BEST ANSWER

For the SAS token expiry while buffering keep tracking the expiry time and renew the SAS token. Since for security reason you can't increase expiry time but in case if its expired then renew.

2
Vova Bilyachat On

You did not say much about buffering and how your player works.

  1. I would do it that way that i would issue SAS for duration of soundtrack * 2
  2. Then I would add logic into my player if you stop and then start again then get new SAS token.
  3. I would add error handling and try to get new token url on error (https://www.w3schools.com/tags/av_event_error.asp)
0
AudioBubble On

You need to implement the logic of renew SAS token which will work whenever your SAS token got expired then you need renew your token in your retry logic. Keep the track of the token expiry based on that you can run renew logic

0
user1000 On

SAS token basically need to be continuously refreshed on certain interval in order to make sure no connection breach. So keep retry mechanism for this.