I am trying to play HLS on the AWS Private Bucket, where every resource needs to be signed with a presigned URL token. To play every chunk of the media, I need to load the token from the server and append it to every chunk request.
I know that in order to replace the token, I can use the following code:"
player.tech().vhs.xhr.beforeRequest = function(options) { options.uri = options.uri + token; return options; };
The problem here is that I don't have the token on the client side; I have to request the token from the server. Is there any way I can make the beforeRequest wait until I load the token from the server?
beforeRequest and the hooks that replace that need to return the updated options so can't be asynchronous. You might need to fetch you token before setting the source.
I am trying to play HLS on the AWS Private Bucket, where every resource needs to be signed with a presigned URL token. To play every chunk of the media, I need to load the token from the server and append it to every chunk request.
I know that in order to replace the token, I can use the following code:"
player.tech().vhs.xhr.beforeRequest = function(options) { options.uri = options.uri + token; return options; };
The problem here is that I don't have the token on the client side; I have to request the token from the server. Is there any way I can make the beforeRequest wait until I load the token from the server?