Skip to content

Commit

Permalink
Merge pull request #10 from ant-media/subscriberBlockNotWorkingAdaptive
Browse files Browse the repository at this point in the history
Dont add security parameters if they already exist hls
  • Loading branch information
mekya authored Apr 1, 2024
2 parents 828f9c2 + 7715ff5 commit 68fdbb1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 16 additions & 9 deletions src/web_player.js
Original file line number Diff line number Diff line change
Expand Up @@ -636,19 +636,26 @@ export class WebPlayer {
//hls specific calls
if (extension == "m3u8") {
videojs.Vhs.xhr.beforeRequest = (options) => {
const queryParams = [];

let securityParams = this.getSecurityQueryParams();
if (!options.uri.includes(securityParams))
{
if (!options.uri.endsWith("?"))
{
options.uri = options.uri + "?";
}
options.uri += securityParams;
if (!options.uri.includes("subscriberId") && this.subscriberId != null) {
queryParams.push(`subscriberId=${this.subscriberId}`);
}

if (!options.uri.includes("subscriberCode") && this.subscriberCode != null) {
queryParams.push(`subscriberCode=${this.subscriberCode}`);
}

if (!options.uri.includes("token") && this.token != null) {
queryParams.push(`token=${this.token}`);
}

if (queryParams.length > 0) {
const queryString = queryParams.join("&");
options.uri += options.uri.includes("?") ? `&${queryString}` : `?${queryString}`;
}
Logger.debug("hls request: " + options.uri);
return options;

};


Expand Down

0 comments on commit 68fdbb1

Please sign in to comment.