Skip to content

Commit

Permalink
fix(HLS): Fix url management in HLS (shaka-project#5722)
Browse files Browse the repository at this point in the history
Fix variable substitution in: AES-128 key and EXT-X-SESSION-DATA urls.
Fix to keep previous query params when using blocking playlist reload
Simplifies and unifies URL management to allow Content Steering in the
future

Backported to v4.4.x
  • Loading branch information
avelad authored and joeyparrish committed Oct 6, 2023
1 parent e9e9313 commit a55ebab
Show file tree
Hide file tree
Showing 5 changed files with 169 additions and 193 deletions.
35 changes: 3 additions & 32 deletions lib/hls/hls_classes.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ goog.provide('shaka.hls.Segment');
goog.provide('shaka.hls.Tag');

goog.require('goog.asserts');
goog.require('shaka.hls.Utils');
goog.require('shaka.util.Error');


Expand Down Expand Up @@ -203,48 +202,20 @@ shaka.hls.Segment = class {
/**
* Creates an HLS segment object.
*
* @param {string} absoluteMediaPlaylistUri An absolute Media Playlist URI.
* @param {string} verbatimSegmentUri verbatim segment URI.
* @param {!Array.<shaka.hls.Tag>} tags
* @param {!Array.<shaka.hls.Tag>=} partialSegments
*/
constructor(absoluteMediaPlaylistUri, verbatimSegmentUri, tags,
partialSegments=[]) {
constructor(verbatimSegmentUri, tags, partialSegments=[]) {
/** @const {!Array.<shaka.hls.Tag>} */
this.tags = tags;

/** @type {?string} */
this.absoluteUri_ = null;

/** @type {?string} */
this.absoluteMediaPlaylistUri_ = absoluteMediaPlaylistUri;

/** @type {?string} */
this.verbatimSegmentUri_ = verbatimSegmentUri;
/** @const {?string} */
this.verbatimSegmentUri = verbatimSegmentUri;

/** @type {!Array.<shaka.hls.Tag>} */
this.partialSegments = partialSegments;
}

/**
* Returns an absolute URI.
*
* @return {string}
*/
get absoluteUri() {
if (!this.absoluteUri_ &&
this.absoluteMediaPlaylistUri_ && this.verbatimSegmentUri_) {
goog.asserts.assert(this.absoluteMediaPlaylistUri_,
'An absolute Media Playlist URI should be defined!');
goog.asserts.assert(this.verbatimSegmentUri_,
'An verbatim segment URI should be defined!');
this.absoluteUri_ = shaka.hls.Utils.constructAbsoluteUri(
this.absoluteMediaPlaylistUri_, this.verbatimSegmentUri_);
this.absoluteMediaPlaylistUri_ = null;
this.verbatimSegmentUri_ = null;
}
return this.absoluteUri_ || '';
}
};


Expand Down
Loading

0 comments on commit a55ebab

Please sign in to comment.